Anonymous - 2012-11-06

Originally posted by: dami...@gmail.com

Hi,

I am using this example to create my very own and simple one like below.

require_once('php-wsdl-2.3/class.phpwsdlclient.php'); $client=new PhpWsdlClient?('http://localhost/WSBannerPHP/demo4dan.php?wsdl'); echo $client->getItem(4);

I am getting a 500 error, any idea?

my web service code is as follows:

<?php

// A quick and dirty SOAP server example

ini_set('soap.wsdl_cache_enabled',0); // Disable caching in PHP $PhpWsdlAutoRun?=true; // With this global variable PhpWsdl will autorun in quick mode, too require_once('php-wsdl-2.3/class.phpwsdl.php');

// In quick mode you can specify the class filename(s) of your webservice // optional parameter, if required. //PhpWsdl::RunQuickMode?();// -> Don't waste my time - just run!

class myWebService{

/****

  • Return a blogpost
    • @param string $sID
  • @return string test data
  • public function getItem($sID){

$iID = (int)$sID; $aValidIds = array(1, 2, 3, 5); // Notice the missing id number 4 // Check if we requested a valid blogpost id if(!in_array($iID, $aValidIds)) {

throw new SoapFault?('Server', 'Blogpost with id '.$iID.' not found!');

} return 'Blogpost with id '.$iID;

}

} ?>