Re: [SOAP] accessing the results returned from webservice
[email protected] (Nathan Rixham)
| Newsgroups | php.soap,php.soap |
|---|---|
| Message-ID | <[email protected]> |
Mansour Al Akeel wrote: > On Thu, Jan 08, 2009 at 03:01:11PM +0000, Richard Quadling wrote: >> 2009/1/8 Christian Wenz <[email protected]>: >>>> Do you have >>>>> a public URL of the .NET web service? >>>> https://beanstream.com/soap/ProcessTransaction.wsdl >>>> >>> This test script >>> >>> <?php >>> $soap = new >>> SoapClient('https://beanstream.com/soap/ProcessTransaction.wsdl'); >>> $result = $soap->TransactionProcess('<a />'); >>> echo nl2br(htmlspecialchars(print_r($result, 1))); >>> ?> >>> >>> returns: >>> >>> <response><trnId></trnId><trnApproved>0</trnApproved><messageId>0</messageId >>>> <messageText>Invalid merchant id (merchant_id = >>> 0)</messageText><trnAuthCode></trnAuthCode></response> >>> >>> According to the WSDL, the return data type is a simple string. So the web >>> service is returning XML, no matter which technology you use. So it's >>> neither PHP's not .NET's fault :-) However since you are using PHP, you may >>> want to use SimpleXML to parse the XML. >>> >>> --Christian >> https isn't a registered stream for me it seems. >> >> What output do you get for ... >> >> var_dump($result); > > this prints out the whole response as one string without the tags > brakets. So what ever the text of the all the tags is, it get appended > and printed out. > >> A soap client SHOULD return a stdClass object, so >> >> echo $result->messageText; > This doesn't print anything. It's just empty. > Same thing with: > > var_dump($result->messageText) ; > > it shows NULL > > Another thing (not related) is, I am passing the parameters as a nested array to the > web method, however, I keep on getting invalid xml format. The test > script in this email is passing a string and getting invalid merchant > id. Hum, I will have to look further into this. I was waiting to be able > to read the values from the response first. > >> should work. > > No, this is not working at all. > if I may be so bold; I (along with thousands of others) use wso2; it may be worth considering (additionally you could knock a client up in 2 minutes using the provided wsdl2php scripts)