<tfoot id='HEMfy'></tfoot>
      <bdo id='HEMfy'></bdo><ul id='HEMfy'></ul>

    <i id='HEMfy'><tr id='HEMfy'><dt id='HEMfy'><q id='HEMfy'><span id='HEMfy'><b id='HEMfy'><form id='HEMfy'><ins id='HEMfy'></ins><ul id='HEMfy'></ul><sub id='HEMfy'></sub></form><legend id='HEMfy'></legend><bdo id='HEMfy'><pre id='HEMfy'><center id='HEMfy'></center></pre></bdo></b><th id='HEMfy'></th></span></q></dt></tr></i><div id='HEMfy'><tfoot id='HEMfy'></tfoot><dl id='HEMfy'><fieldset id='HEMfy'></fieldset></dl></div>

      1. <legend id='HEMfy'><style id='HEMfy'><dir id='HEMfy'><q id='HEMfy'></q></dir></style></legend>
      2. <small id='HEMfy'></small><noframes id='HEMfy'>

      3. 通过 PHP SoapClient 请求发送原始 XML

        时间:2023-05-22

      4. <small id='QNTRQ'></small><noframes id='QNTRQ'>

          <bdo id='QNTRQ'></bdo><ul id='QNTRQ'></ul>
          <tfoot id='QNTRQ'></tfoot>
            <tbody id='QNTRQ'></tbody>
        • <i id='QNTRQ'><tr id='QNTRQ'><dt id='QNTRQ'><q id='QNTRQ'><span id='QNTRQ'><b id='QNTRQ'><form id='QNTRQ'><ins id='QNTRQ'></ins><ul id='QNTRQ'></ul><sub id='QNTRQ'></sub></form><legend id='QNTRQ'></legend><bdo id='QNTRQ'><pre id='QNTRQ'><center id='QNTRQ'></center></pre></bdo></b><th id='QNTRQ'></th></span></q></dt></tr></i><div id='QNTRQ'><tfoot id='QNTRQ'></tfoot><dl id='QNTRQ'><fieldset id='QNTRQ'></fieldset></dl></div>
          <legend id='QNTRQ'><style id='QNTRQ'><dir id='QNTRQ'><q id='QNTRQ'></q></dir></style></legend>

                • 本文介绍了通过 PHP SoapClient 请求发送原始 XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在尝试通过 PHP 和 SoapClient 简单地将 RAW xml 发送到网络服务.问题是当我对 XML 进行编码时,它会更改 XML 中元素的顺序,该顺序将转换为关联数组.

                  //初始化 Soap 客户端:$this->_transactionServicesClient = new SoapClient($soapWSDLUrl);

                  如何或什么是将以下 XML 作为字符串发送到我的 SoapClient 的最佳方式?

                  <小时><块引用>

                  更新/解决:这是我用来扩展 SOAP 客户端并发送我的原始 Soap Envelope 的代码:我在下面的回答

                  解决方案

                  更新/解决方案:这是我用来扩展 SOAP 客户端并发送我的原始 Soap Envelope 的代码

                  这是我扩展 SoapClient 的方式:

                  server = new SoapServer($wsdl, $options);}公共函数 __doRequest($request, $location, $action, $version){$result = parent::__doRequest($request, $location, $action, $version);返回 $result;}函数 __myDoRequest($array,$op) {$request = $array;$location = 'http://xxxxx:xxxx/TransactionServices/TransactionServices6.asmx';$action = 'http://www.micros.com/pos/les/TransactionServices/'.$op;$version = '1';$result =$this->__doRequest($request, $location, $action, $version);返回 $result;}}//使用已经准备好的 Soap Envelope 调用我的新自定义方法.$soapClient = new MySoapClient("http://xxxx:xxxx/TransactionServices/TransactionServices6.asmx?WSDL", array("trace" => 1));$PostTransaction = $soapClient->__myDoRequest($orderRequest,$op);?>

                  在我把它变成答案之前,也在 Pastie.org 上发布:http://pastie.org/3687935.

                  I am trying to simply send RAW xml to a webservice via PHP and SoapClient. The problem is when I encode my XML it changes the order of elements in the XML that is converted to an associative array.

                  // Initialize the Soap Client:
                  $this->_transactionServicesClient = new SoapClient($soapWSDLUrl);
                  

                  How or what would be the best way to send the following XML as a string to my SoapClient?

                  <?xml version="1.0" encoding="UTF-8"?>
                  <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.micros.com/pos/les/TransactionServices">
                      <SOAP-ENV:Body>
                          <ns1:PostTransaction>
                              <ns1:REQ>
                                  <ns1:RequestHeader>
                                      <ns1:InterfaceVersion>3.0.7</ns1:InterfaceVersion>
                                      <ns1:ClientName>TRANS_SERVICES</ns1:ClientName>
                                  </ns1:RequestHeader>    
                                  <ns1:CheckDetailEntries>
                                      <ns1:MenuItem>
                                          <ns1:ReferenceEntry>Pizza4</ns1:ReferenceEntry>
                                          <ns1:Count>1</ns1:Count>
                                          <ns1:Price>10.00</ns1:Price>
                                          <ns1:ItemNumber>112001</ns1:ItemNumber>
                                          <ns1:PriceLevel>1</ns1:PriceLevel>
                                          <ns1:Seat xsi:nil="true"/>
                                      </ns1:MenuItem>
                                  </ns1:CheckDetailEntries>
                                  <ns1:CheckHeaderRequest>
                                      <ns1:CheckId>03:21:05.050505</ns1:CheckId>
                                      <ns1:GuestCount>1</ns1:GuestCount>
                                      <ns1:GuestInformation>
                                      <ns1:ID>001</ns1:ID>
                                      <ns1:FirstName>xxx</ns1:FirstName>
                                      <ns1:LastName>xxx</ns1:LastName>
                                      <ns1:Address1>xxx Rd</ns1:Address1>
                                      <ns1:Address2>xx</ns1:Address2>
                                      <ns1:Address3>xx</ns1:Address3>
                                      <ns1:PhoneNum>xx</ns1:PhoneNum>
                                      <ns1:UserText1>None</ns1:UserText1>
                                      <ns1:UserText2>None</ns1:UserText2>
                                      <ns1:UserText3>None</ns1:UserText3>
                                      <ns1:GUID></ns1:GUID></ns1:GuestInformation>
                                  </ns1:CheckHeaderRequest>
                                  <ns1:OrderTypeNumber>1</ns1:OrderTypeNumber>
                              </ns1:REQ>
                          </ns1:PostTransaction>
                      </SOAP-ENV:Body>        
                  </SOAP-ENV:Envelope>
                  


                  Update/Resolution: Here is the code I used to extend the SOAP Client and send my raw Soap Envelope: My answer below

                  解决方案

                  Update/Resolution: Here is the code I used to extend the SOAP Client and send my raw Soap Envelope

                  Here is how I extended SoapClient:

                  <?php
                  class MySoapClient extends SoapClient {
                  
                      function __construct($wsdl, $options) {
                          parent::__construct($wsdl, $options);
                          $this->server = new SoapServer($wsdl, $options);
                      }
                      public function __doRequest($request, $location, $action, $version) 
                      { 
                          $result = parent::__doRequest($request, $location, $action, $version); 
                          return $result; 
                      } 
                      function __myDoRequest($array,$op) { 
                          $request = $array;
                          $location = 'http://xxxxx:xxxx/TransactionServices/TransactionServices6.asmx';
                          $action = 'http://www.micros.com/pos/les/TransactionServices/'.$op;
                          $version = '1';
                          $result =$this->__doRequest($request, $location, $action, $version);
                          return $result;
                      } 
                  }
                  
                  // To invoke my new custom method with my Soap Envelope already prepared.
                  $soapClient = new MySoapClient("http://xxxx:xxxx/TransactionServices/TransactionServices6.asmx?WSDL", array("trace" => 1)); 
                  $PostTransaction = $soapClient->__myDoRequest($orderRequest,$op); 
                  ?>
                  

                  Also posted on pastie.org: http://pastie.org/3687935 before I turned this into the answer.

                  这篇关于通过 PHP SoapClient 请求发送原始 XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                    <tfoot id='2BNJj'></tfoot>
                    <i id='2BNJj'><tr id='2BNJj'><dt id='2BNJj'><q id='2BNJj'><span id='2BNJj'><b id='2BNJj'><form id='2BNJj'><ins id='2BNJj'></ins><ul id='2BNJj'></ul><sub id='2BNJj'></sub></form><legend id='2BNJj'></legend><bdo id='2BNJj'><pre id='2BNJj'><center id='2BNJj'></center></pre></bdo></b><th id='2BNJj'></th></span></q></dt></tr></i><div id='2BNJj'><tfoot id='2BNJj'></tfoot><dl id='2BNJj'><fieldset id='2BNJj'></fieldset></dl></div>

                    <small id='2BNJj'></small><noframes id='2BNJj'>

                      <bdo id='2BNJj'></bdo><ul id='2BNJj'></ul>

                        <tbody id='2BNJj'></tbody>
                      <legend id='2BNJj'><style id='2BNJj'><dir id='2BNJj'><q id='2BNJj'></q></dir></style></legend>