Search code examples
phpweb-servicessoapwsdlsoap-client

PHP Soap Client Errors


I'm trying to use a web service provided by a third party organisation.

The URL for the service is this

This is what I've tried:

$sc = new SoapClient( $my_wsdl_url, array(
            'soap_version' => SOAP_1_2
        ) );

First problem: When checking for the provided functions, I get a UNKNOWN type:

array(3) {
  [0]=>
  string(26) "UNKNOWN getDeletedHotels()"
  [1]=>
  string(23) "UNKNOWN getMasterData()"
  [2]=>
  string(44) "UNKNOWN getHotelData(dateTime $dRequestDate)"
}

I found this, but I have no access to the SOAP-Server. So, how can I change settings in my SOAP-Client in order to get the correct return types?

Nevertheless, I tried to call the above function getHotelData(), but it takes about 2 minutes to get a response. And the response is an error:

Fatal error: Uncaught SoapFault exception: [HTTP] Error Fetching http 
body, No Content-Length, connection closed or chunked data in [...]

There are several posts with the same error message. I read this post here and tried it by adding these settings to the client:

 $sc = new SoapClient( $my_wsdl_url, array(
            'soap_version' => SOAP_1_2,
            'trace' => 1,
            'stream_context' => stream_context_create( array( 
                'http' => array( 
                    'protocol_version' => 1.0 
                ) ) );
        ) );

After that, the server is not responding at all!

So, I am a little bit stuck here. Can somebody push me in the right direction?

PHP-Version is 5.4.19, on a mac running xampp

Update

I reduced the above code to the minimal requirements (without the login stuff), but still I cannot get the complete list.

When testing with one of Amazon's Webservices, I get a complete list of all available functions.

$sc = new SoapClient( 'http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl', array(
    'soap_version' => SOAP_1_2,
) );

// List all functions. This works
var_dump( $sc->__getFunctions() );

So, could it be that the webservice itself is not setup correctly?


Solution

  • I ended up with a working solution, inspired by this answer here: Sending Raw XML via PHP SoapClient request after getting the required request XML by using the software from http://www.soapui.org/