-3

I am a new phper, now I want to use cakephp soap client to send a xml request below, but I can't implement it, can some give me some example codes? thx.

< soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ws="http://ws.test.com"
xmlns:xsd="http://mtest/xsd">
< soapenv:Header/>
< soapenv:Body>
< ws:get_status>
< ws:login>
< xsd:code>ABCDEF< /xsd:code>
< xsd:password>1UH7UHUH8HUG< /xsd:password>
< /ws:login>
< /ws:get_status>
< /soapenv:Body>
< /soapenv:Envelope>

Eric Gao
  • 3
  • 3
  • possible duplicate of [Best XML Parser for PHP](http://stackoverflow.com/questions/188414/best-xml-parser-for-php) – Norbert Jun 29 '15 at 22:51

1 Answers1

0

check this

<?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;
} 
}


$soapClient = new MySoapClient("http://xxxx:xxxx/TransactionServices/TransactionServices6.asmx?WSDL", array("trace" => 1)); 
$PostTransaction = $soapClient->__myDoRequest($orderRequest,$op); 
?>
  • Hi Chandu, Thank you for answering my question, for the last line of your example codes, $PostTransaction = $soapClient->__myDoRequest($orderRequest,$op); What the $op should be? 'POST'? like below? $PostTransaction = $soapClient->__myDoRequest($orderRequest,'POST'); – Eric Gao Jun 29 '15 at 23:37
  • Another question, how can I set my two namespace below? xmlns:ws="http://ws.test.com" xmlns:xsd="http://mtest/xsd"> and how can I set my field value of 'code' and 'password', thanks so much. – Eric Gao Jun 29 '15 at 23:40