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

Tomasz Mazan commented on GERONIMO-3462:
----------------------------------------

PHP script calls my function

part of wsdl:
{noformat}
<wsdl:operation name="createCustomer">
    <wsdl:input message="ns1:createCustomer" name="createCustomer">
    </wsdl:input>
    <wsdl:output message="ns1:createCustomerResponse" 
name="createCustomerResponse">
    </wsdl:output>
    <wsdl:fault message="ns1:SOAPFaultException" name="SOAPFaultException">
    </wsdl:fault>
</wsdl:operation>

<xs:complexType name="SOAPFaultException">
        <xs:sequence>
             <xs:element name="faultcode" nillable="true" type="xs:QName"/>
             <xs:element name="faultstring" nillable="true" type="xs:string"/>
             <xs:element name="faultactor" nillable="true" type="xs:string"/> 
             <xs:element name="message" nillable="true" type="xs:string"/> 
        </xs:sequence>
</xs:complexType>
{noformat}

and php code looks like
{noformat}
        $soapClient = new 
SoapClient("http://localhost:8080/MyApp/MyService?wsdl";, array("exceptions" => 
true));
        $temp = $soapClient -> createCustomer(array("identifier" => 
$argv[1]))->return;
{noformat}


> 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
>            Assignee: Jarek Gawor
>
> 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