MikeCombe
asked on
How do I declare my Web Method so the Soap Response display more elements than just a single element ?
If I create my WebMethod like this...
<WebMethod()> _
Public Function Test(ByVal FirstName As String _
, ByVal LastName As String _
, ByVal City As String _
) As String
The Soap Request listing on my test.asmx file looks like this...
<soap:Body>
<Test xmlns="http://test.com/">
<Firstname>string</Firstna
<LastName >string</LastName >
<City>string</City>
</Test>
</soap:Body>
and my Soap Response looks like....
<soap:Body>
<TestResponse xmlns="http://test.com/">
<TestResult>string</TestRe
</TestResponse>
</soap:Body>
QUESTION:
How do I declare my Web Method so the Soap Response looks like this...
<soap:Body>
<TestResponse xmlns="http://test.com/">
<TestResult>
<Color>string</Color>
<Age>string</Age>
<Speed>string</Speed>
</TestResult>
</TestResponse>
</soap:Body>
ASKER
Got it. I didn't realize that the webservice was just a function, so that makes sense. Would it be propert to return the "string" as this...
<Color>string</Color><Age> string</Ag e><Speed>s tring</Spe ed>
.... could that be parsed by normal xml ?
or....is it better to "return" an xml document ?
<Color>string</Color><Age>
.... could that be parsed by normal xml ?
or....is it better to "return" an xml document ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks...I wasn't sure if I needed to have my web service return an xml string or an xml document. I will return an xml string. My example was brief just to understand the concept. My actual response will be a string (in xml format) with about 20-30 element tags. I am planning on using the standard <?xml version="1.0" encoding="utf-8" ?> ...is that correct? Here's my sample response within the soap container:
<soap:Body>
<TestResponse xmlns="http://test.com/">
<TestResult>
<?xml version="1.0" encoding="utf-8" ?>
<myResult>
<Color>string</Color>
<Age>string</Age>
<Speed>string</Speed>
</myResult>
</TestResult>
</TestResponse>
</soap:Body>
<soap:Body>
<TestResponse xmlns="http://test.com/">
<TestResult>
<?xml version="1.0" encoding="utf-8" ?>
<myResult>
<Color>string</Color>
<Age>string</Age>
<Speed>string</Speed>
</myResult>
</TestResult>
</TestResponse>
</soap:Body>
maybe return a delimited string with all desired values, then break it down to it's components on the end application:
say the function return a single string like "Red|24|100"
and the end application uses split function with "|" delimiter