-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCallService.php
More file actions
executable file
·107 lines (91 loc) · 2.97 KB
/
CallService.php
File metadata and controls
executable file
·107 lines (91 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
/*
#echo Start of Soap1.1 (Basic_Http_Version)
$soap = new DebugSoapClient('http://netconnect.bluedart.com/Demo/ShippingAPI/Finder/ServiceFinderQuery.svc?wsdl',
array(
'trace' => 1,
'style' => SOAP_DOCUMENT,
'use' => SOAP_LITERAL,
'soap_version' => SOAP_1_1
));
$soap->__setLocation("http://netconnect.bluedart.com/Demo/ShippingAPI/Finder/ServiceFinderQuery.svc/basic");
$soap->sendRequest = true;
$soap->printRequest = false;
$soap->formatXML = true;
#echo End of Soap1.1 (Basic_Http_Version)
*/
#echo Start of Soap1.2 (WS_Http_Version)
$soap = new DebugSoapClient('http://netconnect.bluedart.com/Demo/ShippingAPI/Finder/ServiceFinderQuery.svc?wsdl',
array(
'trace' => 1,
'style' => SOAP_DOCUMENT,
'use' => SOAP_LITERAL,
'soap_version' => SOAP_1_2
));
$soap->__setLocation("http://netconnect.bluedart.com/Demo/ShippingAPI/Finder/ServiceFinderQuery.svc");
$soap->sendRequest = true;
$soap->printRequest = false;
$soap->formatXML = true;
$actionHeader = new SoapHeader('http://www.w3.org/2005/08/addressing','Action','http://tempuri.org/IServiceFinderQuery/GetServicesforPincode',true);
$soap->__setSoapHeaders($actionHeader);
#echo End of Soap1.2 (ws_Http_Version)
$paramsLive = array('pinCode' => '400078',
'profile' =>
array(
'Api_type' => 'S',
'LicenceKey'=>'',
'LoginID'=>'',
'Version'=>'1.3')
);
$params = array('pinCode' => '400078',
'profile' =>
array(
'Api_type' => 'S',
'Area'=>'',
'Customercode'=>'',
'IsAdmin'=>'',
'LicenceKey'=>'',
'LoginID'=>'',
'Password'=>'',
'Version'=>'1.3')
);
#var_dump($params);
#echo '<h2>Parameters</h2><pre>'; print_r($params); echo '</pre>';
// Here I call my external function
$result = $soap->__soapCall('GetServicesforPincode',array($params));
#echo "<br>";
#var_dump($result);
/*
echo $result->GetServicesforPincodeResult->ErrorMessage ;
echo "<br>";
echo $result->GetServicesforPincodeResult->PincodeDescription;
echo "<br>";
*/
echo "<br>";
echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
class DebugSoapClient extends SoapClient {
public $sendRequest = true;
public $printRequest = false;
public $formatXML = false;
public function __doRequest($request, $location, $action, $version, $one_way=0) {
if ( $this->printRequest ) {
if ( !$this->formatXML ) {
$out = $request;
}
else {
$doc = new DOMDocument;
$doc->preserveWhiteSpace = false;
$doc->loadxml($request);
$doc->formatOutput = true;
$out = $doc->savexml();
}
echo $out;
}
if ( $this->sendRequest ) {
return parent::__doRequest($request, $location, $action, $version, $one_way);
}
else {
return '';
}
}
}