Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem while using web service with SOAP

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
Hello,

I downloaded the latest Version of Apache SOAP in order to learn the first steps in using web services.
At I found an address where you can do a RPC by giving it the name of country as parameter and it returns the number of inhabitants in this country.

All the necessary .jar files and libaries are included in jbuilder 5. When I complie and run the programme I get the following error message. Can anybody tell me what I'm doing wrong?

G:\Programme\jbuilder5\jdk1.3\bin\javaw -classpath "C:\Dokumente und Einstellungen\Administrator\jbproject\SoapBs;F:\XML\Apache SOAP\xmisoap.jar;F:\XML\Apache SOAP\soap.jar;G:\Programme\jbuilder5\lib\jaxp.jar;G:\Programme\jbuilder5\lib\parser.jar;G:\Programme\jbuilder5\jdk1.3\lib\dt.jar;G:\Programme\jbuilder5\jdk1.3\lib\tools.jar;G:\Programme\jbuilder5\jdk1.3\jre\lib\i18n.jar;G:\Programme\jbuilder5\jdk1.3\jre\lib\jaws.jar;G:\Programme\jbuilder5\jdk1.3\jre\lib\rt.jar;G:\Programme\jbuilder5\jdk1.3\jre\lib\sunrsasign.jar;G:\Programme\jbuilder5\jdk1.3\demo\jfc\Java2D\Java2Demo.jar" soapbs.CountryInfoLookupClient "United States"
java.lang.NoClassDefFoundError: javax/mail/MessagingException

Here is the according code to this error message

Any hint is highly appreciated. Thanks in advance.
FlawPeter

Code:
package soapbs;

import java.io.*;
import java.util.*;
import java.net.*;
import org.w3c.dom.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.encoding.*;
import org.apache.soap.encoding.soapenc.*;
import org.apache.soap.rpc.*;

public class CountryInfoLookupClient
{
public static void main(String [] args) throws Exception
{
if (args.length != 2
&& (args.length != 3 || !args[0].startsWith("-")))
{
System.err.println("Usage:");
System.err.println(" java " +
CountryInfoLookupClient.class.getName() + " [-encodingStyleURI] SOAP-router-URL nameToLookup");
System.exit (1);
}

// Process the arguments.
int offset = 3 - args.length;
String encodingStyleURI = args.length == 3
? args[0].substring(1)
: Constants.NS_URI_SOAP_ENC;
URL url = new URL(args[1 - offset]);
String nameToLookup = args[2 - offset];
BeanSerializer beanSer = new BeanSerializer();

// Build the call.
Call call = new Call();

call.setTargetObjectURI("urn:countryInfoLookup");
call.setMethodName("getPopulation");
call.setEncodingStyleURI(encodingStyleURI);

Vector params = new Vector();

params.addElement(new Parameter("nameToLookup", String.class,
nameToLookup, null));
call.setParams(params);

// Invoke the call.
Response resp;

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

// Check the response.
if (!resp.generatedFault())
{
Parameter ret = resp.getReturnValue();
Object value = ret.getValue();

System.out.println(value != null ? "\n" + value : "I don't know.");
}
else
{
Fault fault = resp.getFault();

System.err.println("Generated fault: ");
System.out.println (" Fault Code = " + fault.getFaultCode());
System.out.println (" Fault String = " + fault.getFaultString
());
}
}
}
 
You do not have the mail.jar and activation.jar in you classpath/buildpath.

sjakie

----------
Yes, the world is full of strange people.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top