I'm having a problem getting my custom exceptions to map to something other than SOAPFaultExceptions.
Being kind of a newbie I'm sure it is something simple.

In my service interface I have:

@WebMethod(operationName="getUniqueInstanceUri", action="urn:getUniqueInstanceUri") public String getUniqueInstanceUri(@WebParam(name="namespace")String namespace, @WebParam(name="baseLocalName")String baseLocalName) throws com.ge.research.sadl.sadlserverplus.InvalidNameException, com.ge.research.sadl.sadlserverplus.SessionNotFoundException;

where InvalidNameException was generated from the WSDL and looks like:

@WebFault(name = "InvalidNameFault", targetNamespace = "http://sadlserverplus.sadl.research.ge.com";)
public class InvalidNameException extends Exception {

private com.ge.research.sadl.sadlserverplus.InvalidNameFault invalidNameFault;

    public InvalidNameException() {
        super();
    }
    ........... other standard methods
}

In the service implementation I throw InvalidNameException and it appears to get thrown correctly Now in my client I try to catch it; however, I am not able to do so. Instead I have to catch SOAPFaultException.
My client, generated from the WSDL, looks like:

private static final QName SERVICE_NAME = new QName("http://sadlserverplus.sadl.research.ge.com";, "SadlServicePlus");
    SadlServicePlus_Service ss;
    SadlServicePlus port;
    URL wsdlURL = new URL(url + "?wsdl");
    this.ss = new SadlServicePlus_Service(wsdlURL, SERVICE_NAME);
    this.port = ss.getSadlServicePlusPort();
((BindingProvider)this.port).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY,Boolean.TRUE);
        try {
            return port.getUniqueInstanceUri(namespace, baseLocalName);
} catch (com.ge.research.sadl.sadlserverplus.InvalidNameException e) {
            System.out.println("never reached");
} catch (com.ge.research.sadl.sadlserverplus.SessionNotFoundException e) {
            System.out.println(e.getMessage());
        }

Any idea what I am doing wrong that is causing the exception not to get marshalled/unmarchalled correctly?
Thanks.

Barry Hathaway

Reply via email to