views:

312

answers:

1

I have to connect with PHP WebService via SOAP from a .Net (C#, WPF) application. I added reference to this service, some proxies were generated.

When I invoked some function:

var client = new someAPIPortTypeClient();
XmlNode[] response = client.status(arg1, arg2);    

I got response:

SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:nakopitel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
   <SOAP-ENV:Body>
      <ns1:statusResponse>
         <statusReturn xsi:type="ns2:Map">
            <item>
               <key xsi:type="xsd:string">is_active</key>
               <value xsi:type="xsd:boolean">true</value>
            </item>
            <item>
               <key xsi:type="xsd:string">allow_add_paid</key>
               <value xsi:type="xsd:boolean">false</value>
            </item>
            <item>
               <key xsi:type="xsd:string">allow_search_free</key>
               <value xsi:type="xsd:boolean">true</value>
            </item>
            <item>
               <key xsi:type="xsd:string">allow_add_free</key>
               <value xsi:type="xsd:boolean">true</value>
            </item>
         </statusReturn>
      </ns1:statusResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

It interpreted like XmlNode[]...

How can I get normal proxy-classes to work with this SOAP-service? I can ask the service author to change something if it requires.

Update. WSDL for status function.

<?xml version='1.0' encoding='UTF-8'?>

<definitions name="something" targetNamespace="urn:something" xmlns:typens="urn:something" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"&gt;
  <message name="status">
    <part name="terminal" type="xsd:integer"/>
    <part name="code" type="xsd:string"/>
  </message>
  <message name="statusResponse">
    <part name="statusReturn" type="xsd:anyType"/>
  </message>
  <portType name="someAPIPortType">
    <operation name="status">
      <documentation>
        Get status
      </documentation>
      <input message="typens:status"/>
      <output message="typens:statusResponse"/>
    </operation>
    </portType>
    <binding name="someAPIBinding" type="typens:someAPIPortType">
    <operation name="status">
      <soap:operation soapAction="urn:someAPIAction"/>
      <input>
        <soap:body namespace="urn:something" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/&gt;
      </input>
      <output>
        <soap:body namespace="urn:something" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/&gt;
      </output>
    </operation>
    </binding>
  <service name="somethingService">
    <port name="someAPIPort" binding="typens:someAPIBinding">
      <soap:address location="http://something/soap/"/&gt;
    </port>
  </service>
</definitions>
A: 

To make a long story short, if you want things to work the way you want them to, you have to define a proper WSDL. XSD_ANY is just asking for trouble.

benjy
Yeap, I've already understood this. For example, I can create SOAP service in MS Visual Studio and use a generated WSDL file in php service... It's one of the simplest solutions ).
aks