[ 
https://issues.apache.org/jira/browse/GERONIMO-3462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tomasz Mazan updated GERONIMO-3462:
-----------------------------------

    Description: 
I create SOAPFaultException using code below:

{noformat}
        public SOAPFaultException createFault(String errorCode, String 
errorString) {
                SOAPFault fault = null;
                try {
                        fault = SOAPFactory.newInstance().createFault();
                        fault.setFaultCode(new QName("foo", "bar", "abc"));
                        fault.setFaultString(errorString);
                        fault.setFaultActor("ACTOR");
                } catch (SOAPException ex) {
                        return new SOAPFaultException(null);
                }

                return new SOAPFaultException(fault);
        }
{noformat}

and my WebMethod returns this exception in case internal exception:

{noformat}
@WebService(serviceName = "MyService", portName = "CustomerServices")
@Stateless(name = "MyCustomerService")
public class MyCustomerService {
        
        @EJB
        private CoreManager coreManager = null;

        public MyCustomerService() {
        }

        @WebMethod(operationName = "createCustomer")
        public Customer createCustomer(@WebParam(name = "identifier") String 
identifier) throws SOAPFaultException {
                try {
                        return this.coreManager.createCustomer(identifier);
                } catch (ServiceException e) {
                        throw this.faultService.createFault("FAULT CODE", 
"FAULT STRING");
                }
                
        }

}
{noformat}

and client catches fault with attributes:

{noformat}
  ["faultstring"]=> string(298) "java.rmi.RemoteException: The bean encountered 
a non-application exception.; nested exception is: 
javax.xml.ws.soap.SOAPFaultException: FAULT STRING: The bean encountered a 
non-application exception.; nested exception i
s: javax.xml.ws.soap.SOAPFaultException: FAULT STRING"
  ["faultcode"]=> string(11) "soap:Server"
{noformat}

  was:
I create SOAPFaultException using code below:

        public SOAPFaultException createFault(String errorCode, String 
errorString) {
                SOAPFault fault = null;
                try {
                        fault = SOAPFactory.newInstance().createFault();
                        fault.setFaultCode(new QName("foo", "bar", "abc"));
                        fault.setFaultString(errorString);
                        fault.setFaultActor("ACTOR");
                } catch (SOAPException ex) {
                        return new SOAPFaultException(null);
                }

                return new SOAPFaultException(fault);
        }

and my WebMethod returns this exception in case internal exception:

@WebService(serviceName = "MyService", portName = "CustomerServices")
@Stateless(name = "MyCustomerService")
public class MyCustomerService {
        
        @EJB
        private CoreManager coreManager = null;

        public MyCustomerService() {
        }

        @WebMethod(operationName = "createCustomer")
        public Customer createCustomer(@WebParam(name = "identifier") String 
identifier) throws SOAPFaultException {
                try {
                        return this.coreManager.createCustomer(identifier);
                } catch (ServiceException e) {
                        throw this.faultService.createFault("FAULT CODE", 
"FAULT STRING");
                }
                
        }

}

and client catches fault with attributes:
  ["faultstring"]=>
  string(298) "java.rmi.RemoteException: The bean encountered a non-application 
exception.; nested exception is:
        javax.xml.ws.soap.SOAPFaultException: FAULT STRING: The bean 
encountered a non-application exception.; nested exception i
s:
        javax.xml.ws.soap.SOAPFaultException: FAULT STRING"
  ["faultcode"]=>
  string(11) "soap:Server"


> Problem with throwing SOAPFaultException within WebService based on 
> SessionBean 
> --------------------------------------------------------------------------------
>
>                 Key: GERONIMO-3462
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-3462
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: webservices
>    Affects Versions: 2.0.1
>         Environment: ApacheCXF as service provider
>            Reporter: Tomasz Mazan
>
> I create SOAPFaultException using code below:
> {noformat}
>       public SOAPFaultException createFault(String errorCode, String 
> errorString) {
>               SOAPFault fault = null;
>               try {
>                       fault = SOAPFactory.newInstance().createFault();
>                       fault.setFaultCode(new QName("foo", "bar", "abc"));
>                       fault.setFaultString(errorString);
>                       fault.setFaultActor("ACTOR");
>               } catch (SOAPException ex) {
>                       return new SOAPFaultException(null);
>               }
>               return new SOAPFaultException(fault);
>       }
> {noformat}
> and my WebMethod returns this exception in case internal exception:
> {noformat}
> @WebService(serviceName = "MyService", portName = "CustomerServices")
> @Stateless(name = "MyCustomerService")
> public class MyCustomerService {
>       
>       @EJB
>       private CoreManager coreManager = null;
>       public MyCustomerService() {
>       }
>       @WebMethod(operationName = "createCustomer")
>       public Customer createCustomer(@WebParam(name = "identifier") String 
> identifier) throws SOAPFaultException {
>               try {
>                       return this.coreManager.createCustomer(identifier);
>               } catch (ServiceException e) {
>                       throw this.faultService.createFault("FAULT CODE", 
> "FAULT STRING");
>               }
>               
>       }
> }
> {noformat}
> and client catches fault with attributes:
> {noformat}
>   ["faultstring"]=> string(298) "java.rmi.RemoteException: The bean 
> encountered a non-application exception.; nested exception is: 
> javax.xml.ws.soap.SOAPFaultException: FAULT STRING: The bean encountered a 
> non-application exception.; nested exception i
> s: javax.xml.ws.soap.SOAPFaultException: FAULT STRING"
>   ["faultcode"]=> string(11) "soap:Server"
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to