php - SoapClient: Add NS to XML node -
i have complicated xml need send on soapclient.
i trying "correct" way sending array of params request.
here example of current array:
$params = array("testrequest" => array("nodeone" => "value1", "nodetwo" => "value2"));
it makes xml this:
<testrequest> <nodeone>value1</nodeone> <nodetwo>value2</nodetwo> </testrequest>
however, need add ns "testrequest" part. needs this:
<ord:testrequest> <nodeone>value1</nodeone> <nodetwo>value2</nodetwo> </ord:testrequest>
i have pulled hair out trying think of, searched google , stack no avail. , yes, have tried in array typing, "ord:testrequest".
if soapclient guru in php , help, forever thankful.
okay, after headache... easiest way accomplish not way prefer.
i ended manually writing xml so:
$xml = '<ord:testrequest> <nodeone>value1</nodeone> <nodetwo>value2</nodetwo> </ord:testrequest>';
php:
$dom =new domdocument('1.0'); try { $dom->loadxml($xml); $request = $dom->savexml(); $this->xml = $request; return true; } catch (domexception $e) { $this->xml = $xml; $this->errors++; $this->error_msg = 'error generating xml :' . $e; }
my xml structured should make soaprequest, used soapclient __dorequest() method.
important, when go route can't use wsdl auto-generate xml did it, make sure in soap connection , request wsdl null.
Comments
Post a Comment