Author |
Message
|
GeneRK4 |
Posted: Mon Apr 21, 2014 6:23 am Post subject: Customised SOAP Fault message |
|
|
Master
Joined: 08 Jul 2013 Posts: 220
|
I have a requirement to create soap fault message which looks different from broker default SOAP Fault structure.
We have Error schema given as,
<xs:schema targetNamespace="http://schems.xyz.com/common/error_v1_0" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schems.xyz.com/common/error_v1_0" xmlns:err="http://schems.xyz.com/common/error_v1_0">
....
-<xs:element name="xyzError" type="xyzError_Master"> -<xs:annotation> <xs:documentation>Common standard xyz Error Message.</xs:documentation> </xs:annotation> </xs:element>
...
So,looks like the below type of SOAPFault message is expected,
<Body>
<xyzError>
<ErrorCode> 12 </ErrorCode>
<ErrorDesc> Invalid message </ErrorDesc>
<xyzError>
</Body>
Instead of ,
<Body>
<Fault>
<FaultCode>12<FaultCode>
<FaultString><FaultString>
</Fault>
</Body>
WSDL part defining Fault:
-<wsdl:operation name="putConceptGroupSequence"> <wsdl:input message="tns:putConceptGroupSequenceRequest"/> <wsdl:output message="tns:putConceptGroupSequenceResponse"/> <wsdl:fault name="fault" message="tns:putConceptGroupSequenceFault"/> </wsdl:operation>
-<wsdl:operation name="getConceptGroupProductGroup"> <soap:operation soapAction="http://www.example.org/StoreInformationService/getConceptGroupProductGroup"/> -<wsdl:input> <soap:body use="literal"/> </wsdl:input> -<wsdl:output> <soap:body use="literal"/> </wsdl:output> -<wsdl:fault name="fault"> <soap:fault name="fault" use="literal"/> </wsdl:fault>
When I used below code,Error message is thrown for SOAP xml tree bitstream and it says "expecting out or fault'.I am not sure how to create SOAP fault for this requirement.Please provide some suggestions...
Code:
SET OutputRoot.SOAP.Body.ns4:xyzError.ErrorCode = faultcode;
SET OutputRoot.SOAP.Body.ns4:xyzError.ErrorType = faultcode;
SET OutputRoot.SOAP.Body.ns4:xyzError.ErrorDescription = faultstring;
SET OutputRoot.SOAP.Body.ns4:xyzError.Timestamp = CURRENT_TIMESTAMP;
SET OutputLocalEnvironment.Destination.SOAP.Reply.Transport.HTTP.ReplyStatusCode = 500; |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 21, 2014 6:55 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
SOAP Faults have a Fault tag, not a Body tag. So if the WSDL is asking for what you think it's asking for it's another kind of output not a fault and that's why WMB is complaining.
Does the WSDL validate through XMLSpy or similar? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 21, 2014 6:57 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Also your code doesn't seem to be assembling what that WSDL fragment is asking for anyway. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
GeneRK4 |
Posted: Mon Apr 21, 2014 11:42 pm Post subject: |
|
|
Master
Joined: 08 Jul 2013 Posts: 220
|
Vitor wrote: |
SOAP Faults have a Fault tag, not a Body tag. So if the WSDL is asking for what you think it's asking for it's another kind of output not a fault and that's why WMB is complaining.
Does the WSDL validate through XMLSpy or similar? |
I wentthrough the link,
http://www.w3schools.com/webservices/ws_soap_fault.asp
I found that if we need to provide application specific error,it has to come under "detail" segment.
So,the entire SOAPFault structure we cannot change I guess...
<faultcode>, <faultstring>,<faultactor> under Fault seems to be mandatory.
<detail>
Please correct me if I am wrong.. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Apr 22, 2014 4:56 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
GeneRK4 wrote: |
So,the entire SOAPFault structure we cannot change I guess... |
GeneRK4 wrote: |
Please correct me if I am wrong.. |
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Apr 22, 2014 5:03 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
However you can put whatever structure you want under the details tag of the SOAP:Fault message...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
GeneRK4 |
Posted: Tue Apr 22, 2014 8:24 pm Post subject: |
|
|
Master
Joined: 08 Jul 2013 Posts: 220
|
Thank you experts ... |
|
Back to top |
|
 |
|