1

I've come across a problem that I cannot figure out how to fix. I've created a soap client in php that is supposed to do an xml request to a web service - the service is working through SoapUI, but whenever I send the same request through my php client I get the following faultcode:

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <soapenv:Fault>
      <faultcode>**soapenv:VersionMismatch**</faultcode>
      <faultstring>**Transport level information does not match with SOAP Message namespace URI**</faultstring>
      <detail></detail>
    </soapenv:Fault>
  </soapenv:Body>
</soapenv:Envelope>

Now, both the client and the service are working with soap version 1.2, I believe that the problem is in the client, so here it is how I've defined it:

$options  = array(
    'trace'        => true, 
    'exceptions'   => 1, 
    'style'        => SOAP_DOCUMENT,
    'use'          => SOAP_LITERAL,
    'soap_version' => SOAP_1_2,
);
$client = new SoapClient("location_of_the_wsdl", $options);

In the request I'm using the following code:

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <env:Header/>
   <env:Body>
      <ns2:FunctionName xmlns:ns2="namespace_of_the_service">
         <arg0>
              <data1>?</data1>
           </arg0>
       </ns2:FunctionName>
   </env:Body>
</env:Envelope>

In soapUI this is giving me a 'false' result as the data1 is left with ?, when I write in valid data it returns true.

I've also noticed that in soapUI I'm sending and receiving the Content-type application/soap+xml, but when I'm doing it through the PHP client I send and receive headers with Content-Type text/xml;

What could be the problem? I use nusoap.php for the client.

hakre
  • 193,403
  • 52
  • 435
  • 836
Iv3
  • 11
  • 1
  • 3

2 Answers2

1

Make sure the WSDL caching feature is disabled in php.ini file of your development (test) machine by setting

soap.wsdl_cache_enabled=0 

I got stocked in this problem for more than 1 day only because of cached WSDL :)

Aboozar
  • 51
  • 2
0

You are using SOAP version 1.2 to make your calls. Can you check if the version used by the web service is indeed 1.2 and not 1.1.

web-nomad
  • 6,003
  • 3
  • 34
  • 49
  • I did. It is 100% 1.2 - if I change the version in the client call, I get an error of mismatched versions but with faultstring of 'you can use only SOAP 1.2' :/ – Iv3 Feb 05 '13 at 07:57
  • Ok. What are the headers you are using? `Content-Type` etc. Can you post them here. – web-nomad Feb 05 '13 at 08:02
  • I do believe the problem must be in the nusoap.php of SourceForge - according to this: http://sourceforge.net/projects/nusoap/forums/forum/193578/topic/3947116 when I use soap 1.2 things in the requests it won't work, so right now I'm re-writing the nusoap to work with soap 1.2 - hopefully this will fix the problem. But any other ideas are welcome (or solutions to use soap 1.2 with some other php class like nusoap) – Iv3 Feb 05 '13 at 08:03
  • See these threads - http://en.usenet.digipedia.org/thread/13879/9873/, http://wso2.org/library/559 – web-nomad Feb 05 '13 at 08:04