0

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?

Thanks,

Pete

<?php
  $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);

  try
  { 
    $response = $client->getMessage($parameters);
  }
  catch (Exception $e) 
  {
    dumpVars($client->__getLastRequest()); 
    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"?>
    <SOAP-ENV:Envelope 
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
      xmlns:ns1="http://domain.com/soap_request" 
      xmlns:ns2="http://domain.com/soap_request/">
      <SOAP-ENV:Body>
        <ns2:getMessageTypeDef>
        <ns1:requestAPI>API_TYPE1</ns1:requestAPI>
        <ns1:requestOperation>getMessageByDate</ns1:requestOperation>
        </ns2:getMessageTypeDef>
      </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
2
Contributors
5
Replies
8
Views
6 Years
Discussion Span
Last Post by ppetree
0

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

0

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

0

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.

0

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.