• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can you please help me out ....

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am facing this error from couple of days.

//This is the Exception i am getting while running client class.

Generated fault:
Fault Code = SOAP-ENV:Server.BadTargetObjectURI
Fault String = Unable to resolve target object:

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%\lib\soap.jar;
%TOMCAT_HOME%\common\lib\xerces.jar;
%TOMCAT_HOME%\common\lib\mail.jar;
%TOMCAT_HOME%\common\lib\activation.jar; and

-> I created service prg as jar file with the name of helloworld.jar and placed in class path.
%TOMCAT_HOME%\common\lib\helloworld.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 please reply me..
waiting for reply...

Thanks in advance,
Anjana

[ July 26, 2006: Message edited by: Anjana Chowdary ]
[ July 26, 2006: Message edited by: Anjana Chowdary ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic