Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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>
share|improve this question
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... – dovholuk Jan 4 '10 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. – aks Jan 5 '10 at 23:52

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
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 Feb 10 '10 at 12:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.