-
Notifications
You must be signed in to change notification settings - Fork 3
/
AirWayService.php
123 lines (115 loc) · 3.29 KB
/
AirWayService.php
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
// CLASS
class DebugSoapClient extends SoapClient {
public $sendRequest = true;
public $printRequest = true;
public $formatXML = true;
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/WayBill/WayBillGeneration.svc?wsdl',
array(
'trace' => 1,
'style' => SOAP_DOCUMENT,
'use' => SOAP_LITERAL,
'soap_version' => SOAP_1_2
));
$soap->__setLocation("http://netconnect.bluedart.com/Demo/ShippingAPI/WayBill/WayBillGeneration.svc");
$soap->sendRequest = true;
$soap->printRequest = false;
$soap->formatXML = true;
$actionHeader = new SoapHeader('http://www.w3.org/2005/08/addressing','Action','http://tempuri.org/IWayBillGeneration/GenerateWayBill',true);
$soap->__setSoapHeaders($actionHeader);
$params = array(
'Request' =>
array (
'Consignee' =>
array (
'ConsigneeAddress1' => 'A',
'ConsigneeAddress2' => 'A',
'ConsigneeAddress3'=> 'A',
'ConsigneeAttention'=> 'A',
'ConsigneeMobile'=> '1234567890',
'ConsigneeName'=> 'A',
'ConsigneePincode'=> '400028',
'ConsigneeTelephone'=> '1234567890',
) ,
'Services' =>
array (
'ActualWeight' => '1',
'CollectableAmount' => '0',
'Commodity' =>
array (
'CommodityDetail1' => 'PRETTYSECRETS Dark Blue Allure',
'CommodityDetail2' => ' Aultra Boost Mutltiway Push Up ',
'CommodityDetail3' => 'Bra'
),
'CreditReferenceNo' => '105',
'DeclaredValue' => '1000',
'Dimensions' =>
array (
'Dimension' =>
array (
'Breadth' => '1',
'Count' => '1',
'Height' => '1',
'Length' => '1'
),
),
'InvoiceNo' => '',
'PackType' => '',
'PickupDate' => '2014-12-02',
'PickupTime' => '1800',
'PieceCount' => '1',
'ProductCode' => 'A',
'ProductType' => 'Dutiables',
'SpecialInstruction' => '1',
'SubProductCode' => ''
),
'Shipper' =>
array(
'CustomerAddress1' => '1',
'CustomerAddress2' => '1',
'CustomerAddress3' => '1',
'CustomerCode' => '030516',
'CustomerEmailID' => '[email protected]',
'CustomerMobile' => '1234567890',
'CustomerName' => '1',
'CustomerPincode' => '641001',
'CustomerTelephone' => '1234567890',
'IsToPayCustomer' => '',
'OriginArea' => 'CJB',
'Sender' => '1',
'VendorCode' => ''
)
),
'Profile' =>
array(
'Api_type' => 'S',
'LicenceKey'=>'',
'LoginID'=>'',
'Version'=>'1.3')
);
// Here I call my external function
$result = $soap->__soapCall('GenerateWayBill',array($params));
echo '<pre>'; print_r($result); echo '</pre>';