PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Problem with crossplatform webservices

Post new topic   Reply to topic    PEAR Forum Forum Index -> Web Services
View previous topic :: View next topic  
Author Message

Joined: 21 Aug 2007
Posts: 3

PostPosted: Sat Sep 01, 2007 9:35 am    Post subject: Problem with crossplatform webservices Reply with quote

Hey guys can anybody help me with this problem.
i have been trying for the past 10 days and i havent solved the problem yet
i will tell the problem in detail

My Server Code in PHP is as Follows:

require_once 'SOAP/Server.php';

// Your class
class HelloServer {
var $__dispatch_map = array();

function HelloServer() {
// Define the signature of the dispatch map
$this->__dispatch_map['sayHello'] =
array('in' => array('inputString' => 'string'),
'out' => array('outputString' => 'string'),


// Required function by SOAP_Server
function __dispatch($methodname) {
if (isset($this->__dispatch_map[$methodname]))
return $this->__dispatch_map[$methodname];
return NULL;

// Your function
function sayHello($inputString)
return 'Hello '.$inputString;

// Fire up PEAR::SOAP_Server
$server = new SOAP_Server;

// Fire up your class
$helloServer = new HelloServer();

// Add your object to SOAP server (note namespace)

// Handle SOAP requests coming is as POST data
if (isset($_SERVER['REQUEST_METHOD']) &&
} else {
// Deal with WSDL / Disco here
require_once 'SOAP/Disco.php';

// Create the Disco server
$disco = new SOAP_DISCO_Server($server,'HelloServer');
header("Content-type: text/xml");
if (isset($_SERVER['QUERY_STRING']) &&
strcasecmp($_SERVER['QUERY_STRING'],'wsdl')==0) {
echo $disco->getWSDL(); // if we're talking
} else {
echo $disco->getDISCO();

Now this program runs fine and produces a WSDL file this webservice i am calling in java.

The WSDL file is as follows:

<?xml version="1.0" ?>
- <definitions name="HelloServer" targetNamespace="urn:HelloServer" xmlns:wsdl="" xmlns:soap="" xmlns:tns="urn:HelloServer" xmlns:xsd="" xmlns:SOAP-ENC="" xmlns="">
<types xmlns="" />
- <message name="sayHelloRequest">
<part name="inputString" type="xsd:string" />
- <message name="sayHelloResponse">
<part name="outputString" type="xsd:string" />
- <portType name="HelloServerPort">
- <operation name="sayHello">
<input message="tns:sayHelloRequest" />
<output message="tns:sayHelloResponse" />
- <binding name="HelloServerBinding" type="tns:HelloServerPort">
<soap:binding style="rpc" transport="" />
- <operation name="sayHello">
<soap:operation soapAction="urn:HelloServer#HelloServer#sayHello" />
- <input>
<soap:body use="encoded" namespace="urn:HelloServer" encodingStyle="" />
- <output>
<soap:body use="encoded" namespace="urn:HelloServer" encodingStyle="" />
- <service name="HelloServerService">
<documentation />
- <port name="HelloServerPort" binding="tns:HelloServerBinding">
<soap:address location="http://localhost/PhpPrograms/server.php" />

with Client code in JAVA is as follows:

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;

public class Client2

public static void main(String[] args)
String endpoint = "http://localhost/PhpPrograms/server.php?wsdl";
Service service = new Service();
Call call = (Call) service.createCall();

call.setOperationName(new QName("", "sayHello"));
String ret = (String) call.invoke(new Object[]{"Ravindranath"});

catch (Exception e)

this code generates an error when calling the webservice, i know it is due to incompatible data types that i am calling from client code. how to make working the client code. please reply me as soon as possible.

The Error Generated is as follows: Connection reset

I am using eclipse 3.3(europa) i have configured the system and installed phpeclipse it works fine. building php webservice and client works fine but cross platform calling of web service i am not able to know.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Web Services All times are GMT + 2 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

PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement