Hi -
My problem definition is as follows: -
I need to create a WS client connecting an WS endpoint using HTTPS and
recover the ServiceName and PortName from WSDL. Once I retrieve the
ServiceName and PortName, I need to send a SOAP message. Here is where I
have run into problem. I already have a pre-created XML which will go into
the SOAP body, but I am unable to determine how to add that to the SOAPBody.
So far my code looks like this I have commented the section where I want to
insert the xml: -
ServiceInfo serviceInfo = getServices(wsdlUrl).get(0);
QName serviceName = serviceInfo.getName();
QName portName =
serviceInfo.getBindings().iterator().next().getName();
System.out.println(serviceName.getLocalPart() + " "
+ portName.getLocalPart());
Service service = Service.create(serviceName);
service.addPort(portName, SOAPBinding.SOAP12HTTP_BINDING,
"https://someaddr");
/** Create a Dispatch instance from a service. **/
Dispatch<SOAPMessage> dispatch =
service.createDispatch(portName,
SOAPMessage.class, Service.Mode.MESSAGE);
/** Create SOAPMessage request. **/
// compose a request message
MessageFactory mf = MessageFactory
.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
// Create a message. This example works with the SOAPPART.
SOAPMessage request = mf.createMessage();
SOAPPart part = request.getSOAPPart();
// Obtain the SOAPEnvelope and header and body elements.
SOAPEnvelope env = part.getEnvelope();
SOAPHeader header = env.getHeader();
SOAPBody body = env.getBody();
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//QUESTIOn - HOW DO I ADD PRECREATED XML INSIDE SOAPBody??
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
request.saveChanges();
/** Invoke the service endpoint. **/
SOAPMessage response = dispatch.invoke(request);
Can anyone provide some insight?
Best Regards-
Dev
--
View this message in context:
http://cxf.547215.n5.nabble.com/Question-regarding-SOAPBody-and-precreated-XML-payload-tp4620842p4620842.html
Sent from the cxf-dev mailing list archive at Nabble.com.