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 sherine khoury <sh...@hotmail.com> on 2002/04/22 10:11:11 UTC

Help a beginner!!


Hi, this is my second mail to this mailing list, I hope this one will go 
through.
I'm trying a simple helloworld service using soap2.2,tomcat4.0.3 on windows 
xp.
I installed soap using the installation guide at 
http://mywebpages.comcast.net/scottnichol/apachesoap/install.html.
All tests went fine (testit outputed correctly..)
Now here is the code I'm using:
HelloServer.java
----------------
package hello;
public class HelloServer
{
	public String sayHelloTo(String name)
	{
		System.out.println("sayHelloTo(String name)");
		return "Hello "+ name +", How are you doing?";
	}
}

Client.java
------------
package samples.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.Response;
import org.apache.soap.rpc.Parameter;

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:8080/soap/servlet/rpcrouter");
				name=args[0];
			}

			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);

			Response resp=null;
			try
			{
				resp=call.invoke(url,"");
			}
			catch(SOAPException e)
			{
				System.err.println("Caught SOAPException ("+e.getFaultCode()+"): 
"+e.getMessage());
				System.exit(-1);
			}

			if(!resp.generatedFault())
			{
				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());
			}
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
}

DeploymentDescriptor.xml
-----------------------
<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
id="urn:Hello">
<isd:provider type="java" scope="Application" methods="sayHelloTo">
<isd:java class="samples.hello.HelloServer" static="false"/>
</isd:provider>
</isd:service>

Problem
-------
The deployment went correctly and urn:Hello appears among the deployed 
services. I updated my CLASSPATH variable to include both xerces and soap 
jar files and the path to the package where the java files described above 
are.
I'm still getting the fault:

Unable to resolve the following target object HelloServer


What is wrong??
Thanks for your help


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


Re: Help a beginner!!

Posted by Scott Nichol <sn...@scottnichol.com>.
Sherry,

You have put HelloServer in package hello, but your deployment descriptor refers
to samples.hello.HelloServer.  The two must refer to the same class.

Scott Nichol

----- Original Message -----
From: "sherine khoury" <sh...@hotmail.com>
To: <so...@xml.apache.org>
Sent: Monday, April 22, 2002 4:11 AM
Subject: Help a beginner!!


>
>
> Hi, this is my second mail to this mailing list, I hope this one will go
> through.
> I'm trying a simple helloworld service using soap2.2,tomcat4.0.3 on windows
> xp.
> I installed soap using the installation guide at
> http://mywebpages.comcast.net/scottnichol/apachesoap/install.html.
> All tests went fine (testit outputed correctly..)
> Now here is the code I'm using:
> HelloServer.java
> ----------------
> package hello;
> public class HelloServer
> {
> public String sayHelloTo(String name)
> {
> System.out.println("sayHelloTo(String name)");
> return "Hello "+ name +", How are you doing?";
> }
> }
>
> Client.java
> ------------
> package samples.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.Response;
> import org.apache.soap.rpc.Parameter;
>
> 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:8080/soap/servlet/rpcrouter");
> name=args[0];
> }
>
> 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);
>
> Response resp=null;
> try
> {
> resp=call.invoke(url,"");
> }
> catch(SOAPException e)
> {
> System.err.println("Caught SOAPException ("+e.getFaultCode()+"):
> "+e.getMessage());
> System.exit(-1);
> }
>
> if(!resp.generatedFault())
> {
> 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());
> }
> }
> catch(Exception e)
> {
> e.printStackTrace();
> }
> }
> }
>
> DeploymentDescriptor.xml
> -----------------------
> <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
> id="urn:Hello">
> <isd:provider type="java" scope="Application" methods="sayHelloTo">
> <isd:java class="samples.hello.HelloServer" static="false"/>
> </isd:provider>
> </isd:service>
>
> Problem
> -------
> The deployment went correctly and urn:Hello appears among the deployed
> services. I updated my CLASSPATH variable to include both xerces and soap
> jar files and the path to the package where the java files described above
> are.
> I'm still getting the fault:
>
> Unable to resolve the following target object HelloServer
>
>
> What is wrong??
> Thanks for your help
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>


Re: Help a beginner!!

Posted by pop m <po...@regens.hu>.
I had the same problem, but I am using Orion1.5.4.

I did this:

in my orion\application-deployments\MYAPP-web\orion-web.xml I have put this
row

<classpath path="c:\soap/lib/soap.jar;./;path to my classes" />

Hope will bve usefull for you !


Üdv. Pop Marius L.
----- Original Message -----
From: "sherine khoury" <sh...@hotmail.com>
To: <so...@xml.apache.org>
Sent: Monday, April 22, 2002 9:11 AM
Subject: Help a beginner!!


>
>
> Hi, this is my second mail to this mailing list, I hope this one will go
> through.
> I'm trying a simple helloworld service using soap2.2,tomcat4.0.3 on
windows
> xp.
> I installed soap using the installation guide at
> http://mywebpages.comcast.net/scottnichol/apachesoap/install.html.
> All tests went fine (testit outputed correctly..)
> Now here is the code I'm using:
> HelloServer.java
> ----------------
> package hello;
> public class HelloServer
> {
> public String sayHelloTo(String name)
> {
> System.out.println("sayHelloTo(String name)");
> return "Hello "+ name +", How are you doing?";
> }
> }
>
> Client.java
> ------------
> package samples.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.Response;
> import org.apache.soap.rpc.Parameter;
>
> 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:8080/soap/servlet/rpcrouter");
> name=args[0];
> }
>
> 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);
>
> Response resp=null;
> try
> {
> resp=call.invoke(url,"");
> }
> catch(SOAPException e)
> {
> System.err.println("Caught SOAPException ("+e.getFaultCode()+"):
> "+e.getMessage());
> System.exit(-1);
> }
>
> if(!resp.generatedFault())
> {
> 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());
> }
> }
> catch(Exception e)
> {
> e.printStackTrace();
> }
> }
> }
>
> DeploymentDescriptor.xml
> -----------------------
> <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
> id="urn:Hello">
> <isd:provider type="java" scope="Application" methods="sayHelloTo">
> <isd:java class="samples.hello.HelloServer" static="false"/>
> </isd:provider>
> </isd:service>
>
> Problem
> -------
> The deployment went correctly and urn:Hello appears among the deployed
> services. I updated my CLASSPATH variable to include both xerces and soap
> jar files and the path to the package where the java files described above
> are.
> I'm still getting the fault:
>
> Unable to resolve the following target object HelloServer
>
>
> What is wrong??
> Thanks for your help
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com


Re: Help a beginner!!

Posted by Scott Nichol <sn...@scottnichol.com>.
Sherry,

You have put HelloServer in package hello, but your deployment descriptor refers
to samples.hello.HelloServer.  The two must refer to the same class.

Scott Nichol

----- Original Message -----
From: "sherine khoury" <sh...@hotmail.com>
To: <so...@xml.apache.org>
Sent: Monday, April 22, 2002 4:11 AM
Subject: Help a beginner!!


>
>
> Hi, this is my second mail to this mailing list, I hope this one will go
> through.
> I'm trying a simple helloworld service using soap2.2,tomcat4.0.3 on windows
> xp.
> I installed soap using the installation guide at
> http://mywebpages.comcast.net/scottnichol/apachesoap/install.html.
> All tests went fine (testit outputed correctly..)
> Now here is the code I'm using:
> HelloServer.java
> ----------------
> package hello;
> public class HelloServer
> {
> public String sayHelloTo(String name)
> {
> System.out.println("sayHelloTo(String name)");
> return "Hello "+ name +", How are you doing?";
> }
> }
>
> Client.java
> ------------
> package samples.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.Response;
> import org.apache.soap.rpc.Parameter;
>
> 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:8080/soap/servlet/rpcrouter");
> name=args[0];
> }
>
> 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);
>
> Response resp=null;
> try
> {
> resp=call.invoke(url,"");
> }
> catch(SOAPException e)
> {
> System.err.println("Caught SOAPException ("+e.getFaultCode()+"):
> "+e.getMessage());
> System.exit(-1);
> }
>
> if(!resp.generatedFault())
> {
> 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());
> }
> }
> catch(Exception e)
> {
> e.printStackTrace();
> }
> }
> }
>
> DeploymentDescriptor.xml
> -----------------------
> <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
> id="urn:Hello">
> <isd:provider type="java" scope="Application" methods="sayHelloTo">
> <isd:java class="samples.hello.HelloServer" static="false"/>
> </isd:provider>
> </isd:service>
>
> Problem
> -------
> The deployment went correctly and urn:Hello appears among the deployed
> services. I updated my CLASSPATH variable to include both xerces and soap
> jar files and the path to the package where the java files described above
> are.
> I'm still getting the fault:
>
> Unable to resolve the following target object HelloServer
>
>
> What is wrong??
> Thanks for your help
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>


Re: Help a beginner!!

Posted by pop m <po...@regens.hu>.
I had the same problem, but I am using Orion1.5.4.

I did this:

in my orion\application-deployments\MYAPP-web\orion-web.xml I have put this
row

<classpath path="c:\soap/lib/soap.jar;./;path to my classes" />

Hope will bve usefull for you !


Üdv. Pop Marius L.
----- Original Message -----
From: "sherine khoury" <sh...@hotmail.com>
To: <so...@xml.apache.org>
Sent: Monday, April 22, 2002 9:11 AM
Subject: Help a beginner!!


>
>
> Hi, this is my second mail to this mailing list, I hope this one will go
> through.
> I'm trying a simple helloworld service using soap2.2,tomcat4.0.3 on
windows
> xp.
> I installed soap using the installation guide at
> http://mywebpages.comcast.net/scottnichol/apachesoap/install.html.
> All tests went fine (testit outputed correctly..)
> Now here is the code I'm using:
> HelloServer.java
> ----------------
> package hello;
> public class HelloServer
> {
> public String sayHelloTo(String name)
> {
> System.out.println("sayHelloTo(String name)");
> return "Hello "+ name +", How are you doing?";
> }
> }
>
> Client.java
> ------------
> package samples.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.Response;
> import org.apache.soap.rpc.Parameter;
>
> 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:8080/soap/servlet/rpcrouter");
> name=args[0];
> }
>
> 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);
>
> Response resp=null;
> try
> {
> resp=call.invoke(url,"");
> }
> catch(SOAPException e)
> {
> System.err.println("Caught SOAPException ("+e.getFaultCode()+"):
> "+e.getMessage());
> System.exit(-1);
> }
>
> if(!resp.generatedFault())
> {
> 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());
> }
> }
> catch(Exception e)
> {
> e.printStackTrace();
> }
> }
> }
>
> DeploymentDescriptor.xml
> -----------------------
> <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
> id="urn:Hello">
> <isd:provider type="java" scope="Application" methods="sayHelloTo">
> <isd:java class="samples.hello.HelloServer" static="false"/>
> </isd:provider>
> </isd:service>
>
> Problem
> -------
> The deployment went correctly and urn:Hello appears among the deployed
> services. I updated my CLASSPATH variable to include both xerces and soap
> jar files and the path to the package where the java files described above
> are.
> I'm still getting the fault:
>
> Unable to resolve the following target object HelloServer
>
>
> What is wrong??
> Thanks for your help
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com