473,385 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Returned Value From Web Service

Here is some code from my web service

<WebMethod()> Public Function GetProduct() As Products
Dim a As Product
Dim p As New Products()
Return CType(p, Products)
End Function

What I get is something like below:

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfProduct xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.gestaltsolutions.net/">
<Product>
<Name>1</Name>
<ProductID>1</ProductID>
</Product>
<Product>
<Name>2</Name>
<ProductID>2</ProductID>
</Product>
<Product>
<Name>3</Name>
<ProductID>3</ProductID>
</Product>
<Product>
<Name>4</Name>
<ProductID>4</ProductID>
</Product>
<Product>
<Name>5</Name>
<ProductID>5</ProductID>
</Product>
<Product>
<Name>6</Name>
<ProductID>6</ProductID>
</Product>
<Product>
<Name>7</Name>
<ProductID>7</ProductID>
</Product>
<Product>
<Name>8</Name>
<ProductID>8</ProductID>
</Product>
<Product>
<Name>9</Name>
<ProductID>9</ProductID>
</Product>
<Product>
<Name>10</Name>
<ProductID>10</ProductID>
</Product>
<Product>
<Name>11</Name>
<ProductID>11</ProductID>
</Product>
<Product>
<Name>12</Name>
<ProductID>12</ProductID>
</Product>
<Product>
<Name>13</Name>
<ProductID>13</ProductID>
</Product>
<Product>
<Name>14</Name>
<ProductID>14</ProductID>
</Product>
<Product>
<Name>15</Name>
<ProductID>15</ProductID>
</Product>
<Product>
<Name>16</Name>
<ProductID>16</ProductID>
</Product>
<Product>
<Name>17</Name>
<ProductID>17</ProductID>
</Product>
<Product>
<Name>18</Name>
<ProductID>18</ProductID>
</Product>
<Product>
<Name>19</Name>
<ProductID>19</ProductID>
</Product>
<Product>
<Name>20</Name>
<ProductID>20</ProductID>
</Product>
</ArrayOfProduct>

My problem is if I want to change return datatype from "ArrayOfProduct" to
"Products", is it possible to do that? If yes how do I do to change it?
Jul 19 '05 #1
1 1388
I don't think there is a way to do this automatically. You will have to
write a wrapper that takes this array and returns a collection.

HTH
"Teeravee Sirinapasawasdee" <po***@gestaltsolutions.net> wrote in message
news:eJ*************@tk2msftngp13.phx.gbl...
Here is some code from my web service

<WebMethod()> Public Function GetProduct() As Products
Dim a As Product
Dim p As New Products()
Return CType(p, Products)
End Function

What I get is something like below:

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfProduct xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.gestaltsolutions.net/">
<Product>
<Name>1</Name>
<ProductID>1</ProductID>
</Product>
<Product>
<Name>2</Name>
<ProductID>2</ProductID>
</Product>
<Product>
<Name>3</Name>
<ProductID>3</ProductID>
</Product>
<Product>
<Name>4</Name>
<ProductID>4</ProductID>
</Product>
<Product>
<Name>5</Name>
<ProductID>5</ProductID>
</Product>
<Product>
<Name>6</Name>
<ProductID>6</ProductID>
</Product>
<Product>
<Name>7</Name>
<ProductID>7</ProductID>
</Product>
<Product>
<Name>8</Name>
<ProductID>8</ProductID>
</Product>
<Product>
<Name>9</Name>
<ProductID>9</ProductID>
</Product>
<Product>
<Name>10</Name>
<ProductID>10</ProductID>
</Product>
<Product>
<Name>11</Name>
<ProductID>11</ProductID>
</Product>
<Product>
<Name>12</Name>
<ProductID>12</ProductID>
</Product>
<Product>
<Name>13</Name>
<ProductID>13</ProductID>
</Product>
<Product>
<Name>14</Name>
<ProductID>14</ProductID>
</Product>
<Product>
<Name>15</Name>
<ProductID>15</ProductID>
</Product>
<Product>
<Name>16</Name>
<ProductID>16</ProductID>
</Product>
<Product>
<Name>17</Name>
<ProductID>17</ProductID>
</Product>
<Product>
<Name>18</Name>
<ProductID>18</ProductID>
</Product>
<Product>
<Name>19</Name>
<ProductID>19</ProductID>
</Product>
<Product>
<Name>20</Name>
<ProductID>20</ProductID>
</Product>
</ArrayOfProduct>

My problem is if I want to change return datatype from "ArrayOfProduct" to
"Products", is it possible to do that? If yes how do I do to change it?

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jimmy | last post by:
Hey Im calling a webservice wich is returning a DataSet. In the DataSet, wich is generated from a SQL query, there is a date field. This datefield (datetime) has the value '12-04-2004' (Danish...
2
by: SteveR | last post by:
I want to return an ArrayList from my web service. I can write this part and everything compiles but I can't get the web application that uses the web service to compile. I call the service...
5
by: Ian Meakin | last post by:
I am trying to consume a web service i have written. The web service returns to the client an array of objects. The web service when tested via inetrnet explorer retruns the correct xml data. I...
1
by: Matthew | last post by:
Using .NET 1.1 I trying to consume a web service that returns an integer and an array of type string which I declare and use line this Dim Results() As String Me.txtMain.Text =...
2
by: Jim S | last post by:
I have a .net framework 2.0 client (Pocket PC) and a .net 2.0 webservice that communicate on the same LAN. The Pocket PC has no problem consuming strings returned from the web service methoeds but...
6
by: ewolfman | last post by:
Hi, Is there any way in which I can monitor / hook the Registry, and upon a call to a specific key from a specific application - swap the returned value? I was thinking of using this method...
9
by: DanielJohnson | last post by:
I am wondering where does the value returned by main goes. Suppoes main returns some number say 42, where is it stored. Supposed a shell script call a C program and the program returns the value...
4
by: =?Utf-8?B?R3JlZw==?= | last post by:
I am a newbie to WCF so please forgive if this is an obvious question. I have the following. (Service contract) IEmployee public interface IEmployee { List<EmployeeGetEmployeeByID(string...
5
by: =?Utf-8?B?V0c=?= | last post by:
Hi, I have the following ws method... public Class1 GetClass1() { return new Class1(); }
6
by: Nick | last post by:
Hi there, I have a Windows Service application that has a load of settings defined, I can access these using My.Settings. I would like to pass the NameValueCollection of the settings to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.