2

I'm trying to connect to a WebService SOAP. The service requires us to add a custom parameter in the HTTP header of the soap call

$context = array('http' =>
    array(
        'header'  => "APIToken: $api_token\r\n"
    )
);
$soap_options = array(
    'stream_context' => stream_context_create($context),
    'encoding' => 'UTF-8',
    'exceptions' => TRUE,
    'trace' => true,
    'local_cert' => 'mycert.pem',
    'passphrase'=>'xxx',
    'location'=>$this->url_soap_dev
);

$soap_client = new SoapClient('soap.wsdl', $soap_options);

$args = array(
    'param1' => $var,
    'param2' => 0,
    'optionalParameters'=>array()
);

$ret = $soap_client->RemoteFunction(array('parameter'=>$args));  

And this is my Request Headers:

POST /server/soap HTTP/1.1
Host: domain.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.2.6-1+lenny16
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 400

Where can I add custom param ?

Thx.

2 Answers 2

2

This process works fine with PHP >= 5.3

Here is the patch to add this functionality https://bugs.php.net/bug.php?id=49853

Sign up to request clarification or add additional context in comments.

Comments

0

With php 5.6, I got the sample code at the top working without any functional changes all I did was to change WSDL, header values to the server I'm using.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.