Java Reference
In-Depth Information
//Create SOAP Message from DOM
SOAPMessage soapCC = createSoapMessage(domCC);
//Dispatch SOAP Message: invoke svc
SOAPMessage soapAuth = invoke(soapCC);
//unmarshall back into Authorization object
auth = unmarshal(soapAuth);
} catch (JAXBException iae){
LOGGER.warn("JAXB: Invalid data! ", iae);
} catch (SAXException se){
LOGGER.warn("SAX: Invalid data! " + se);
}
return auth;
}
/**
* Creates a SOAP Envelope with a SOAP Body containing this
* document as its child. */
public SOAPMessage createSoapMessage(Document document) {
LOGGER.debug("Executing.");
SOAPMessage message = null;
try {
message = MessageFactory.newInstance().createMessage();
final SOAPEnvelope env = message.getSOAPPart().getEnvelope();
final SOAPBody body = env.getBody();
body.addDocument(document);
message.saveChanges();
LOGGER.debug("Created SOAP Message.");
} catch(SOAPException se){
LOGGER.error("Could not create SOAP message. ", se);
}
return message;
}
/**
* Uses the previously created request message to call the
* web service and return a response.
*/
Search WWH ::




Custom Search