Hi,
I have to create a web service client which uses SOAP encoding but does not use
"multi-reference" values (see
http://www.w3.org/TR/2000/NOTE-SOAP-...#_Toc478383513 item 10).
If I create SOAP client like this:
public class StockService : SoapHttpClientProtocol {
[System.Web.Services.Protocols.SoapDocumentMethodAt tribute(Use=System.Web.Services.Description.SoapBi ndingUse.Encoded)]
public void MyMethod(MyClass[] myClasses) {
this.Invoke("MyMethod", new object[] {
myClasses});
}
I get SOAP request like that:
(envelope skipped)
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<types:MyMethod>
<myClasses href="#id1" /> <--------------- MULTI-REFERENCE VALUE :-(
</types:MyMethod>
<soapenc:Array id="id1" soapenc:arrayType="types:MyClass[2]">
<Item href="#id2" /> <--------------- MULTI-REFERENCE VALUE :-(
(other items skipped)
</soapenc:Array>
<types:MyClass id="id2" xsi:type="types:MyClass">
<SomeString xsi:type="xsd:string">First</SomeString>
<SomeInt xsi:type="xsd:int">1</SomeInt>
</types:MyClass>
(other items skipped)
</soap:Body>
If I use Literal encoding, I get nice "single-reference" values like that:
(envelope skipped)
<soap:Body>
<MyMethod xmlns="http://stockservice.contoso.com/wse/samples/2003/06">
<myClasses>
<MyClass>
<SomeString>First</SomeString>
<SomeInt>1</SomeInt>
</MyClass>
(other items skipped)
</myClasses>
</MyMethod>
</soap:Body>
Unfortunately this does not include the data type attributes.
My goal is to get following SOAP request:
(envelope skipped)
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<types:MyMethod>
<myClasses xsi:type="soapenc:Array" soapenc:arrayType="types:MyClass[2]">
<Item xsi:type="types:MyClass">
<SomeString xsi:type="xsd:string">First</SomeString>
<SomeInt xsi:type="xsd:int">1</SomeInt>
</Item>
(other items skipped)
</myClasses>
</types:MyMethod>
</soap:Body>
Is there any way to force the use of single-reference values? Otherwise it seems
I have to use the generic XML or XSL transformation to create required SOAP
request :(
All I have found is SoapFormatter class + attribute [SoapField(Embedded=true)].
That works great except for array types (MyClass[]).
Maybe somebody can suggest a suitable .NET library? Can WSE 2 solve these problems?
Thank you in advance
Kaimar
lo*******@hot.ee