skip to Main Content

I am trying to consume a SOAP web service with PHP.

The web service WSDL can be found here.

Simply creating the client like that:

try {
    $wsdlUrl = 'https://eu1.praxedo.com/eTech/services/cxf/v6/BusinessEventManager?WSDL';
    $client = new SoapClient($wsdlUrl);
}
catch(Exception $e) {
    echo $e->getMessage();
}

This fails with the following error:

SOAP-ERROR: Parsing WSDL: Unknown required WSDL extension ‘http://schemas.xmlsoap.org/ws/2004/09/policy’

I tried using 2 separate generators:

They both fail with the exact same error.

PHP version is 7.0

I found this old bug report from 2008 which apparently never got fixed because not enough info was submitted at the time.

Does anyone know how I can fix that issue?

2

Answers


  1. Not sure this is available on 7.0 but try setting the option soap_version to SOAP_1_2 (see the docs).

    Login or Signup to reply.
  2. If you look at your WSDL you will see it imports a WS-Policy section:

    <wsdl:import location="https://eu1.praxedo.com/eTech/services/cxf/v6/BusinessEventManager?wsdl=Pxo-policies-v1.0.wsdl" namespace="http://ws.praxedo.com/policies/v1.0">
    </wsdl:import>
    

    See http://specs.xmlsoap.org/ws/2004/09/policy/ws-policy.pdf for details:

    The Web Services Policy Framework (WS-Policy) provides a general purpose model and corresponding syntax to describe the policies of a Web Service. WS-Policy defines a base set of constructs that can be used and extended by other Web services specifications to describe a broad range of service requirements and capabilities.

    It’s probably on this that your code generator chokes, although I don’t know why; these policies apply at execution time. If you have difficulties generating the code because of them, you could remove that import from the WSDL and try to generate the client code without the policies. You basically download the WSDL to a local file, delete that import line above, and feed this modified local WSDL file to your code generators and your SoapClient.

    You will still need to respect the policies when calling the SOAP web service (for example, the service requires basic authentication), but the generated client code should be the same with both versions of the WSDL.

    As mentioned in the other answer, you also need to use SOAP 1.2 since the binding in the WSDL is defined as SOAP 1.2 (the SOAP Envelope will have this namespace xmlns:soap="http://www.w3.org/2003/05/soap-envelope").

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search