"; print_r($test1); print_r($test2); echo ""; **/ // Instantiate the server $server = new soap_server(); // Create the WSDL $wsdl_addr = 'http://www.hirdweb.com/webservice/20100707_server.php'; $server->configureWSDL('HirdWeb Basic Webservice Example','HirdWeb Basic Webservice Example', $wsdl_addr); $server->wsdl->addComplexType('showPhrases','complexType','struct','all','', array( 'status' => array('name' => 'status', 'type' => 'xsd:string'), 'phrase' => array('name' => 'message', 'type' => 'xsd:string') ) ); // Set up all the items to register the function $in = array( 'id' => 'xsd:string', 'name' => 'xsd:string', ); $out = array('return' => 'tns:showPhrases'); $namespace = 'uri:hirdwebservice'; $soapaction = 'uri:hirdwebservice/showPhrases'; $doc = 'Shows a phrase from Shakespeare and replaces the name with the supplied name. ID is a number from 0 - 4'; $server->register('showPhrases', $in, $out, $namespace, $soapaction, 'rpc', 'encoded', $doc); $server->service($HTTP_RAW_POST_DATA); exit; // **** Function for the webservice function showPhrases($id, $name){ // Set up the phrases $phrases = array( 'O NnnnnnnnnN, NnnnnnnnnN! wherefore art thou NnnnnnnnnN?', 'But NnnnnnnnnN, If you prick us, do we not bleed? if you tickle us, do we not laugh? if you poison us, do we not die? and if you wrong us, shall we not revenge?', 'Will all great NnnnnnnnnN\'s ocean wash this blood clean from my hand? No, this my hand will rather the multitudinous seas incarnadine, making the green one red', 'Love looks not with the eyes, but with the mind, NnnnnnnnnN, and therefore is winged Cupid painted blind', 'Men at some time are masters of their fates: The fault, dear NnnnnnnnnN, is not in our stars, but in ourselves, that we are underlings', ); // place all validation code here if ( ($id < 0) || ($id > 4) ){ // return an error $fin_data['status'] = "Error!"; $fin_data['phrase'] = "The ID was outside of the allowed range."; return $fin_data; } // replace all the needles with the name $phrase = preg_replace("/NnnnnnnnnN/", $name, $phrases[$id]); $fin_data['status'] = "Success!"; $fin_data['phrase'] = $phrase; return $fin_data; } ?>