You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by "Kniffin, Bethany B (CRD)" <kn...@crd.ge.com> on 2001/05/02 20:08:42 UTC

Major newbie question

I have just installed Tomcat 3.2.1, xerces 1.3.1, and SOAP 2.1, and am trying to get an extremely
simple example working.  I am using jdk1.2.2, if that matters.  I am able to run tomcat, and deploy
and list a service using the SOAP admin page, but when I try to invoke the service I get the
following SOAP exception:
code =  SOAP-ENV:Client
msg  =  A 'http://schemas.xmlsoap.org/soap/envelope/:Fault' element must contain a: 'faultcode'
element.

My client code is quite simple (it is from Graham Glass's articles on webservices) and is attached
below. The exception occurs during the call.invoke() call (never reaches the  subsequent system.out).

Can someone kindly give me a clue?

Bethany

---------------

import java.net.*;
import java.util.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;

public class Client {
  public static void main(String[] args) throws Exception {
    URL url = new URL("http://localhost:8080/soap/servlet/rpcrouter");
    String urn = "urn:demo1:exchange";
    Call call = new Call();
    call.setTargetObjectURI(urn);
    call.setMethodName("getRate");
    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
    Vector params = new Vector();
    params.addElement(new Parameter("country1", String.class, "USA", null));
    params.addElement(new Parameter("country2", String.class, "Japan", null));
    call.setParams(params);

    try {
      System.out.println("invoke service\n  URL="+url+"\n  URN =" + urn);
      Response response = call.invoke(url,"");
      System.out.println("invoked service");
      if (!response.generatedFault()) {
        Parameter result = response.getReturnValue();
        System.out.println("Result= " + result.getValue());
      }
      else {
        Fault f = response.getFault();
        System.out.println("Fault= "+ f.getFaultCode() + ", " + f.getFaultString());
      }
    }

    catch (SOAPException e) {
      System.err.println("SOAPException= " + e.getFaultCode() + ", " + e.getMessage());
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org


Re: Major newbie question

Posted by Jaap Branderhorst <ja...@xs4all.nl>.
Try use another version of Xerces. This version of xerces has some kind of a
bug in it and thats probably why you get this fault.
Personally I use xerxes 1.2 and it works.

Jaap

----- Original Message -----
From: "Kniffin, Bethany B (CRD)" <kn...@crd.ge.com>
To: <so...@xml.apache.org>
Sent: Wednesday, May 02, 2001 7:08 PM
Subject: Major newbie question


> I have just installed Tomcat 3.2.1, xerces 1.3.1, and SOAP 2.1, and am
trying to get an extremely
> simple example working.  I am using jdk1.2.2, if that matters.  I am able
to run tomcat, and deploy
> and list a service using the SOAP admin page, but when I try to invoke the
service I get the
> following SOAP exception:
> code =  SOAP-ENV:Client
> msg  =  A 'http://schemas.xmlsoap.org/soap/envelope/:Fault' element must
contain a: 'faultcode'
> element.
>
> My client code is quite simple (it is from Graham Glass's articles on
webservices) and is attached
> below. The exception occurs during the call.invoke() call (never reaches
the  subsequent system.out).
>
> Can someone kindly give me a clue?
>
> Bethany
>
> ---------------
>
> import java.net.*;
> import java.util.*;
> import org.apache.soap.*;
> import org.apache.soap.rpc.*;
>
> public class Client {
>   public static void main(String[] args) throws Exception {
>     URL url = new URL("http://localhost:8080/soap/servlet/rpcrouter");
>     String urn = "urn:demo1:exchange";
>     Call call = new Call();
>     call.setTargetObjectURI(urn);
>     call.setMethodName("getRate");
>     call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>     Vector params = new Vector();
>     params.addElement(new Parameter("country1", String.class, "USA",
null));
>     params.addElement(new Parameter("country2", String.class, "Japan",
null));
>     call.setParams(params);
>
>     try {
>       System.out.println("invoke service\n  URL="+url+"\n  URN =" + urn);
>       Response response = call.invoke(url,"");
>       System.out.println("invoked service");
>       if (!response.generatedFault()) {
>         Parameter result = response.getReturnValue();
>         System.out.println("Result= " + result.getValue());
>       }
>       else {
>         Fault f = response.getFault();
>         System.out.println("Fault= "+ f.getFaultCode() + ", " +
f.getFaultString());
>       }
>     }
>
>     catch (SOAPException e) {
>       System.err.println("SOAPException= " + e.getFaultCode() + ", " +
e.getMessage());
>     }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org


Re: Major newbie question

Posted by Jaap Branderhorst <ja...@xs4all.nl>.
Try use another version of Xerces. This version of xerces has some kind of a
bug in it and thats probably why you get this fault.
Personally I use xerxes 1.2 and it works.

Jaap

----- Original Message -----
From: "Kniffin, Bethany B (CRD)" <kn...@crd.ge.com>
To: <so...@xml.apache.org>
Sent: Wednesday, May 02, 2001 7:08 PM
Subject: Major newbie question


> I have just installed Tomcat 3.2.1, xerces 1.3.1, and SOAP 2.1, and am
trying to get an extremely
> simple example working.  I am using jdk1.2.2, if that matters.  I am able
to run tomcat, and deploy
> and list a service using the SOAP admin page, but when I try to invoke the
service I get the
> following SOAP exception:
> code =  SOAP-ENV:Client
> msg  =  A 'http://schemas.xmlsoap.org/soap/envelope/:Fault' element must
contain a: 'faultcode'
> element.
>
> My client code is quite simple (it is from Graham Glass's articles on
webservices) and is attached
> below. The exception occurs during the call.invoke() call (never reaches
the  subsequent system.out).
>
> Can someone kindly give me a clue?
>
> Bethany
>
> ---------------
>
> import java.net.*;
> import java.util.*;
> import org.apache.soap.*;
> import org.apache.soap.rpc.*;
>
> public class Client {
>   public static void main(String[] args) throws Exception {
>     URL url = new URL("http://localhost:8080/soap/servlet/rpcrouter");
>     String urn = "urn:demo1:exchange";
>     Call call = new Call();
>     call.setTargetObjectURI(urn);
>     call.setMethodName("getRate");
>     call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>     Vector params = new Vector();
>     params.addElement(new Parameter("country1", String.class, "USA",
null));
>     params.addElement(new Parameter("country2", String.class, "Japan",
null));
>     call.setParams(params);
>
>     try {
>       System.out.println("invoke service\n  URL="+url+"\n  URN =" + urn);
>       Response response = call.invoke(url,"");
>       System.out.println("invoked service");
>       if (!response.generatedFault()) {
>         Parameter result = response.getReturnValue();
>         System.out.println("Result= " + result.getValue());
>       }
>       else {
>         Fault f = response.getFault();
>         System.out.println("Fault= "+ f.getFaultCode() + ", " +
f.getFaultString());
>       }
>     }
>
>     catch (SOAPException e) {
>       System.err.println("SOAPException= " + e.getFaultCode() + ", " +
e.getMessage());
>     }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org