You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Ka...@lincsoftware.soft.net on 2002/07/05 12:47:17 UTC

execution error while running SOAP client-server

Hi,

i am trying to access a SOAP service from the WAS3.5
server.
i have a server program as follows
-------------------------------------------------------------
public class HelloServer
{
public String sayHelloTo(String name)
{
return ( name + new String("hello"));
}
}
}
-------------------------------------------------------------

i deployed the service tru Apache SOAP-Admins ...
sucessfully. these is the deployed service info :

-------------------------------------------------------------
ID 'urn:Hello'
scope Apllication
Provider Type java
Provider Class hello.HelloServer
Use Static Class no
Methods sayHelloTo
Type Mappings --
Default Mapping Registry Class --
-------------------------------------------------------------

The client
programe-------------------------------------------------------------
package hello;

import java.net.URL;
import java.util.Vector;
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.util.Iterator;public class Client
{
public static void main(String[] args) throws
Exception
{
if(args.length == 0)
{
System.err.println("Usage: java hello.Client
[SOAP-router-URL] ");
System.exit (1);
}

try
{
URL url = null;
String name = null;
if(args.length == 2)
{
url = new URL(args[0]);
name = args[1];
}
else
{
url = new
URL("http://localhost/soap/servlet/rpcrouter");
name = args[0];
}

System.out.println("b4 constructing the soap file");
// Build the call.
Call call = new Call();
call.setTargetObjectURI("urn:Hello");

call.setMethodName("sayHelloTo");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Vector params = new Vector();
params.addElement(new Parameter("name", String.class,
name, null));
call.setParams(params);
System.out.println("constructed soap xml request
hello");

// 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.
System.out.println("b4 response");
if( !resp.generatedFault() )
{
System.out.println("if block");
Parameter ret = resp.getReturnValue();
Object value = ret.getValue();
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());


Vector entries = fault.getDetailEntries( );
for (Iterator i = entries.iterator(); i.hasNext( ); )
{
org.w3c.dom.Element entry =
(org.w3c.dom.Element)i.next( );
System.out.println(entry.getFirstChild().getNodeValue(
));
}



}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
-------------------------------------------------------------

when i run the client i get the following error


Generated fault:
Fault Code = SOAP-ENV:Server.BadTargetObjectURI
Fault String = Unable to resolve target object:
hello.HelloServer
java.lang.NullPointerException
java.lang.Throwable()
java.lang.Exception()
java.lang.RuntimeException()
java.lang.NullPointerException()
void hello.Client.main(java.lang.String [])
void hello.Client.main(java.lang.String [])

can anyone help me with this problem....
thanx,
kavitha



__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com



Re: execution error while running SOAP client-server

Posted by Scott Nichol <sn...@scottnichol.com>.
The class file for your service (hello.HelloService) must be available to a
WAS class loader.  I am not familiar enough with WAS to know how to set this
up.

Scott Nichol

----- Original Message -----
From: <Ka...@lincsoftware.soft.net>
To: <so...@xml.apache.org>
Sent: Friday, July 05, 2002 6:47 AM
Subject: execution error while running SOAP client-server


> Hi,
>
> i am trying to access a SOAP service from the WAS3.5
> server.
> i have a server program as follows
> -------------------------------------------------------------
> public class HelloServer
> {
> public String sayHelloTo(String name)
> {
> return ( name + new String("hello"));
> }
> }
> }
> -------------------------------------------------------------
>
> i deployed the service tru Apache SOAP-Admins ...
> sucessfully. these is the deployed service info :
>
> -------------------------------------------------------------
> ID 'urn:Hello'
> scope Apllication
> Provider Type java
> Provider Class hello.HelloServer
> Use Static Class no
> Methods sayHelloTo
> Type Mappings --
> Default Mapping Registry Class --
> -------------------------------------------------------------
>
> The client
> programe-------------------------------------------------------------
> package hello;
>
> import java.net.URL;
> import java.util.Vector;
> 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.util.Iterator;public class Client
> {
> public static void main(String[] args) throws
> Exception
> {
> if(args.length == 0)
> {
> System.err.println("Usage: java hello.Client
> [SOAP-router-URL] ");
> System.exit (1);
> }
>
> try
> {
> URL url = null;
> String name = null;
> if(args.length == 2)
> {
> url = new URL(args[0]);
> name = args[1];
> }
> else
> {
> url = new
> URL("http://localhost/soap/servlet/rpcrouter");
> name = args[0];
> }
>
> System.out.println("b4 constructing the soap file");
> // Build the call.
> Call call = new Call();
> call.setTargetObjectURI("urn:Hello");
>
> call.setMethodName("sayHelloTo");
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
> Vector params = new Vector();
> params.addElement(new Parameter("name", String.class,
> name, null));
> call.setParams(params);
> System.out.println("constructed soap xml request
> hello");
>
> // 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.
> System.out.println("b4 response");
> if( !resp.generatedFault() )
> {
> System.out.println("if block");
> Parameter ret = resp.getReturnValue();
> Object value = ret.getValue();
> 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());
>
>
> Vector entries = fault.getDetailEntries( );
> for (Iterator i = entries.iterator(); i.hasNext( ); )
> {
> org.w3c.dom.Element entry =
> (org.w3c.dom.Element)i.next( );
> System.out.println(entry.getFirstChild().getNodeValue(
> ));
> }
>
>
>
> }
> }
> catch(Exception e)
> {
> e.printStackTrace();
> }
> }
> }
> -------------------------------------------------------------
>
> when i run the client i get the following error
>
>
> Generated fault:
> Fault Code = SOAP-ENV:Server.BadTargetObjectURI
> Fault String = Unable to resolve target object:
> hello.HelloServer
> java.lang.NullPointerException
> java.lang.Throwable()
> java.lang.Exception()
> java.lang.RuntimeException()
> java.lang.NullPointerException()
> void hello.Client.main(java.lang.String [])
> void hello.Client.main(java.lang.String [])
>
> can anyone help me with this problem....
> thanx,
> kavitha
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Sign up for SBC Yahoo! Dial - First Month Free
> http://sbc.yahoo.com
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: execution error while running SOAP client-server

Posted by Scott Nichol <sn...@scottnichol.com>.
The class file for your service (hello.HelloService) must be available to a
WAS class loader.  I am not familiar enough with WAS to know how to set this
up.

Scott Nichol

----- Original Message -----
From: <Ka...@lincsoftware.soft.net>
To: <so...@xml.apache.org>
Sent: Friday, July 05, 2002 6:47 AM
Subject: execution error while running SOAP client-server


> Hi,
>
> i am trying to access a SOAP service from the WAS3.5
> server.
> i have a server program as follows
> -------------------------------------------------------------
> public class HelloServer
> {
> public String sayHelloTo(String name)
> {
> return ( name + new String("hello"));
> }
> }
> }
> -------------------------------------------------------------
>
> i deployed the service tru Apache SOAP-Admins ...
> sucessfully. these is the deployed service info :
>
> -------------------------------------------------------------
> ID 'urn:Hello'
> scope Apllication
> Provider Type java
> Provider Class hello.HelloServer
> Use Static Class no
> Methods sayHelloTo
> Type Mappings --
> Default Mapping Registry Class --
> -------------------------------------------------------------
>
> The client
> programe-------------------------------------------------------------
> package hello;
>
> import java.net.URL;
> import java.util.Vector;
> 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.util.Iterator;public class Client
> {
> public static void main(String[] args) throws
> Exception
> {
> if(args.length == 0)
> {
> System.err.println("Usage: java hello.Client
> [SOAP-router-URL] ");
> System.exit (1);
> }
>
> try
> {
> URL url = null;
> String name = null;
> if(args.length == 2)
> {
> url = new URL(args[0]);
> name = args[1];
> }
> else
> {
> url = new
> URL("http://localhost/soap/servlet/rpcrouter");
> name = args[0];
> }
>
> System.out.println("b4 constructing the soap file");
> // Build the call.
> Call call = new Call();
> call.setTargetObjectURI("urn:Hello");
>
> call.setMethodName("sayHelloTo");
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
> Vector params = new Vector();
> params.addElement(new Parameter("name", String.class,
> name, null));
> call.setParams(params);
> System.out.println("constructed soap xml request
> hello");
>
> // 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.
> System.out.println("b4 response");
> if( !resp.generatedFault() )
> {
> System.out.println("if block");
> Parameter ret = resp.getReturnValue();
> Object value = ret.getValue();
> 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());
>
>
> Vector entries = fault.getDetailEntries( );
> for (Iterator i = entries.iterator(); i.hasNext( ); )
> {
> org.w3c.dom.Element entry =
> (org.w3c.dom.Element)i.next( );
> System.out.println(entry.getFirstChild().getNodeValue(
> ));
> }
>
>
>
> }
> }
> catch(Exception e)
> {
> e.printStackTrace();
> }
> }
> }
> -------------------------------------------------------------
>
> when i run the client i get the following error
>
>
> Generated fault:
> Fault Code = SOAP-ENV:Server.BadTargetObjectURI
> Fault String = Unable to resolve target object:
> hello.HelloServer
> java.lang.NullPointerException
> java.lang.Throwable()
> java.lang.Exception()
> java.lang.RuntimeException()
> java.lang.NullPointerException()
> void hello.Client.main(java.lang.String [])
> void hello.Client.main(java.lang.String [])
>
> can anyone help me with this problem....
> thanx,
> kavitha
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Sign up for SBC Yahoo! Dial - First Month Free
> http://sbc.yahoo.com
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
>