tomdelonge Posted June 17, 2010 Share Posted June 17, 2010 I'm trying to learn how to consume a web service using soapclient() I found this WSDL: http://www.webservicex.net/stockquote.asmx?WSDL And I tried this code: $params = array('AAPL'); $client = new SoapClient('http://www.webservicex.net/stockquote.asmx?wsdl'); $result = $client->__soapCall('GetQuote', $params); print_r($result); But I get this: stdClass Object ( [GetQuoteResult] => exception ) I haven't made a single successful call to their api. Also, do you guys know if there's a way to use syntax like this: $client->getQuote(); Shouldn't php know from the WSDL what functions are possible? Thanks for your help. Link to comment https://forums.phpfreaks.com/topic/205013-consuming-my-first-web-service/ Share on other sites More sharing options...
jonsjava Posted June 17, 2010 Share Posted June 17, 2010 Without going into code, I will tell you my experience with writing SOAP calls. When I first started writing them, I had issues, because their SOAP calls didn't always conform to the standards. I found a tool (soapui) to help me build the basic calls, and then reverse-engineered the calls for PHP. What I would recommend you do is find a good SOAP client, get the hang of it, get used to calls, and then build from there. You can do calls from SOAPui without much work at all. it will even build the call templates for you. Link to comment https://forums.phpfreaks.com/topic/205013-consuming-my-first-web-service/#findComment-1073414 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.