dcsimg
Getting SOAP-ENV:Server.BadTargetObjectURI Exception
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anjana_Regula
Posted On:   Wednesday, July 26, 2006 04:57 AM

Hi, I am facing this error from couple of days.Simply I am listing out the things i have done to run this WS. // Service prg package hello; public class HelloWorld{ String getMessage(){ return "Hello world"; } } //client prg import org.apache.soap.SOAPException; import org.apache.soap.Constants; import org.apache.soap.Fault; import org.apache.soap.rpc.Call; import org.apache.soap.rpc.Parameter; import org.apache.soap.rpc.Response; import java.net.URL; public class Client { public stati   More>>

Hi,


I am facing this error from couple of days.Simply I

am listing out the things i have done to run this WS.

// Service prg

package hello;

public class HelloWorld{


String getMessage(){

return "Hello world";

}

}

//client prg


import org.apache.soap.SOAPException;

import org.apache.soap.Constants;

import org.apache.soap.Fault;

import org.apache.soap.rpc.Call;

import org.apache.soap.rpc.Parameter;

import org.apache.soap.rpc.Response;

import java.net.URL;


public class Client

{
public static void main(String[] args) throws

Exception {

try{

URL url = null;

String name = null;

// Build the call.


url = new URL
("http://localhost:8085/soap/servlet/rpcrouter");

Call call = new Call();

call.setTargetObjectURI("urn:HelloWorldService");

call.setMethodName("getMessage");

call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);


// Invoke the call.

Response resp = null;

try{

resp = call.invoke(url, "");

}

catch( SOAPException e ){

System.err.println("Caught SOAPException

(" + e.getFaultCode() + "): " + e.getMessage());

System.exit(-1);

}


// Check the response.

if( !resp.generatedFault() )

{
Object value = resp.getReturnValue();

System.out.println(value);


}

else

{

Fault fault = resp.getFault();

System.err.println("Generated fault: ");

System.out.println (" Fault Code = " +

fault.getFaultCode());

System.out.println (" Fault String = "

+
fault.getFaultString() );

}

}

catch(Exception e)

{

e.printStackTrace();

}

}

}


-> I set up class path with all these info..

%SOAP_HOME%libsoap.jar;

%TOMCAT_HOME%commonlibxerces.jar;

%TOMCAT_HOME%commonlibmail.jar;

%TOMCAT_HOME%commonlibactivation.jar; and


-> I created service prg as jar file with the name

of

%TOMCAT_HOME%commonlibhelloworld.jar;

-> I am using the Apache SOAP Admin to deploy

the service.

If run the following commands, working fine..


1) http://localhost:8085/soap/servlet/rpcrouter.

2) java orgapache.soap.server.ServiceManagerClient
http://localhost:8085/soap/servlet/rpcrouter list.


-> I am using the same machine as a client and server.


if any one know about the solution, could u reply me..


Thanks in advance,

Anjana

   <<Less
About | Sitemap | Contact