将XML订购到soap客户端

时间:2015-08-28 08:39:48

标签: php xml soap

我必须创建一个脚本,将订单(XML)发送到SOAP客户端服务器(这样供应商可以处理订单)

我尝试了一切,但它不起作用。

有人知道我做错了吗?

这是我到目前为止所做的:

<?php
$xmlstr = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.datacontract.org/2004/07/Centric.CS.Trade.Standard.WS.SalesOrderService.Contract.Request" xmlns:ns2="http://centric.eu/services/CS/Trade/Standard/WS/">
  <SOAP-ENV:Body>
    <ns2:LoadSalesOrder>
      <ns2:request>
        <ns1:SalesOrderRequests>
          <ns1:SalesOrderRequest>
            <ns1:DeliveryAddress/>
            <ns1:DeliveryAddress1>teststraat</ns1:DeliveryAddress1>
            <ns1:DeliveryCountry>NL</ns1:DeliveryCountry>
            <ns1:DeliveryEmail>test@test.nl</ns1:DeliveryEmail>
            <ns1:DeliveryFetchCarrier>true</ns1:DeliveryFetchCarrier>
            <ns1:DeliveryFetchDeliveryMode>true</ns1:DeliveryFetchDeliveryMode>
            <ns1:DeliveryHouseNo>1</ns1:DeliveryHouseNo>
            <ns1:DeliveryMunicipality>ALKMAAR</ns1:DeliveryMunicipality>
            <ns1:DeliveryName>Test naam</ns1:DeliveryName>
            <ns1:DeliveryPermanent>false</ns1:DeliveryPermanent>
            <ns1:DeliveryPhone>06-12345678</ns1:DeliveryPhone>
            <ns1:DeliveryPostalCode>1200 RT</ns1:DeliveryPostalCode>
            <ns1:Division>AGU_NL</ns1:Division>
            <ns1:Key>02</ns1:Key>
            <ns1:Language>NL</ns1:Language>
            <ns1:Login>7440475</ns1:Login>
            <ns1:OrderCustomer>7440475</ns1:OrderCustomer>
            <ns1:OrderLines>
              <ns1:SalesOrderRequest.OrderLine>
                <ns1:Item>113504</ns1:Item>
                <ns1:Line>10</ns1:Line>
                <ns1:OrderQuantityBU>1.0000</ns1:OrderQuantityBU>
              </ns1:SalesOrderRequest.OrderLine>
            </ns1:OrderLines>
            <ns1:OrderType>100</ns1:OrderType>
            <ns1:ReferenceExternal>100000001</ns1:ReferenceExternal>
          </ns1:SalesOrderRequest>
        </ns1:SalesOrderRequests>
      </ns2:request>
    </ns2:LoadSalesOrder>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML;

$wsdl = 'https://ws.abcb2b.eu/Centric/CS/Trade/cstest/SalesOrderService.svc?wsdl';
$client = new SoapClient($wsdl, array(
    'cache_wsdl'    => WSDL_CACHE_NONE,
    'cache_ttl'     => 86400,
    'trace'         => true,
    'exceptions'    => true,
));

$xmlVar = new SoapVar($xmlstr, XSD_ANYXML);
$client->LoadSalesOrder($xmlstr);
?>

  

致命错误:未捕获的SoapFault异常:[s:Client]此错误的创建者未指定Reason。在C:\ wamp \ soap_request.php:102堆栈跟踪:#0 C:\ wamp \ www \ soap_request.php(102):SoapClient-&gt; __ call('LoadSalesOrder',Array)#1C:\ wamp \ www \ soap_request.php(102):SoapClient-&gt; LoadSalesOrder('

0 个答案:

没有答案