final Node node = (Node)children.next() ;
if (node instanceof SOAPElement)
{
if (found)
{
throw new SOAPException("Found multiple SOAPElements in SOAPBody") ;
}
final StringWriter sw = new StringWriter() ;
final XMLEventWriter writer = XMLHelper.getXMLEventWriter(new StreamResult(sw)) ;
XMLHelper.readDomNode(node, writer, true) ;
requestProxy.setPayload(esbReq, sw.toString()) ;
found = true ;
}
}
if (!found)
{
throw new SOAPException("Could not find SOAPElement in SOAPBody") ;
}
if (soapIncomingProps != null)
{
initialiseWSAProps(esbReq, soapIncomingProps) ;
}
// Extract security info from SOAPMessage.
AuthenticationRequest authRequest = extractSecurityDetails(request, esbReq);
ExtractorUtil.addAuthRequestToMessage(authRequest, esbReq);
// We should be able to return null here but this causes JBossWS to NPE.
final Message esbRes = deliverMessage(esbReq) ;
final SOAPMessage response = SOAP_MESSAGE_FACTORY.createMessage();
if (esbRes != null)
{
final Object input = responseProxy.getPayload(esbRes) ;
if (input == null)
{
throw new SOAPException("Null response from service") ;
}
final String soapRes = input.toString();
final Document root = parseAsDom(soapRes) ;