Ankit Rustagi
Ankit Rustagi

Reputation: 5637

SOAP Response WCF Web service

I am working on a SOAP based Web Service. My question is if it is possible to create a SOAP response in the format below

<tagname1>
<tag1> value1 </tag1>
<tag1> value2 </tag1>
</tagname1>

Specifically my doubt is if i can return 2 different values (ie value1 and value2 ) within two different tags which have same tag-names (ie tag1)

BTW i have created a class, and i am returning that class object as the response thus all fields of that class object appear as individual tags in the SOAP Response.

UPDATE

I found a partial solution. I have created an array element in my response class. I used the array element to store the list. When i returned the class object this was what i got -

<tagname .... >
<a:String> value1 </a:String>
<a:String> value2 </a:String>
<a:String> value3 </a:String>
</tagname>

any way i could replace "a:long" with an actual tagname ?

Upvotes: 2

Views: 418

Answers (1)

Kris
Kris

Reputation: 8873

SOAP is only a specific way of sending some data in some organized and structured way. You can send any format request which follows SOAP specs. The request should be a valid xml. The response is again formed by the server, in the same way. I'm not an expert in WCF. But SOAP i can tell you, the response should be a valid xml, nothing else. But mind this thing, who will be using the response?, If you only use it for internal purpose, you dont have any problems with any representation. But if you plan to expose it as some public service, make your response meaningful.

Thanks

Upvotes: 1

Related Questions