This will take a SOAP message, and send it to the
cd-order-service which should reside at the supplied
URL.
// Parse the XML message
FileReader reader = new FileReader(msgFilename);
DocumentBuilder builder = XMLParserUtils.getXMLDocBuilder();
Document doc = builder.parse(new InputSource(reader));
if (doc == null) {
throw new SOAPException(Constants.FAULT_CODE_CLIENT,
"Error parsing XML message.");
}
// Create the message envelope
Envelope msgEnvelope = Envelope.unmarshall(doc.getDocumentElement());
// Send the message
Message msg = new Message();
msg.send(serviceURL, "urn:cd-order-service", msgEnvelope);
// Handle the response
SOAPTransport transport = msg.getSOAPTransport();
BufferedReader resReader = transport.receive();
String line;
while ((line = resReader.readLine()) != null) {
System.out.println(line);
}