private Object sendDocument(org.dom4j.Document doc) throws Exception { Client client = getClient(); if (null != soapHeaders) { client.getRequestContext().put(org.apache.cxf.headers.Header.HEADER_LIST, soapHeaders); } Object[] result = client.invoke(operationName, DOM4JMarshaller.documentToSource(doc)); if (result != null) { org.dom4j.Document response = DOM4JMarshaller.sourceToDocument((Source) result[0]); if (enhancedResponse) { Map<String, Object> enhancedBody = new HashMap<String, Object>(); enhancedBody.put("payload", response); enhancedBody.put( CorrelationIDFeature.MESSAGE_CORRELATION_ID, client.getResponseContext().get(CorrelationIDFeature.MESSAGE_CORRELATION_ID)); return enhancedBody; } else { return response; } } return null; }
private Object sendDocument(org.dom4j.Document doc) throws Exception { Client client = createClient(); try { Object[] result = client.invoke(operationName, DOM4JMarshaller.documentToSource(doc)); if (result != null) { return DOM4JMarshaller.sourceToDocument((Source) result[0]); } } catch (org.apache.cxf.binding.soap.SoapFault e) { SOAPFault soapFault = ServiceHelper.createSoapFault(e); if (soapFault == null) { throw new WebServiceException(e); } SOAPFaultException exception = new SOAPFaultException(soapFault); if (e instanceof Fault && e.getCause() != null) { exception.initCause(e.getCause()); } else { exception.initCause(e); } throw exception; } finally { client.destroy(); } return null; }