strago Posted January 21, 2011 Share Posted January 21, 2011 This is my first time messing with SOAP. $params = array( 'user' => 'username@gmail.com', 'password' => 'password', 'keyStr' => $keyStr, 'subId' => $subId); $return_string = $client->call('getKey','getTodaySubIDStats','getYesterdaySubIDStats','getMonthToDateSubIDStats','getLastMonthSubIDStats', $params); The $return_string = $client->call('getKey','getTodaySubIDStats','getYesterdaySubIDStats','getMonthToDateSubIDStats','getLastMonthSubIDStats', $params); spits out Fatal error: Uncaught SoapFault exception: [Client] Function ("call") is not a valid method for this service in /home/site82/public_html/stats.php:20 Stack trace: #0 /home/site82/public_html/stats.php(20): SoapClient->__call('call', Array) #1 /home/site82/public_html/stats.php(20): SoapClient->call('getKey', 'getTodaySubIDSt...', 'getYesterdaySub...', 'getMonthToDateS...', 'getLastMonthSub...', Array) #2 {main} thrown in /home/site82/public_html/stats.php on line 20 So I E-Mailed support and got this There are two different ways to make SOAP API calls, depending on which PHP library you use. The example in the document has a client which wants calls like this: $client->call('funcname', parm1, parm2) The other type of call, which I think your client is using, is like this: $client->funcname(parm1, parm2) Switch over your coding and that should eliminate the problem you are getting. so I tried... $return_string = $client->getTodaySubIDStats(user,password,keyStr,subId); and it then spits out Fatal error: Uncaught SoapFault exception: [HTTP] Internal Server Error in /home/site82/public_html/stats.php:17 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://www.maxb...', '', 1, 0) #1 /home/site82/public_html/stats.php(17): SoapClient->__call('getTodaySubIDSt...', Array) #2 /home/site82/public_html/stats.php(17): SoapClient->getTodaySubIDStats('user', 'password', 'keyStr', 'subId') #3 {main} thrown in /home/site82/public_html/stats.php on line 17 How do I call it the correct way?? Quote Link to comment Share on other sites More sharing options...
beegro Posted January 21, 2011 Share Posted January 21, 2011 What does the WSDL look like? Can you post it? Quote Link to comment Share on other sites More sharing options...
strago Posted January 21, 2011 Author Share Posted January 21, 2011 http://www.maxbounty.com/api/api.cfc?wsdl Quote Link to comment Share on other sites More sharing options...
beegro Posted January 21, 2011 Share Posted January 21, 2011 From what I see there is a 'getKey' operation which uses a 'getKeyRequest' input message. The 'getKeyRequest' message has the format of: <user> <password> So, your request would look something like. $params = array('user' => 'my_username', 'password' => 'my_password'); $client = new SoapClient('http://www.maxbounty.com/api/api.cfc?wsdl'); $result = $client->__soapCall('getKey',$params); $result will then be of type 'getKeyResponse' which will look like an array $result['getKeyReturn'] The function print_r() is definitely your friend when working with SOAP and so are try catch blocks. Quote Link to comment Share on other sites More sharing options...
beegro Posted January 21, 2011 Share Posted January 21, 2011 I just tried to get my script to run against that soap service and had an issue with connection. If there are connection credentials you may need to change the constructor arguments to include authentication information. See: http://us3.php.net/manual/en/soapclient.soapclient.php 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.