Is the client using Exception types generated from the wsdl or the original 
Exception types from the server?    If not from the wsdl, I would suggest 
grabbing the wsdl, generating the faults in a kind of "one off", and 
updating the server side exception to look like it.   The constructors and 
annotations and  methods and such really need to all be there.

Dan


On Tuesday, March 20, 2012 04:41:38 PM Barry Hathaway wrote:
> 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.SESSI
> ON_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
-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to