Greetings,
I have a custom webService consumer in IntegrationServer 8.2. I have major issues trying to extract Fault information from the response message. The flow service looks like this:
PooledSOAPClient → Returns a String with the response from the webService interface.
ClearPipeline
stringToBytes → Converts the String to UTF8 byte array.
bytesToStream → Creates a Stream from the byte array.
createMimeData → mimeData from stream.
getBodyPartContent → Retrieves the SOAP envelope from the MIME data part.
streamToSoapData → Builds SoapData from the BodyPartContent’s result.
Here when debugging the service SOAPData looks like the following in the pipeline:
The next step would be to retrieve the actual fault. Well it doesn’t go that easy I guess…
validateSoapData → no errors so far.
getFaultBlock → Exception being thrown. the error log:
com.wm.app.b2b.server.saaj.SOAPMessage cannot be cast to com.wm.app.b2b.server.jaxrpc.SOAPMessageContext
I guess the MEssageContext is not the result of streamToSoapData, but then how could I retrieve the fault information from a soapData?
@Edit: For now I fixed this issue with a simple JavaService that basically looks like the following:
IDataCursor inputCursor = pipeline.getCursor();
Object inputObject = IDataUtil.get(inputCursor, "soapData");
inputCursor.destroy();
SOAPMessage soapData = null;
if (inputObject instanceof SOAPMessage) {
soapData = (SOAPMessage) inputObject;
}
SOAPFault FAULT = null;
try {
Vector bodyEntries = soapData.getBodyEntries();
Iterator<?> iter = bodyEntries.iterator();
while (iter.hasNext()) {
Object bodyEntry = iter.next();
if (bodyEntry instanceof SOAPFault) {
FAULT = (SOAPFault) bodyEntry;
break;
}
}
} catch (Exception e) {
throw new ServiceException(e.getMessage());
}
IData Fault = IDataFactory.create();
IDataCursor FaultCursor = Fault.getCursor();
IDataUtil.put(FaultCursor, "FaultCode", FAULT.getFaultCode());
IDataUtil.put(FaultCursor, "Reasons", new String[] { FAULT.getFaultString() });
FaultCursor.destroy();
IDataCursor outputCursor = pipeline.getCursor();
IDataUtil.put(outputCursor, "Fault", Fault);
outputCursor.destroy();
Tho I’m opened to more elegant solutions also.
Thanks for the tips!
Best Regards,
Jozsef