-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCallService.php
More file actions
75 lines (65 loc) · 2.04 KB
/
CallService.php
File metadata and controls
75 lines (65 loc) · 2.04 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
<?php
// CLASS
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 '';
}
}
}
// CORE PHP
$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);
$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')
);
// Here I call my external function
$result = $soap->__soapCall('GetServicesforPincode',array($params));
echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';