working WS-Addressing and WS-Security filters
This commit is contained in:
parent
2e155db8f9
commit
aa35e9e172
|
@ -191,13 +191,13 @@ class SoapClient extends \SoapClient
|
||||||
protected function __doRequest2(SoapRequest $soapRequest)
|
protected function __doRequest2(SoapRequest $soapRequest)
|
||||||
{
|
{
|
||||||
// run SoapKernel on SoapRequest
|
// run SoapKernel on SoapRequest
|
||||||
$soapRequest = $this->soapKernel->filterRequest($soapRequest);
|
$this->soapKernel->filterRequest($soapRequest);
|
||||||
|
|
||||||
// perform HTTP request with cURL
|
// perform HTTP request with cURL
|
||||||
$soapResponse = $this->__doHttpRequest($soapRequest);
|
$soapResponse = $this->__doHttpRequest($soapRequest);
|
||||||
|
|
||||||
// run SoapKernel on SoapResponse
|
// run SoapKernel on SoapResponse
|
||||||
$soapResponse = $this->soapKernel->filterResponse($soapResponse);
|
$this->soapKernel->filterResponse($soapResponse);
|
||||||
|
|
||||||
return $soapResponse;
|
return $soapResponse;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,9 @@
|
||||||
namespace BeSimple\SoapClient;
|
namespace BeSimple\SoapClient;
|
||||||
|
|
||||||
use BeSimple\SoapCommon\Helper;
|
use BeSimple\SoapCommon\Helper;
|
||||||
|
use BeSimple\SoapCommon\SoapRequest as CommonSoapRequest;
|
||||||
use BeSimple\SoapCommon\SoapRequestFilter;
|
use BeSimple\SoapCommon\SoapRequestFilter;
|
||||||
|
use BeSimple\SoapCommon\SoapResponse as CommonSoapResponse;
|
||||||
use BeSimple\SoapCommon\SoapResponseFilter;
|
use BeSimple\SoapCommon\SoapResponseFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,6 +163,21 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset all properties to default values.
|
||||||
|
*/
|
||||||
|
public function resetFilter()
|
||||||
|
{
|
||||||
|
$this->faultTo = null;
|
||||||
|
$this->from = null;
|
||||||
|
$this->messageId = null;
|
||||||
|
$this->referenceParametersRecieved = array();
|
||||||
|
$this->referenceParametersSet = array();
|
||||||
|
$this->relatesTo = null;
|
||||||
|
$this->relatesToRelationshipType = null;
|
||||||
|
$this->replyTo = null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set FaultTo address of type xs:anyURI.
|
* Set FaultTo address of type xs:anyURI.
|
||||||
*
|
*
|
||||||
|
@ -237,11 +254,11 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
|
||||||
/**
|
/**
|
||||||
* Modify the given request XML.
|
* Modify the given request XML.
|
||||||
*
|
*
|
||||||
* @param SoapRequest $request SOAP request
|
* @param \BeSimple\SoapCommon\SoapRequest $request SOAP request
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function filterRequest(SoapRequest $request)
|
public function filterRequest(CommonSoapRequest $request)
|
||||||
{
|
{
|
||||||
// get \DOMDocument from SOAP request
|
// get \DOMDocument from SOAP request
|
||||||
$dom = $request->getContentDocument();
|
$dom = $request->getContentDocument();
|
||||||
|
@ -306,11 +323,11 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
|
||||||
/**
|
/**
|
||||||
* Modify the given response XML.
|
* Modify the given response XML.
|
||||||
*
|
*
|
||||||
* @param SoapResponse $response SOAP response
|
* @param \BeSimple\SoapCommon\SoapResponse $response SOAP response
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function filterResponse(SoapResponse $response)
|
public function filterResponse(CommonSoapResponse $response)
|
||||||
{
|
{
|
||||||
// get \DOMDocument from SOAP response
|
// get \DOMDocument from SOAP response
|
||||||
$dom = $response->getContentDocument();
|
$dom = $response->getContentDocument();
|
||||||
|
|
|
@ -17,7 +17,9 @@ use ass\XmlSecurity\Enc as XmlSecurityEnc;
|
||||||
use ass\XmlSecurity\Key as XmlSecurityKey;
|
use ass\XmlSecurity\Key as XmlSecurityKey;
|
||||||
|
|
||||||
use BeSimple\SoapCommon\Helper;
|
use BeSimple\SoapCommon\Helper;
|
||||||
|
use BeSimple\SoapCommon\SoapRequest as CommonSoapRequest;
|
||||||
use BeSimple\SoapCommon\SoapRequestFilter;
|
use BeSimple\SoapCommon\SoapRequestFilter;
|
||||||
|
use BeSimple\SoapCommon\SoapResponse as CommonSoapResponse;
|
||||||
use BeSimple\SoapCommon\SoapResponseFilter;
|
use BeSimple\SoapCommon\SoapResponseFilter;
|
||||||
use BeSimple\SoapCommon\WsSecurityKey;
|
use BeSimple\SoapCommon\WsSecurityKey;
|
||||||
|
|
||||||
|
@ -178,6 +180,25 @@ class WsSecurityFilter implements SoapRequestFilter, SoapResponseFilter
|
||||||
$this->passwordType = $passwordType;
|
$this->passwordType = $passwordType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset all properties to default values.
|
||||||
|
*/
|
||||||
|
public function resetFilter()
|
||||||
|
{
|
||||||
|
$this->actor = null;
|
||||||
|
$this->addTimestamp = null;
|
||||||
|
$this->encryptSignature = null;
|
||||||
|
$this->expires = null;
|
||||||
|
$this->password = null;
|
||||||
|
$this->passwordType = null;
|
||||||
|
$this->serviceSecurityKey = null;
|
||||||
|
$this->signAllHeaders = null;
|
||||||
|
$this->tokenReferenceEncryption = null;
|
||||||
|
$this->tokenReferenceSignature = null;
|
||||||
|
$this->username = null;
|
||||||
|
$this->userSecurityKey = null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get service security key.
|
* Get service security key.
|
||||||
*
|
*
|
||||||
|
@ -233,11 +254,11 @@ class WsSecurityFilter implements SoapRequestFilter, SoapResponseFilter
|
||||||
/**
|
/**
|
||||||
* Modify the given request XML.
|
* Modify the given request XML.
|
||||||
*
|
*
|
||||||
* @param SoapRequest $request SOAP request to modify
|
* @param \BeSimple\SoapCommon\SoapRequest $request SOAP request
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function filterRequest(SoapRequest $request)
|
public function filterRequest(CommonSoapRequest $request)
|
||||||
{
|
{
|
||||||
// get \DOMDocument from SOAP request
|
// get \DOMDocument from SOAP request
|
||||||
$dom = $request->getContentDocument();
|
$dom = $request->getContentDocument();
|
||||||
|
@ -256,7 +277,7 @@ class WsSecurityFilter implements SoapRequestFilter, SoapResponseFilter
|
||||||
|
|
||||||
// create security header
|
// create security header
|
||||||
$security = $filterHelper->createElement(Helper::NS_WSS, 'Security');
|
$security = $filterHelper->createElement(Helper::NS_WSS, 'Security');
|
||||||
$filterHelper->addHeaderElement($security, true, $this->actor, $request->getSoapVersion());
|
$filterHelper->addHeaderElement($security, true, $this->actor, $request->getVersion());
|
||||||
|
|
||||||
if (true === $this->addTimestamp || null !== $this->expires) {
|
if (true === $this->addTimestamp || null !== $this->expires) {
|
||||||
$timestamp = $filterHelper->createElement(Helper::NS_WSU, 'Timestamp');
|
$timestamp = $filterHelper->createElement(Helper::NS_WSU, 'Timestamp');
|
||||||
|
@ -355,11 +376,11 @@ class WsSecurityFilter implements SoapRequestFilter, SoapResponseFilter
|
||||||
/**
|
/**
|
||||||
* Modify the given request XML.
|
* Modify the given request XML.
|
||||||
*
|
*
|
||||||
* @param SoapResponse $response SOAP response to modify
|
* @param \BeSimple\SoapCommon\SoapResponse $response SOAP response
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function filterResponse(SoapResponse $response)
|
public function filterResponse(CommonSoapResponse $response)
|
||||||
{
|
{
|
||||||
// get \DOMDocument from SOAP response
|
// get \DOMDocument from SOAP response
|
||||||
$dom = $response->getContentDocument();
|
$dom = $response->getContentDocument();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the BeSimpleSoapClient.
|
* This file is part of the BeSimpleSoapClient.
|
||||||
|
|
Loading…
Reference in New Issue