<?php
function curl($url, $fields_string)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/soap+xml"));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
$data = curl_exec($ch);
$info = curl_getinfo($ch);
//print_r($info);
if(curl_error($ch))
echo "curl error: ".curl_error($ch)."\n\n";
curl_close($ch);
//echo $data;
return $data;
}
$data = "<root><Key>4950716559</Key><RemoteOrderNumber>1087</RemoteOrderNumber><OrderPONumber></OrderPONumber><OrderDate>2017-02-22</OrderDate><RequestedReceiveDate></RequestedReceiveDate><RemoteCustomerID>5492177551</RemoteCustomerID><ShipSalutation></ShipSalutation><ShipFirstName>Ashvini</ShipFirstName><ShipInitial></ShipInitial><ShipLastName>Chauhan</ShipLastName><ShipCompany></ShipCompany><ShipAddress1>test</ShipAddress1><ShipAddress2></ShipAddress2><ShipCity>test</ShipCity><ShipProvinceCode>QC</ShipProvinceCode><ShipPostalCode></ShipPostalCode><ShipCountryCode>CA</ShipCountryCode><BillSalutation></BillSalutation><BillFirstName>Ashvini</BillFirstName><BillInitial></BillInitial><BillLastName>Chauhan</BillLastName><BillCompany></BillCompany><BillAddress1>test</BillAddress1><BillAddress2></BillAddress2><BillCity>test</BillCity><BillProvinceCode>QC</BillProvinceCode><BillPostalCode></BillPostalCode><BillCountryCode>CA</BillCountryCode><ShipEMailAddress></ShipEMailAddress><BillEMailAddress></BillEMailAddress><ShipPhone1></ShipPhone1><ShipPhone1Ext></ShipPhone1Ext><ShipPhone2></ShipPhone2><ShipPhone2Ext></ShipPhone2Ext><ShipFax></ShipFax><BillPhone1></BillPhone1><BillPhone1Ext></BillPhone1Ext><BillPhone2></BillPhone2><BillPhone2Ext></BillPhone2Ext><BillFax></BillFax><InvoiceSubtotal>29.95</InvoiceSubtotal><InvoiceTax1>1.50</InvoiceTax1><InvoiceTax2>2.99</InvoiceTax2><InvoiceTax3></InvoiceTax3><InvoiceShippingAmount></InvoiceShippingAmount><InvoicePrepaidAmount></InvoicePrepaidAmount><InvoiceGrandTotal>43.67</InvoiceGrandTotal><ShipMethodCode></ShipMethodCode><InvoiceCurrencyCode></InvoiceCurrencyCode><InvoicePaymentMethodCode></InvoicePaymentMethodCode><ShipComments1></ShipComments1><ShipComments2></ShipComments2><ShipComments3></ShipComments3><InternalComments></InternalComments><ProjectCode></ProjectCode><TransactionTypeID></TransactionTypeID><CustomerCode></CustomerCode><WareHouse></WareHouse><CustomerMessage></CustomerMessage><OrderedItem><ItemSKU>New040</ItemSKU><ItemDummySKU></ItemDummySKU><QuantityOrdered>1</QuantityOrdered><QuantityShipped></QuantityShipped><QuantityBackOrdered></QuantityBackOrdered><InvoiceRetailPrice></InvoiceRetailPrice><InvoiceDiscountPrice>0.00</InvoiceDiscountPrice><InvoiceExtendedAmount></InvoiceExtendedAmount><InvoiceRetailUnitPrice></InvoiceRetailUnitPrice></OrderedItem><OrderedItem><ItemSKU></ItemSKU><ItemDummySKU></ItemDummySKU><QuantityOrdered></QuantityOrdered><QuantityShipped></QuantityShipped><QuantityBackOrdered></QuantityBackOrdered><InvoiceRetailPrice></InvoiceRetailPrice><InvoiceDiscountPrice></InvoiceDiscountPrice><InvoiceExtendedAmount></InvoiceExtendedAmount><InvoiceRetailUnitPrice></InvoiceRetailUnitPrice></OrderedItem></root>";
$url = "https://rpsolutions-2.realprofitsolutions.com/ifwebsrvtest/orderprocessing.asmx";
$html1 = curl($url, $data);
echo "Data as follows : ";
echo $html1;
?>
我收到的错误如下: -
皂:VersionMismatchSystem.Web.Services.Protocols.SoapException: 可能的SOAP版本不匹配:信封命名空间是意外的。 期待check this little guide on callbacks I wrote。在 System.Web.Services.Protocols.SoapServerProtocol.CheckHelperVersion() 在System.Web.Services.Protocols.SoapServerProtocol.Initialize()at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext上下文,HttpRequest请求,HttpResponse响应) System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext上下文,HttpRequest请求,HttpResponse响应, 布尔和放大器; abortProcessing)