SOAP authentication with PHP

I need to connect to a web service that requires authentication credentials in the form of a plain text user name and password.

I have a basic understanding of SOAP and have managed to connect to other open web services that do not require a username or password using NuSOAP.

The following was sent to me:

<?php

// Set up security options
$security_options = array("useUsernameToken" => TRUE);
$policy = new WSPolicy(array("security" => $security_options));

$security_token = new WSSecurityToken(array(
    "user" => "xxx",
    "password" => "xxx",
    "passwordType" => "basic"));

// Create client with options
$client = new WSClient(array("wsdl" => "https://xxx.asmx?wsdl",
    "action" => "http://xxx",
    "to" => "https://xxx",
    "useWSA" => 'submission',
    "CACert" => "cert.pem",
    "useSOAP" => 1.1,
    "policy" => $policy,
    "securityToken" => $security_token));

// Send request and capture response
$proxy = $client->getProxy();

$input_array = array("From" => "2010-01-01 00:00:00",
    "To" => "2010-01-31 00:00:00");

$resMessage = $proxy->xxx($input_array);
?>

After some research I understand that the above implementation uses wso2. I need to be able to do this without using wso2.

I have tried my best to look for resources (Google, forums, etc) about the above but haven't been able to find anything. I have read some tutorials on SOAP and have been able to set up a SOAP client using PHP but cannot get my head around all the authentication and "policies".

An explanation of how to achieve this and maybe some links to further reading about this would be very much appreciated as I am tearing my hair out! Ideally I would like some links to resources for an absolute beginner to the SOAP authentication.

Thanks. P.S some of the links/credentials in the above could have been xxx'd for privacy.

6
задан Pranav C Balan 8 January 2014 в 13:10
поделиться