nusoap help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Omego2K
Forum Newbie
Posts: 4
Joined: Mon Jun 09, 2008 5:32 pm

nusoap help

Post by Omego2K »

Please put your code in appropriate

Code: Select all

 tags.  Your post has been changed to reflect how we'd like to see code posted.[/color]

Problem solved, I'm an idiot.

Turned out it had nothing to do with my code, but everything to do with my configuration or at least it seems that way.. If you're having this problem check the apache error log file for "Could not reliably determine the server's fully qualified domain name". Apparrently this stops clients from connecting to my web service unless they used my WAN IP which is what apache used when that notice came up. If that was indeed the culprit of the problem then I must have fixed it when I changed the configuration for "ServerName" to my localhost. I'm not sure why this was the problem or why my solution fixed it, hence I'm not 100% on this being the exact cause, especially when I connected to the web service with VS.NET through my domain name.

Hi I was able to successfully create a web service using nusoap, however I cannot get the client to work. Everytime I try to load the client's URL it just sits there and eventually displays nothing. The apache error log stated it timed out after 30 seconds, and now it doesn't even mention that anymore. The service however works with .NET specifically a C# windows forms project, however not with PHP, which ironically is the language it was created in. Does anybody know what the problem may be?

Here is the code:

server:

[syntax=php] 
<?php
function addNums($n1, $n2){
return $n1 + $n2;
}
 
function multiply($n1, $n2){
return $n1 * $n2;
}
 
require('lib/nusoap.php');
 
$server = new soap_server();
 
$server->configureWSDL('mathServer', 'urn:math');
 
$server->register("addNums", array('n1' => 'xsd:integer', 'n2' => 'xsd:integer'),
        array('sum' => 'xsd:integer'), 'urn:math', 'urn:math#addNums');
 
$server->register("multiply", array('n1' => 'xsd:float', 'n2' => 'xsd:integer'),
        array('product' => 'xsd:float'), 'urn:math', 'urn:math#multiply');
 
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
 
$server->service($HTTP_RAW_POST_DATA);
 
 
?>[/syntax]


client:

[syntax=php] 
<?php
require_once('lib/nusoap.php');
$client = new nusoap_client('http://localhost/nug.php?wsdl', true);
echo $client->call('addNums' ,array(2, 3));
?>[/syntax]
Post Reply