Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

soap response help c#

Status
Not open for further replies.

plork123

Programmer
Mar 8, 2004
121
GB
hi all
i'm calling a webservice using c# in a windows app that returns a complex type []

ComplextType [] complextType = null;
complextType = service.getMethod(a, b, c, d)
then iterating through to ge the results, here i'm using c# (visual studio 2005) inttli sense
for (int i = 0; i < complextType .Length; i++)
{
string name = complextType .name;
string display = complextType .name;
}
and this bring back the results. BUT i want to retrun the id, but this keeps coming back as null
I've done a tcptrace on the raw soap response and i can see the id has a value, however when i do complextType .id the value is null

looking at the siap response i can see the id value (123) but it's in a separate multifred tag, is anone able to show me how i get the id?

soap :

<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle=" xsi:type="ns3:ComplexType" xmlns:soapenc=" xmlns:ns3=" <id href="#id1"/>
<display xsi:type="soapenc:string">display value</display>
<name xsi:type="soapenc:string">name value</name>
</multiRef>

<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle=" xsi:type="soapenc:long" xmlns:soapenc="


The ID i want is returned as a reference to a type can anyone tell me how i 'grab' the ID value?

Also is anyone able to tell me how in c# i can capture the raw xml repsonse? I've been llooking a SoapMessage but don't know how to use it

thanks for any help
 
I dont believe you are allowed to pass arrays through SOAP. At least not directly.

I pass some pretty complex objects (uneven trees of complex objects actually) through soap. But before I do, i output them as XML documents. My webservice accepts and returns XmlDocument as the type.
 

this is not my web service so have no control on what is returned. i get get the values in the first section of soap i posted above but i need to get the <multiRef id="id1" value of 123

can you give me an example of doing an xmldocument as a type?

also do you know how i can get the raw soap response using c#, i know in java you can do something like this

Service service = new Service();
Call call = (Call)service.createCall();
Message message = call.getResponseMessage();
SOAPEnvelope envelope = message.getSOAPEnvelope();

But i'm not sure how i'd do this in c#

thanks for any help
 
I'm not sure how to do it in C# either, I just invoke it through a browser on the local server. (by default you can only invoke them via browser if the browser is open on the same machine)

heres an example of something I use:

public XmlDocument SynchProducts(XmlDocument clientProductList)

the client app passes in a list of the products they have, the service compares them to the up to date list, sends corrections back as an xml document. incoming lists could be of any length, and even of varying types (we have some producst that are subsets of other products) and the returned XML doc can be of any length too, it can return the full list, a few products, or even none (which means client app is all up to date)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top