cmangano
New Member
- Messages
- 2
- Reaction score
- 0
- Points
- 0
I have a nusoap web service that seems to be OK. You can view it at http://chrismangano.x10hosting.com/soap/wsSuperBowls.php
The wsdl seems to be created fine and my method seems to be OK. Yet when I call my server code from the client I get an internal server error:
It doesn't matter what you put in the form you will still get the error.
Here is my soap server code:
Any thoughts? Appreciate any help I can get.
Edit:
Figured it out, i was not calling the client class right. The line in the client script should read
The wsdl seems to be created fine and my method seems to be OK. Yet when I call my server code from the client I get an internal server error:
You can view the actual page that submits the data at http://chrismangano.x10hosting.com/soapform.phpInternal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, support@x10hosting.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
It doesn't matter what you put in the form you will still get the error.
Here is my soap server code:
and here is my client code:<?php
/**************************************************************
* Simple SOAP server to return past Super Bowl results.
**************************************************************/
// includes nusoap classes
require('../nusoap/lib/nusoap.php');
// create server
$l_oServer = new soap_server();
// wsdl generation
$l_oServer->debug_flag=false;
$l_oServer->configureWSDL('SuperBowlResults', 'http://chrismangano.x10hosting.com/SuperBowlResults');
$l_oServer->wsdl->schemaTargetNamespace = 'http://chrismangano.x10hosting.com/SuperBowlResults';
// add complex type
$l_oServer->wsdl->addComplexType(
'SuperBowlResults',
'complexType',
'struct',
'all',
'',
array(
'numeral' => array('name'=>'numeral', 'type'=>'xsd:string'),
'date' => array('name'=>'date', 'type'=>'xsd:string'),
'location' => array('name'=>'location', 'type'=>'xsd:string'),
'result' => array('name'=>'result', 'type'=>'xsd:string'))
);
// register method
$l_oServer->register('getResults', array(
'year' => 'xsd:int'),
array('return'=>'tns:SuperBowlResults'),
'http://chrismangano.x10hosting.com/SuperBowlResults');
// method code to get super bowl results based on year
function getResults ($a_stInput) {
if (is_integer($a_stInput)) {
// includes database class
require("../includes/config.inc.php");
require('../classes/Database.class.php');
// connect to the database
$db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
$db->connect();
$rows = $db->query("SELECT * FROM superbowl_results WHERE year =".$a_stInput);
echo $rows;
// check to make sure we have a result
if(!$rows){
return new soap_fault('Server', '', 'The table only has results since 2000.');
}
$db->close;
return $rows;
} else {
return new soap_fault('Client', '', 'Service requires a valid year.');
}
}
// pass incoming (posted) data
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$l_oServer->service($HTTP_RAW_POST_DATA);
?>
<?php
if (isset($_POST['submit_button'])) {
// includes nusoap classes
require('nusoap/lib/nusoap.php');
// set parameters and create client
$l_aParam = array($_POST['year']);
$l_oClient = new soapclient('http://chrismangano.x10hosting.com/soap/wsSuperBowls.php');
// errors on the last line -^
}
?>
Any thoughts? Appreciate any help I can get.
Edit:
Figured it out, i was not calling the client class right. The line in the client script should read
$l_oClient = new nusoap_client('http://chrismangano.x10hosting.com/soap/wsSuperBowls.php');
Last edited: