Hi All!

I'm apparently doing something very wrong here... I can't get my soap client to send the security certificate which a valid .pem file and because of that the subsequent calls are failing.

What do I have to do to get the soap client to send the pem file?



  $wsdl = "open.wsdl";
  // setup the transaction array
  $header = array('local_cert' => "certificate.pem",
                  'logonUser'  => "user_name",
                  'style'      => SOAP_DOCUMENT,
                  'use'        => SOAP_LITERAL,
                  'exceptions' => true,
                  'trace'      => true);                  
  // create the soap client, this will log us in
  $client = new SoapClient($wsdl, $header);

    $response = $client->getMessage($parameters);
  catch (Exception $e) 
    echo 'Caught exception: ',  $e->getMessage(), "\n"; 

Notice how none of the header info is being sent and no security certificate!

<?xml version="1.0" encoding="UTF-8"?>
6 Years
Discussion Span
Last Post by ppetree

Apparently, PHP does not support WS security in its soap class so, its not that I'm doing something wrong... its php!


Simple. PHP does not natively support WS-Security in its SoapClient class nor in its SoapServer class. You have to superclass the php soap class and add support.

Comparing other tools: .net, ruby etc. they all support ws-security natively so with a few clicks you have it taken care of.

Dont get me wrong, I'm a huge PHP fan but it does have a few gaping wholes.

Edited by ppetree: n/a


I understand your point, but since I write rarely in .net and have more flight hours with Java , so the word “natively” has a little meaning to me. I have never tried to use WS-Secure in PHP , although what I’ve read in php.net pointed that it is easy as well. Take a look at http://wso2.org/library/2814 (just searching about it). Hope you find your way to it easily, and maybe the best way is what you said, to create a super class covering your needs.


Natively means the functions are built in and can be made to work with little effort. Having to extend classes etc. is not natively.

I learned in my early days of programming that just because it looks easy doenst mean its the right thing to do! LOL

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.