add saaj libs in classpath in order to run this...
SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
SOAPConnection conn = scf.createConnection();
// Create message
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage msg = mf.createMessage();
// Add eventually a SoapAction header if necessary
/*
MimeHeaders hd = msg.getMimeHeaders();
hd.addHeader("SOAPAction", "urn:yoursoapaction");
*/
// Object for message parts
SOAPPart sp = msg.getSOAPPart();
SOAPEnvelope env = sp.getEnvelope();
env.addNamespaceDeclaration("xsd","http://www.w3.org/2001/XMLSchema");
env.addNamespaceDeclaration("xsi","http://www.w3.org/2001/XMLSchema-instance");
env.addNamespaceDeclaration("enc","http://schemas.xmlsoap.org/soap/encoding/");
env.addNamespaceDeclaration("env","http://schemas.xmlsoap.org/soap/envelop/");
env.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/");
SOAPBody bd = env.getBody();
// Populate body
// Main element and namespace
SOAPElement be = bd.addChildElement(env.createName("AddOperationComp",
"sox", "http://Huff"));
// namespace to use for my rpc/encoded wsdl version is:
// http://phonedirlux.homeip.net/wsdl
// note, in this case the endpoint address is /rcx-ws-rpc/rcx
// Add content
be.addChildElement("number1Comp").addTextNode("2").setAttribute("xsi:type","xsd:int");
be.addChildElement("number2Comp").addTextNode("3").setAttribute("xsi:type","xsd:int");
// Save message
msg.saveChanges();
// View input
System.out.println("\n Soap request:\n");
msg.writeTo(System.out);
System.out.println();
// Send
String urlval = "http://localhost:9090/ode/processes/Huff";
// or /rcx-ws-rpc/rcx for my rpc/encoded web service
SOAPMessage rp = conn.call(msg, urlval);
// View the output
System.out.println("\nXML response\n");
// Create transformer
TransformerFactory tff = TransformerFactory.newInstance();
Transformer tf = tff.newTransformer();
// Get reply content
Source sc = rp.getSOAPPart().getContent();
// Set output transformation
StreamResult result = new StreamResult(System.out);
tf.transform(sc, result);
System.out.println();
// Close connection
conn.close();
--
al
________________________________
From: LeeMike <[email protected]>
To: [email protected]
Sent: Tue, 1 June, 2010 5:40:19
Subject: Please show an example of invoking bpel process from java
Please show an example of bpel process .I hope that this process is created
by myeclipse bpel,deployed on apache ode. this example hava some statements
which invok bpel process from java applications. I hope you can upload
Source code on attachment .Thank you very much!
--
View this message in context:
http://old.nabble.com/Please-show-an-example-of-invoking-bpel-process-from-java-tp28737425p28737425.html
Sent from the Apache Ode User mailing list archive at Nabble.com.