473,320 Members | 1,817 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,320 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 1386
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.