Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ALL);
- ini_set('display_errors', 1);
- /* Class Start */
- class LocalSoapClient extends SoapClient{
- public $client;
- public $server;
- public function __construct($wsdl, $options) {
- // var_dump(func_get_args());
- $this->client = new SoapClient($wsdl, $options);
- // var_dump($this->client);
- // $this->server = new SoapServer($wsdl, $options);
- }
- public function __doRequest($request, $location, $action, $version){
- // var_dump(func_get_args());
- // var_dump($this->client);
- // exit();
- $namespace = "http://schemas.xmlsoap.org/soap/envelope/";
- // $namespace = "urn:DCNZ.MSP.Wireline.Wholesale.Messages";
- $request = preg_replace('/<ns1:(\w+)/', '<$1 xmlns="'.$namespace.'"', $request, 1);
- $request = preg_replace('/<ns1:(\w+)/', '<$1', $request);
- $request = str_replace(array('/ns1:', 'xmlns:ns1="'.$namespace.'"'), array('/', ''), $request);
- // var_dump($request);
- $result = parent::__doRequest($request, $location, $action, $version);
- // ob_start();
- // $this->server->handle($request);
- // $response = ob_get_contents();
- // ob_end_clean();
- // $this->__soapAction = $action;
- // return $response;
- return $result;
- }
- function soapDebug($client){
- $requestHeaders = $client->__getLastRequestHeaders();
- $request = $client->__getLastRequest();
- $responseHeaders = $client->__getLastResponseHeaders();
- $response = $client->__getLastResponse();
- var_dump(htmlspecialchars($request,ENT_QUOTES));
- var_dump(htmlspecialchars($response,ENT_QUOTES));
- }
- }
- /* Class End */
- ini_set('soap.wsdl_cache_enabled',0);
- ini_set('soap.wsdl_cache_ttl',0);
- try {
- $wsdl = "https://www.wirelineonboarding.co.nz/WebServices/OOTInternal/Schemas/Informationservice.WSDL";
- $wsdl_uri = "https://www.wirelineonboarding.co.nz/WebServices/OOTInternal/Schemas/Orderuploadservice.WSDL";
- $cert = getcwd()."/abcd.pem";
- $passphrase = "Wireline";
- $uri = "https://www.wirelineonboarding.co.nz/WebServices/OOTInternal/InformationService.asmx";
- $_uri = "urn:DCNZ.MSP.Wireline.Wholesale.Common";
- $x = new LocalSoapClient($wsdl, [
- // 'local_cert' => $cert,
- 'passphrase' => $passphrase,
- // 'allow_self_signed' => true,
- 'cache_wsdl' => WSDL_CACHE_NONE,
- 'location' => 'https://wsdl.local/try.php',
- 'uri' => $wsdl_uri,
- 'exceptions' => true,
- 'trace' => true,
- 'soap_version' => SOAP_1_1,
- 'keep_alive' => true,
- 'connection_timeout'=>2000,
- // 'encoding'=> 'UTF-8' // 'ISO-8859-1'
- ]);
- $req = '<?xml version="1.0" encoding="utf-8"?>
- <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
- <soap:Body>
- <addressVerificationRequest xmlns="urn:DCNZ.MSP.Wireline.Wholesale.Common">
- <addressVerification>
- <samId xmlns="urn:DCNZ.MSP.Wireline.Wholesale.Common">string</samId>
- <number xmlns="urn:DCNZ.MSP.Wireline.Wholesale.Common">string</number>
- <subDescription xmlns="urn:DCNZ.MSP.Wireline.Wholesale.Common">string</subDescription>
- <street xmlns="urn:DCNZ.MSP.Wireline.Wholesale.Common">string</street>
- <streetType xmlns="urn:DCNZ.MSP.Wireline.Wholesale.Common">string</streetType>
- <direction xmlns="urn:DCNZ.MSP.Wireline.Wholesale.Common">string</direction>
- <suburb xmlns="urn:DCNZ.MSP.Wireline.Wholesale.Common">string</suburb>
- <city xmlns="urn:DCNZ.MSP.Wireline.Wholesale.Common">string</city>
- <buildingFloor xmlns="urn:DCNZ.MSP.Wireline.Wholesale.Common">string</buildingFloor>
- <buildingSuite xmlns="urn:DCNZ.MSP.Wireline.Wholesale.Common">string</buildingSuite>
- <buildingName xmlns="urn:DCNZ.MSP.Wireline.Wholesale.Common">string</buildingName>
- <postalCode xmlns="urn:DCNZ.MSP.Wireline.Wholesale.Common">string</postalCode>
- </addressVerification>
- </addressVerificationRequest>
- </soap:Body>
- </soap:Envelope>';
- // var_dump($x);
- // var_dump($x->__getFunctions());
- $x->__soapCall('AddressVerification', [ 'addressVerificationRequest' => $req ] );
- $x->soapDebug($x);
- } catch (Exception $e) {
- echo "Exception Occured:".$e->getMessage();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement