Re: xrpcc questions

From: Doug Kohlert <>
Date: Thu, 01 Aug 2002 16:02:44 -0700

David, please see my comments inline.

David Thorpe wrote:
> I have been using JAXRPC bundled with the JWSDP 1.0.
> 1. I noticed when my service methods threw exceptions that the xrpcc command would generate a serializer for the exception and give the serializer class the same package as the exception. So, for example, a method throwing InterruptedException would generate an InterruptedException_SOAPSerializer class in package java.lang. Ideally, I would want these generated exception serializers to have the same package name as specified in the config.xml. Am I missing a coniguration parameter somewhere?
No, currently all serializers are generated in the same package as the
object that which they serialize. We are looking at changing that
behavior in the case of exceptions for a future release.

> 2. On a related topic, when I make the call to the service method from my Java client through the generated stub, any exception that the service method throws is getting wrapped in a SOAPFaultException when it gets to the client. Since the XML representation of the exception class gets placed in the detail element of the fault element, couldn't the jaxrpc stub create the service-thrown exception from the xml on the client side and have that be the exception that is thrown from the soap call? Therefore, instead of having to catch SOAPFaultException, I could have a catch for the actual exception the service throws?

The FCS version of jaxrpc released in the jwsdp 1.0 release will allow
you to throw service specific exception from your server's
implementation class and catch them on your jaxrpc client if the
exceptions match the following format.

The exception class must have a constructor that has one parameter for
each getter method defined on the exception, the parameter types must
match the types of the getter methods. You can only have one getter
method that returns a particular type.

for example

public class MyException extends Exception {

   public MyException(String name, int age)...

   public int getAge()...

   public String getName()...

will work. however;

public class MyException extends Exception {

   public MyException(String name, String address, int age)...

   public int getAge()...

   public String getName()...
   public String getAddress()..

will not work because the getName and getAddress method both return type

This exception can be caught on the client as a SOAPFaultException.

> 3. Some web service code generators are able to take an EJB and generate the necessary classes for the web service directly from the EJB. I'm assuming there is no way to do that with xrpcc. Will any future release have this functionality? Are there any alternative tools that will generate jaxrpc classes from an EJB?

Currently xrpcc cannot do this, however; this issue is being addressed
in the J2EE 1.4 release.

> Thanks for any help on these questions.
> David

Doug Kohlert
Java Software Division
Sun Microsystems, Inc.
phone: 503 345-9806