Return-Path: X-Original-To: apmail-cxf-dev-archive@www.apache.org Delivered-To: apmail-cxf-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F3D516464 for ; Thu, 21 Jul 2011 20:26:41 +0000 (UTC) Received: (qmail 42497 invoked by uid 500); 21 Jul 2011 20:26:41 -0000 Delivered-To: apmail-cxf-dev-archive@cxf.apache.org Received: (qmail 42436 invoked by uid 500); 21 Jul 2011 20:26:41 -0000 Mailing-List: contact dev-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list dev@cxf.apache.org Delivered-To: moderator for dev@cxf.apache.org Received: (qmail 23913 invoked by uid 99); 21 Jul 2011 20:19:38 -0000 X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=FREEMAIL_FROM,SPF_NEUTRAL,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: 216.139.236.26 is neither permitted nor denied by domain of devajyoti.c@gmail.com) Date: Thu, 21 Jul 2011 13:19:11 -0700 (PDT) From: Dev To: dev@cxf.apache.org Message-ID: <1311279551538-4620842.post@n5.nabble.com> Subject: Question regarding SOAPBody and precreated XML payload MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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 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.