Getting FaultString from SOAP message on Client
Hi, I am having some problems getting the FaultString out of the SOAP message returned to me from a service. I have generated my stubs using WSDL2Java from version 1.3 of Axis2. The following is the SOAP message returned : soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Header/ soapenv:Body soapenv:Fault faultcode xmlns:p773= http://exception.enterpriseservice.mincom.com p773:EnterpriseServiceConnectionException/faultcode faultstring![CDATA[com.mincom.enterpriseservice.exception.EnterpriseServiceConnectionException: CTG9631E: Error occurred during interaction with CICS. Error Code=ECI_ERR_NO_CICS, error code: -3]]/faultstring detail encodingStyle= p773:EnterpriseServiceConnectionException xmlns:p773= http://exception.enterpriseservice.mincom.com; p773:ellipseConnectionManagerLogonResultDTO xsi:nil=true/ /p773:EnterpriseServiceConnectionException /detail /soapenv:Fault /soapenv:Body /soapenv:Envelope However, the stub throws an EnterpriseServiceConnectionException which contains a null ellipseConnectionManagerLogonResultDTO (which I guess makes sense from the result). I want to know if the faultstring is made available to the client stubs(as this is what holds the meaningful message in this case), and if so, how? Thanks Julie -- This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please notify the sender and delete the transmission. The contents of this e-mail are the opinion of the writer only and are not endorsed by the Mincom Group of companies unless expressly stated otherwise. --
Re: Getting FaultString from SOAP message on Client
Thanks for your feedback, however, the exception that is thrown is a EnterpriseServiceConnectionException Exception. This does not have a 'getFaultString' method, it only has a 'getFaultMessage' which returns the null ellipseConnectionManagerLogonResultDTO. Does this mean that the EnterpriseServiceConnectionException has been defined incorrectly in the WSDL? Thanks Julie You can get faultString etc. like in the catch block, exception.getFaultString() Upul On Feb 1, 2008 3:38 AM, [EMAIL PROTECTED] wrote: Hi, I am having some problems getting the FaultString out of the SOAP message returned to me from a service. I have generated my stubs using WSDL2Java from version 1.3 of Axis2. The following is the SOAP message returned : soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Header/ soapenv:Body soapenv:Fault faultcode xmlns:p773= http://exception.enterpriseservice.mincom.com p773:EnterpriseServiceConnectionException/faultcode faultstring![CDATA[com.mincom.enterpriseservice.exception.EnterpriseServiceConnectionException: CTG9631E: Error occurred during interaction with CICS. Error Code=ECI_ERR_NO_CICS, error code: -3]]/faultstring detail encodingStyle= p773:EnterpriseServiceConnectionException xmlns:p773= http://exception.enterpriseservice.mincom.com; p773:ellipseConnectionManagerLogonResultDTO xsi:nil=true/ /p773:EnterpriseServiceConnectionException /detail /soapenv:Fault /soapenv:Body /soapenv:Envelope However, the stub throws an EnterpriseServiceConnectionException which contains a null ellipseConnectionManagerLogonResultDTO (which I guess makes sense from the result). I want to know if the faultstring is made available to the client stubs(as this is what holds the meaningful message in this case), and if so, how? Thanks Julie -- This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please notify the sender and delete the transmission. The contents of this e-mail are the opinion of the writer only and are not endorsed by the Mincom Group of companies unless expressly stated otherwise. --
Re: Getting FaultString from SOAP message on Client
Sorry, You can get the last envelope like this. And traverse the OMElement. There should be better solutions. org.apache.axiom.soap.SOAPEnvelope soap = stub._getServiceClient().getLastOperationContext().getMessageContext( org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE ).getEnvelope(); Upul On Feb 1, 2008 7:42 AM, [EMAIL PROTECTED] wrote: Thanks for your feedback, however, the exception that is thrown is a EnterpriseServiceConnectionException Exception. This does not have a 'getFaultString' method, it only has a 'getFaultMessage' which returns the null ellipseConnectionManagerLogonResultDTO. Does this mean that the EnterpriseServiceConnectionException has been defined incorrectly in the WSDL? Thanks Julie You can get faultString etc. like in the catch block, exception.getFaultString() Upul On Feb 1, 2008 3:38 AM, [EMAIL PROTECTED][EMAIL PROTECTED] wrote: Hi, I am having some problems getting the FaultString out of the SOAP message returned to me from a service. I have generated my stubs using WSDL2Java from version 1.3 of Axis2. The following is the SOAP message returned : soapenv:Envelope xmlns:soapenv=*http://schemas.xmlsoap.org/soap/envelope/*http://schemas.xmlsoap.org/soap/envelope/ xmlns:soapenc=*http://schemas.xmlsoap.org/soap/encoding/*http://schemas.xmlsoap.org/soap/encoding/ xmlns:xsd=*http://www.w3.org/2001/XMLSchema*http://www.w3.org/2001/XMLSchema xmlns:xsi=*http://www.w3.org/2001/XMLSchema-instance*http://www.w3.org/2001/XMLSchema-instance soapenv:Header/ soapenv:Body soapenv:Fault faultcode xmlns:p773=* http://exception.enterpriseservice.mincom.com*http://exception.enterpriseservice.mincom.com/ p773:EnterpriseServiceConnectionException/faultcode faultstring![CDATA[ com.mincom.enterpriseservice.exception.EnterpriseServiceConnectionException: CTG9631E: Error occurred during interaction with CICS. Error Code=ECI_ERR_NO_CICS, error code: -3]]/faultstring detail encodingStyle= p773:EnterpriseServiceConnectionException xmlns:p773=* http://exception.enterpriseservice.mincom.com*http://exception.enterpriseservice.mincom.com/ p773:ellipseConnectionManagerLogonResultDTO xsi:nil=true/ /p773:EnterpriseServiceConnectionException /detail /soapenv:Fault /soapenv:Body /soapenv:Envelope However, the stub throws an EnterpriseServiceConnectionException which contains a null ellipseConnectionManagerLogonResultDTO (which I guess makes sense from the result). I want to know if the faultstring is made available to the client stubs(as this is what holds the meaningful message in this case), and if so, how? Thanks Julie -- This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please notify the sender and delete the transmission. The contents of this e-mail are the opinion of the writer only and are not endorsed by the Mincom Group of companies unless expressly stated otherwise. --
Re: Getting FaultString from SOAP message on Client
Hi Upul Thanks very much for this. It worked a treat. You're right though, it does seem to be a complicated way to get the fault data Regards Julie Sorry, You can get the last envelope like this. And traverse the OMElement. There should be better solutions. org.apache.axiom.soap.SOAPEnvelope soap = stub._getServiceClient().getLastOperationContext().getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE ).getEnvelope(); Upul On Feb 1, 2008 7:42 AM, [EMAIL PROTECTED] wrote: Thanks for your feedback, however, the exception that is thrown is a EnterpriseServiceConnectionException Exception. This does not have a 'getFaultString' method, it only has a 'getFaultMessage' which returns the null ellipseConnectionManagerLogonResultDTO. Does this mean that the EnterpriseServiceConnectionException has been defined incorrectly in the WSDL? Thanks Julie You can get faultString etc. like in the catch block, exception.getFaultString() Upul On Feb 1, 2008 3:38 AM, [EMAIL PROTECTED] wrote: Hi, I am having some problems getting the FaultString out of the SOAP message returned to me from a service. I have generated my stubs using WSDL2Java from version 1.3 of Axis2. The following is the SOAP message returned : soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Header/ soapenv:Body soapenv:Fault faultcode xmlns:p773=http://exception.enterpriseservice.mincom.com p773:EnterpriseServiceConnectionException/faultcode faultstring![CDATA[com.mincom.enterpriseservice.exception.EnterpriseServiceConnectionException: CTG9631E: Error occurred during interaction with CICS. Error Code=ECI_ERR_NO_CICS, error code: -3]]/faultstring detail encodingStyle= p773:EnterpriseServiceConnectionException xmlns:p773= http://exception.enterpriseservice.mincom.com; p773:ellipseConnectionManagerLogonResultDTO xsi:nil=true/ /p773:EnterpriseServiceConnectionException /detail /soapenv:Fault /soapenv:Body /soapenv:Envelope However, the stub throws an EnterpriseServiceConnectionException which contains a null ellipseConnectionManagerLogonResultDTO (which I guess makes sense from the result). I want to know if the faultstring is made available to the client stubs(as this is what holds the meaningful message in this case), and if so, how? Thanks Julie -- This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please notify the sender and delete the transmission. The contents of this e-mail are the opinion of the writer only and are not endorsed by the Mincom Group of companies unless expressly stated otherwise. --