开发者

PHP - XML conversion

I'm new to stackoverflow and after some searching didn't find an answer to my question so I'm hoping someone can help me out.

I have to use this web service method that takes three parameters, a string and two xml params.

Below's an example of the code I'm using. The web service method throws an exception, 'Required parameters for method SubmitXml are null.'

So I'm guessing it's not receiving any xml on the 2nd and 3rd params. Can anyone give me a hint on how to correctly use the DOM or any other with PHP here? thank you in advance.

    $soapClient = new SoapClient($this-SOAPURL, array('login'=>$this->account,'password'=>$this->password));

    $xmlstr ='<xmlbody>';
    $xmlstr.='<someXML>Some XML text content here!</someXML>';
    $xmlstr.='</xmlbody>';

    $dom = new DOMDocument();
    $dom->loadXML($xmlstr);
    $filter = new DOMDocument();

    $filter->loadXML('<_ xmlns=""/>');
    print_r ($soapClient->SubmitXml('userIDString',$dom->saveXML(), $fil->saveXM开发者_Python百科L()));


After some struggling I finally got it. It didn't end up being a syntax error or anything. The code I presented in my question was OK except that I wasn't wrapping my XML string in a required node... something like:

$xmlstring = "<somenode>" . $xmlstring . "</somenode>";

and then send it to the function.

Thank you all for helping in trying to solve this 'mistery' ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜