1

I've made some research and didn't find a solution for this. I have a PHP SOAP Client and I try to stablish a connection with a SAP WebService, but there is a required policy in the wsdl that I don't know how to set when I try to create the client in PHP. Here's part of the WSDL:

<wsdl:definitions xmlns:wsdl="http://schemas..." xmlns:wsu="http://doc....xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:p1="http..." targetNamespace="http..." name="SI_Sucursal_OS">
    <wsdl:documentation/>
    <wsp1_2:UsingPolicy xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" wsdl:required="true"/>
    <wsp1_2:Policy xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" wsu:Id="OP_SI_Sucursal_OS"/>
    <wsdl:types>...

The error:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Unknown required WSDL extension 'http://schemas.xmlsoap.org/ws/2004/09/policy' in ...

And the code for the client:

ini_set('soap.wsdl_cache_enabled', 0);
ini_set('soap.wsdl_cache_ttl', 900);
ini_set('default_socket_timeout', 15);

$user     = 'user';
$password = 'password';
$wsdl     = 'http:...';

$SOAP_CONFIG = array(
    'login' => $user,
    'password' => $password,
    'authentication' => SOAP_AUTHENTICATION_BASIC,
    'soap_version' => SOAP_1_1,
    'connection_timeout' => 15,
    'encoding' => 'UTF-8'
);

$client = new SoapClient($wsdl, $SOAP_CONFIG);

Also, when i save the wsdl and change the part:

<wsp1_2:UsingPolicy ... wsdl:required="true"/>

to false, i can create the Client, but the idea it's to use the url location of the web service, not a local modified file. I've checked the solutions posted here:

PHP SoapClient: Unknown required WSDL extension

But none of them seems to apply to me.

Community
  • 1
  • 1
hedka77
  • 107
  • 5
  • 17
  • 1
    I'm in the same boat. I don't own the soap server, so I cannot make the suggested policy change. Did you ever solve this? – Chad Hutchins Mar 19 '21 at 15:33
  • @ChadHutchins hey man, I believe I couldn't make it work. My very last version of this code still have the `new SoapClient(./path/to/my/local/wsdl)`. That was the only way for me. Also i added `cache_wsdl => WSDL_CACHE_NONE` and `trace => true` to the soap_config. – hedka77 Apr 05 '21 at 16:19

0 Answers0