Sending Raw XML via PHP SoapClient request

后端 未结 2 1762
梦毁少年i
梦毁少年i 2020-12-19 07:47

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

2条回答
  •  一向
    一向 (楼主)
    2020-12-19 08:06

    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:

    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.

提交回复
热议问题