0

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/">
  <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/"/>
      </input>
      <output>
        <soap:body namespace="urn:something" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </output>
    </operation>
    </binding>
  <service name="somethingService">
    <port name="someAPIPort" binding="typens:someAPIBinding">
      <soap:address location="http://something/soap/"/>
    </port>
  </service>
</definitions>
2
  • does the wsdl look 'good'? i would bet that the wsdl has something like xsd:any or something like that... you probably could just write your own wsdl if the person on the other end doesn't know how to 'fix' the wsdl they gave you... Commented Jan 4, 2010 at 1:01
  • I think, you are right, thx. I've added a WSDL file fragment to the question text. Do you know how to fix it the best (or/and the easiest) way? It's my first time I have to work with SOAP. Commented Jan 5, 2010 at 23:52

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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 ).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.