RegisterRegister    Log inLog in    SearchSearch   

Post new topic   Reply to topic
 
View previous topic :: View next topic  
Author Message
NssB



PostPosted: Thu May 28, 2009 9:18 pm    Post subject: SOAP Web Services Reply with quote

Hi Andrew,

I'd appreciate a little help using the WSDL web service if you please.

I'm trying to implement an all-in-one billing/provisioning system.
I've settled for using the PHP Extension for SOAP to get this going, but I'm having trouble making heads or tails of the API (http://doc.gamecreate.com/ManualWebService)

So far I have as an example.........

Code:
<?php
   $client = new SoapClient
      ("http://pkservers.eu.gamecreate.com/admin/User.asmx?wsdl");
   $logon = $client->login("nssb","********");
   echo $logon;
?>


which returns....



Code:
Fatal error: Uncaught SoapFault exception: [soap:Server] Argument 2 is not valid in SqlBuilder in /var/www/soaptest/test.php:6 Stack trace: #0 [internal function]: SoapClient->__call('login', Array) #1 /var/www/soaptest/test.php(6): SoapClient->login('nssb', '*****') #2 {main} thrown in /var/www/soaptest/test.php on line 6



I've masked out my password naturally.....

Its quite possible I'm not doing this right from the start, do you have any pointers?




NssB
Back to top
View user's profile Send private message
adbot



PostPosted: Thu Mar 31, 2011 3:57 am 

Kybber



PostPosted: Fri May 29, 2009 12:11 am    Post subject: Reply with quote

Here's how to fix it in Python.
http://www.gamecreate.com/forum/viewtopic.php?t=1305

Perhaps you can do something similar in PHP? Although I believe what you
should do is use nusoap instead of regular soap.
Back to top
View user's profile Send private message
NssB



PostPosted: Fri May 29, 2009 12:14 am    Post subject: Reply with quote

Hi Kybber,

I had only just finished reading your python fix before I refreshed mine to see had suggested it already. I am not sure of how to implement the same thing in PHP and have tried using both PHP SOAP Extension and currently trying the nuSOAP version, to no avail.

I'm pretty sure its something simple.....just need the right advice from the devs.


Thanks kindly
NssB
Back to top
View user's profile Send private message
NssB



PostPosted: Fri May 29, 2009 1:32 am    Post subject: Reply with quote

Just an update guys:

I managed to find a wdsl example supplied with the nusoap libs which gave me exactly what I needed to use the web services on GC.

Here is a copy of the code I used (password masked) which gave me the correct result.

Code:
<?php
/*
 *   $Id: wsdlclient1.php,v 1.3 2007/11/06 14:48:48 snichol Exp $
 *
 *   WSDL client sample.
 *
 *   Service: WSDL
 *   Payload: document/literal
 *   Transport: http
 *   Authentication: none
 */
require_once('../lib/nusoap.php');
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
$client = new nusoap_client ('http://pkserver.eu.gamecreate.com/admin/User.asmx?WSDL', 'wsdl',
                  $proxyhost, $proxyport, $proxyusername, $proxypassword);
$err = $client->getError();
if ($err) {
   echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}
// Doc/lit parameters get wrapped
$param = array('username' => 'nssb', 'password' => '********');
$result = $client->call('Login', array('parameters' => $param), '', '', false, true);$param), '', '', false, true);
// Check for a fault
if ($client->fault) {
   echo '<h2>Fault</h2><pre>';
   print_r($result);
   echo '</pre>';
} else {
   // Check for errors
   $err = $client->getError();
   if ($err) {
      // Display the error
      echo '<h2>Error</h2><pre>' . $err . '</pre>';
   } else {
      // Display the result
      echo '<h2>Result</h2><pre>';
      print_r($result);
      echo '</pre>';
   }
}
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
?>


So you would be changing...

$result = $client->call('Login', array('parameters' => $param), '', '', false, true);$param), '', '', false, true); is how to expose the chosen method (i.e Login in this case)
$param = array('username' => 'nssb', 'password' => '********'); is the associative array of method properties you need to provide.



If anyone needs anything else explaining, I'll be happy to try. Hope this helps more people.

Thanks to GC and crew for a great product.


NssB


Quick edit: Please note that most of the code in the above snippet is error checking. This if kept in your code will provide very good feedback as to where you are going wrong.
Back to top
View user's profile Send private message
NssB



PostPosted: Tue Aug 31, 2010 3:14 pm    Post subject: Reply with quote

Sorry to revive an old thread, but I have been working on a set of PHP classes which can make the process of building a custom web-based front end to the SOAP Services provided by Gamecreate, relatively simple.

I have not quite finished them as of yet as I have been focusing on a desktop AIR app which does pretty much the same stuff. If there is any interest in the PHP Classes, please let me know and I'll be happy to finish them off and post them up.



Regards
Martin
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum powered by phpBB © 2001, 2005 phpBB Group
GameCreate Service Terms | Privacy Policy | © Copyright Mammoth Media 2001-2007
GameCreate™ is a trademark of Mammoth Media Pty Ltd. GameCreate® is a registered trademark in Australia.