[SoapRMI] Q: UndeclaredThrowableException

Mark Swanson mark_at_WebServiceSolutions.com
Sun, 24 Nov 2002 15:08:52 -0500


Hello,

I created some code to talk to a remote SOAP service and am having trouble 
with this Exception (below). Any idea what might be causing this?

java.lang.reflect.UndeclaredThrowableException
        at $Proxy0.findEmails(Unknown Source)
        at com.wss.xsoap.HelloClient.main(HelloClient.java:41)
Caused by: soaprmi.RemoteException: IO Exception; nested exception is:
        java.net.ConnectException: Connection refused
        at 
soaprmi.soaprpc.HttpSocketSoapInvocationHandler.invokeTransport(Unknown 
Source)
        at soaprmi.soaprpc.SoapDynamicStub.invoke(Unknown Source)
        ... 2 more

The remote service interface is defined with this method:

byte[] findEmails(String emailRegex) throws SOAPException;

So, I do not see why SOAPException should have to be declared? (If that 's the 
cause of the exception...)

Also, I think the Connection refused is bogus because the service is up and 
running and accessible from other SOAP clients.

Any suggestions would be most welcome.

The client code I'm using is this:


public class HelloClient {

    public static void main (String args[]) throws Exception {

        XmlJavaMapping mapping =
            soaprmi.soap.Soap.getDefault().getMapping();
        // disable XSOAP auto mapping
        mapping.setDefaultStructNsPrefix(null);

        fixNames(mapping);

        UserIfc serviceRef = null;
        String location = "http://localhost/sw/ServletServer/user";

        // create reference ot service
        serviceRef = (UserIfc)
            soaprmi.soaprpc.SoapServices.getDefault().createStartpoint(
            location,  // service location
            new Class[]{UserIfc.class}, // remote service interface
            "user", // endpoint name
            soaprmi.soap.SoapStyle.SOAP11,
            "" // SOAPAction
        );


        byte[] result;
        try {
            result = serviceRef.findEmails("t0_at_a.com");
        } catch(Throwable t) {
            t.printStackTrace();
            return;
        }
        System.out.println("Server said '" + result +"'");
    }

    public static void fixNames(XmlJavaMapping mapping) throws Exception {

        XmlJavaPortTypeMap portMap = mapping.queryPortType(UserIfc.class);

        // extract mapping for operation
        XmlJavaOperationMap oMap =portMap.queryMethodRequest("findEmails");

        // get in message and change part names
        XmlJavaMessageMap requestMsg = oMap.getRequest();
        XmlJavaPartMap[] reqParts = requestMsg.getParts();
        reqParts[0].setPartName("email");

        /*
        mapping.mapStruct(
            "user" //NAMESPACE URI
            "UserIfc" // NAMESPACE LOCAL
            UserNotFoundSOAPException.class // Java Bean class
        );
        */

    }
}


-- 
Schedule your world with ScheduleWorld.com
http://www.ScheduleWorld.com/