本文整理汇总了PHP中SoapClient::__doRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP SoapClient::__doRequest方法的具体用法?PHP SoapClient::__doRequest怎么用?PHP SoapClient::__doRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoapClient
的用法示例。
在下文中一共展示了SoapClient::__doRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DOMDocument
function __doRequest($request, $location, $saction, $version)
{
$dom = new DOMDocument();
$dom->loadXML($request);
$objWSSE = new WSSESoap($dom);
/* Sign all headers to include signing the WS-Addressing headers */
$objWSSE->signAllHeaders = TRUE;
$objWSSE->addTimestamp();
/* create new XMLSec Key using RSA SHA-1 and type is private key */
$objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'private'));
/* load the private key from file - last arg is bool if key in file (TRUE) or is string (FALSE) */
$objKey->loadKey(PRIVATE_KEY, TRUE);
// Sign the message - also signs appropraite WS-Security items
$objWSSE->signSoapDoc($objKey);
/* Add certificate (BinarySecurityToken) to the message and attach pointer to Signature */
$token = $objWSSE->addBinaryToken(file_get_contents(CERT_FILE));
$objWSSE->attachTokentoSig($token);
$request = $objWSSE->saveXML();
$dom = new DOMDocument();
$dom->loadXML($request);
$objWSA = new WSASoap($dom);
$objWSA->addAction($saction);
$objWSA->addTo($location);
$objWSA->addMessageID();
$objWSA->addReplyTo();
$request = $objWSA->getDoc()->saveXML();
return parent::__doRequest($request, $location, $saction, $version);
}
示例2: __doRequest
/**
* __doRequest.
* @param string $request
* @param string$location
* @param string $action
* @param int $version
* @param int $oneWay
* @return string
*/
public function __doRequest($request, $location, $action, $version, $oneWay = 0)
{
$aFind = [':ns1', 'ns1:', "\n", "\r"];
$sReplace = '';
$newrequest = str_replace($aFind, $sReplace, $request);
return parent::__doRequest($newrequest, $location, $action, $version, $oneWay);
}
示例3:
function __doRequest($request, $location, $action, $version, $one_way = 0)
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->preserveWhiteSpace = false;
$dom->loadXML($request);
Yii::trace($request);
/** Setting namespaces **/
$dom->documentElement->setAttribute('xmlns:xs', 'http://www.w3.org/2001/XMLSchema');
$dom->documentElement->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
$dom->documentElement->setAttribute('xmlns:gns', 'http://nordu.net/namespaces/2013/12/gnsbod');
$dom->documentElement->setAttribute('xmlns:saml', 'urn:oasis:names:tc:SAML:2.0:assertion');
$dom->documentElement->setAttribute('xmlns:type', 'http://schemas.ogf.org/nsi/2013/12/connection/types');
$dom->documentElement->setAttribute('xmlns:head', 'http://schemas.ogf.org/nsi/2013/12/framework/headers');
/** Generating Correlation ID */
$dom->getElementsByTagName("correlationId")->item(0)->nodeValue = 'urn:uuid:' . $this->newGuid();
/** Setting prefixes of the elements **/
$this->changeTag($dom, "ConnectionTrace", "gns:ConnectionTrace");
$this->changeTag($dom, "reserve", "type:reserve");
$this->changeTag($dom, "reserveCommit", "type:reserveCommit");
$this->changeTag($dom, "provision", "type:provision");
$this->changeTag($dom, "p2ps", "p2p:p2ps");
/** Setting attributes **/
$this->setAttributeByTag($dom, "Connection", "index", "0");
$this->setAttributeByTag($dom, "criteria", "version", $this->version);
$this->setAttributeByTag($dom, "p2p:p2ps", "xmlns:p2p", "http://schemas.ogf.org/nsi/2013/12/services/point2point");
$this->setAttributeByTag($dom, "parameter", "type", "protection");
$this->setEro($dom);
$request = $dom->saveXML();
Yii::trace($request);
return parent::__doRequest($request, $location, $action, $version);
}
示例4: __doRequest
public function __doRequest($request, $location, $action, $version, $one_way = null)
{
$api = $this->getBaseApi();
$user = $api->getConfigData('merchant_id');
$password = $api->getConfigData('security_key');
$soapHeader = "<SOAP-ENV:Header xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><wsse:Security SOAP-ENV:mustUnderstand=\"1\"><wsse:UsernameToken><wsse:Username>{$user}</wsse:Username><wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">{$password}</wsse:Password></wsse:UsernameToken></wsse:Security></SOAP-ENV:Header>";
$requestDOM = new DOMDocument('1.0');
$soapHeaderDOM = new DOMDocument('1.0');
$requestDOM->loadXML($request);
$soapHeaderDOM->loadXML($soapHeader);
$node = $requestDOM->importNode($soapHeaderDOM->firstChild, true);
$requestDOM->firstChild->insertBefore($node, $requestDOM->firstChild->firstChild);
$request = $requestDOM->saveXML();
if ($api->getConfigData('debug')) {
/*Clean up PAN and CV2 for debug*/
$clean = simplexml_import_dom($requestDOM);
$del = $clean->xpath('//ns1:accountNumber | //ns1:cvNumber');
foreach ($del as $el) {
$el[0] = '';
}
$debugrequest = $clean->asXML();
$debug = Mage::getModel('cybersource/api_debug')->setAction($action)->setRequestBody($debugrequest)->save();
}
$response = parent::__doRequest($request, $location, $action, $version);
if (!empty($debug)) {
$debug->setResponseBody($response)->save();
}
return $response;
}
示例5: DomDocument
function __doRequest($request, $location, $action, $version)
{
$dom = new DomDocument('1.0', 'UTF-8');
$dom->preserveWhiteSpace = false;
$dom->loadXML($request);
$hdr = $dom->createElement('soapenv:Header');
$secNode = $dom->createElement("wsse:Security");
$secNode->setAttribute("soapenv:mustUnderstand", "1");
$secNode->setAttribute("xmlns:wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
$usernameTokenNode = $dom->createElement("wsse:UsernameToken");
$usernameTokenNode->setAttribute("wsu:Id", "UsernameToken-1");
$usernameTokenNode->setAttribute("xmlns:wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
$usrNode = $dom->createElement("wsse:Username");
$usrNode->appendChild($dom->createTextNode(WS_USER));
$pwdNode = $dom->createElement("wsse:Password");
$pwdNode->setAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");
$pwdNode->appendchild($dom->createTextnode(WS_PWD));
$usernameTokenNode->appendChild($usrNode);
$usernameTokenNode->appendChild($pwdNode);
$secNode->appendChild($usernameTokenNode);
$hdr->appendChild($secNode);
$dom->documentElement->insertBefore($hdr, $dom->documentElement->firstChild);
$request = $dom->saveXML();
$request = str_replace("SOAP-ENV", "soapenv", $request);
$request = str_replace("ns1", "cgt", $request);
$request = str_replace('<?xml version="1.0" encoding="UTF-8"?>', '', $request);
// echo "Este es el nuevo XML: " . print_r($request, true);
return parent::__doRequest($request, $location, $action, $version);
}
示例6: __doRequest
/**
* Do request into regon server
*
* @param string $request request
* @param string $location location
* @param string $action action
* @param int $version version
* @return string response
*/
public function __doRequest($request, $location, $action, $version = SOAP_1_2, $one_way = NULL)
{
$location = $this->location;
$response = parent::__doRequest($request, $location, $action, $version, $one_way);
$response = stristr(stristr($response, "<s:"), "</s:Envelope>", true) . "</s:Envelope>";
return $response;
}
示例7: __doRequest
public function __doRequest($request, $location, $action, $version, $one_way = 0)
{
$response = parent::__doRequest($request, $location, $action, $version, $one_way);
// strip away everything but the xml.
$response = preg_replace('#^.*(<\\?xml.*>)[^>]*$#s', '$1', $response);
return $response;
}
示例8: __doRequest
/**
* Do request
*
* @param string $request
* @param string $location
* @param string $action
* @param int $version
* @param int $one_way
* @return string
*/
public function __doRequest($request, $location, $action, $version, $one_way = 0)
{
$this->_logRequest($location, $action, $version, $request);
$response = parent::__doRequest($request, $location, $action, $version, $one_way);
$this->_logResponse($location, $action, $version, $response);
return $response;
}
示例9: __doRequest
/**
* __doRequest
*
* @param string $request
* @param string $location
* @param string $action
* @param int $version
* @param int $oneWay
* @return string
*/
public function __doRequest($request, $location, $action, $version, $oneWay = 0)
{
$aFind = array(":ns1", "ns1:", "\n", "\r");
$sReplace = '';
$newrequest = str_replace($aFind, $sReplace, $request);
return parent::__doRequest($newrequest, $location, $action, $version, $oneWay);
}
示例10: __doRequest
public function __doRequest($request, $location, $action, $version, $one_way = FALSE)
{
if (!$this->timeout) {
// Call via parent because we require no timeout
$response = parent::__doRequest($request, $location, $action, $version, $one_way);
} else {
// Call via Curl and use the timeout
$curl = curl_init($location);
curl_setopt($curl, CURLOPT_VERBOSE, FALSE);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
curl_setopt($curl, CURLOPT_HEADER, FALSE);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
curl_setopt($curl, CURLOPT_TIMEOUT, $this->timeout);
$response = curl_exec($curl);
if (curl_errno($curl)) {
throw new Exception(curl_error($curl));
}
curl_close($curl);
}
// Return?
if (!$one_way) {
return $response;
}
}
示例11: DOMDocument
function __doRequest($request, $location, $saction, $version) {
$doc = new DOMDocument();
$doc->loadXML($request);
$objWSSE = new WSSESoap($doc);
$objWSSE->addUserToken($this->username, $this->password, FALSE);
return parent::__doRequest($objWSSE->saveXML(), $location, $saction, $version);
}
示例12: __doRequest
public function __doRequest($request, $location, $saction, $version)
{
$doc = new DOMDocument('1.0');
$doc->loadXML($request);
$objWSSE = new WSSESoap($doc);
/* add Timestamp with no expiration timestamp */
$objWSSE->addTimestamp();
/* create new XMLSec Key using AES256_CBC and type is private key */
$objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'private'));
/* load the private key from file - last arg is bool if key in file (true) or is string (false) */
$objKey->loadKey(PRIVATE_KEY, true);
/* Sign the message - also signs appropiate WS-Security items */
$options = array("insertBefore" => false);
$objWSSE->signSoapDoc($objKey, $options);
/* Add certificate (BinarySecurityToken) to the message */
$token = $objWSSE->addBinaryToken(file_get_contents(CERT_FILE));
/* Attach pointer to Signature */
$objWSSE->attachTokentoSig($token);
$objKey = new XMLSecurityKey(XMLSecurityKey::AES256_CBC);
$objKey->generateSessionKey();
$siteKey = new XMLSecurityKey(XMLSecurityKey::RSA_OAEP_MGF1P, array('type' => 'public'));
$siteKey->loadKey(SERVICE_CERT, true, true);
$options = array("KeyInfo" => array("X509SubjectKeyIdentifier" => true));
$objWSSE->encryptSoapDoc($siteKey, $objKey, $options);
$retVal = parent::__doRequest($objWSSE->saveXML(), $location, $saction, $version);
$doc = new DOMDocument();
$doc->loadXML($retVal);
$options = array("keys" => array("private" => array("key" => PRIVATE_KEY, "isFile" => true, "isCert" => false)));
$objWSSE->decryptSoapDoc($doc, $options);
return $doc->saveXML();
}
示例13: NewDocRequest
function NewDocRequest($order_id)
{
global $customer_id, $abo_id;
FB::info('NewDocRequest Nummer' . $abo_id);
if (SOAP_SERVER != '') {
$client = new SoapClient(null, array('location' => SOAP_SERVER, 'uri' => SOAP_NAMESPACE, 'trace' => true, 'connection_timeout' => 5));
$response = $client->__doRequest('<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<NewDocRequest xmlns="test">
<Nummer>' . $abo_id . '</Nummer>
<Soort>B</Soort>
<Weborder>' . $order_id . '</Weborder>
</NewDocRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>', SOAP_SERVER, SOAP_NAMESPACE, SOAP_1_2);
if ($response) {
$dom = new DOMDocument();
$dom->loadXML($response);
$xPath = new DOMXPath($dom);
$result = array();
if ($xPath->evaluate("//Status")->item(0)->nodeValue == 0) {
$result = $xPath->evaluate("//StatusTekst")->item(0)->nodeValue;
} else {
$result = $xPath->evaluate("//Document")->item(0)->nodeValue;
}
}
}
return $result;
}
示例14: __doRequest
public function __doRequest($request, $location, $action, $version = SOAP_1_1, $one_way = NULL)
{
$xml = explode("\r\n", parent::__doRequest($request, $location, $action, $version, $one_way = NULL));
dump($xml);
$response = preg_replace('/^(\\x00\\x00\\xFE\\xFF|\\xFF\\xFE\\x00\\x00|\\xFE\\xFF|\\xFF\\xFE|\\xEF\\xBB\\xBF)/', "", $xml[5]);
return $response;
}
示例15: __doRequest
/**
* __doRequest override of SoapClient
*
* @param string $request The XML SOAP request.
* @param string $location The URL to request.
* @param string $action The SOAP action.
* @param int $version The SOAP version.
* @param int|null $oneWay
* @uses parent::__doRequest
* @return string The XML SOAP response.
* @throws Exception When PHP XSL extension is not enabled or WSDL file isn't readable.
*/
public function __doRequest($request, $location, $action, $version, $oneWay = null)
{
if (!extension_loaded('xsl')) {
throw new Exception('PHP XSL extension is not enabled.');
}
$newRequest = $this->transformIncomingRequest($request);
return parent::__doRequest($newRequest, $location, $action, $version, $oneWay);
}