webmethod ... multiple objects response ...

S

Steph

hello, i ve a webservice, and i must return multiple object ! how do ?

request :
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<CalcArea xmlns="http://example.org/geometry/" unite="radian"
floor="3">
<length>2.3</length>
<width>1.2</width>
</CalcArea>
</soap:Body>
</soap:Envelope>


reponse :
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<MyResponse>
<CalcAreaResult xmlns="http://example.org/geometry/">
<cal>12.345</cal>
</CalcAreaResult>
<anotherclass>
<var1>123</var1>
<var2>qwerty</var2>
</anotherclass>
<anotherclass2>
<calculresult>12.345</calculresult>
</anotherclass2>
<MyResponse>
</soap:Body>
</soap:Envelope>


1) how change the "CalcAreaResult" name ? Or delete this element !
2) how write my cs class ??? :

[WebMethod]
[SoapDocumentMethod(ResponseElementName = "MyResponse")]
public CalcResponse CalcArea(...)
{
CalcResponse resp = new CalcResponse();
return resp;
}

public class CalcResponse
{
public c_anotherclass1 anotherclass1=new c_anotherclass1();
public c_anotherclass2 anotherclass2=new c_anotherclass2();

public class c_anotherclass1
{
public string var1;
public string var2;
}
public class c_anotherclass2
{
public string calculresult;
}
}



thanks...
 
M

Marc Gravell

Have you tried simply running the wsdl through wsdl.exe and seeing what
it generates for you?

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top