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. Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.