Hi this is yogesh sharma and i am a dotnet developer and i need to call a web service in my project... But my web service provider has given me web service calling demo which is written in PHP... And i don't know PHP at all. So please can anyone help me for the same by providing me with the conversion of the php code into asp.net c# code.? Any help will be appreciated...
header('Content-type: application/pdf');
#echo "Start of Soap 1.2 version (ws_http_Binding) setting";
$soap = new DebugSoapClient('http://netconnect.bluedart.com/Ver1.2/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/Ver1.2/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);
#echo "end of Soap 1.2 version (WSHttpBinding) setting";
$params = array(
'Request' =>
array (
'Consignee' =>
array (
'ConsigneeAddress1' => 'A',
'ConsigneeAddress2' => 'A',
'ConsigneeAddress3'=> 'A',
'ConsigneeAttention'=> 'A',
'ConsigneeMobile'=> '1234567890',
'ConsigneeName'=> 'A',
'ConsigneePincode'=> '462023',
'ConsigneeTelephone'=> '1234567890',
) ,
'Services' =>
array (
'ActualWeight' => '1',
'CollectableAmount' => '500',
'Commodity' =>
array (
'CommodityDetail1' => '1',
'CommodityDetail2' => '1',
'CommodityDetail3' => '1'
),
'CreditReferenceNo' => '6',
'DeclaredValue' => '1000',
'Dimensions' =>
array (
'Dimension' =>
array (
'Breadth' => '1',
'Height' => '1',
'Length' => '1'
),
),
'InvoiceNo' => '',
'PackType' => '',
'PickupDate' => '2014-07-28',
'PickupTime' => '1800',
'PieceCount' => '1',
'ProductCode' => 'A',
'ProductType' => 'Dutiables',
'SpecialInstruction' => '1',
'SubProductCode' => 'C'
),
'Shipper' =>
array(
'OriginArea' => 'AHD',
'CustomerCode' => '200233',
'CustomerAddress1' => 'A-404',
'CustomerAddress2' => 'smita tower, vishram nagar',
'CustomerAddress3' => 'gurukul',
'CustomerEmailID' => 'info@steamlite.com',
'CustomerMobile' => '09227404554',
'CustomerName' => 'SteamLite Sales Pvt Ltd',
'CustomerPincode' => '380052',
'CustomerTelephone' => '07940304554',
'IsToPayCustomer' => 'false',
'VendorCode' => ' '
)
),
'Profile' =>
array(
'Awbfilelocation' => '/steamlite.org/html/steam_customer/',
'Api_type' => 'S',
'LicenceKey'=>'<license key>',
'LoginID'=>'<INTERNETDART ID>',
'Version'=>'1.3')
);
$result = $soap->__soapCall('GenerateWayBill',array($params));
#echo "Generated Waybill number " + $result->GenerateWayBillResult->AWBNo;
#echo $result->GenerateWayBillResult->Status->WayBillGenerationStatus->StatusInformation
';
//echo "
";
//echo '
Result
'; print_r($result); echo '
';
echo $result->GenerateWayBillResult->AWBPrintContent;
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 '';
}
}
}
What I have tried:
i searched for some tool (migration assistant ) that convert php code to asp.net code. but there .net version problem..