Return-Path: Delivered-To: apmail-incubator-cxf-user-archive@locus.apache.org Received: (qmail 76835 invoked from network); 16 Apr 2008 12:51:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Apr 2008 12:51:33 -0000 Received: (qmail 47146 invoked by uid 500); 16 Apr 2008 12:51:33 -0000 Delivered-To: apmail-incubator-cxf-user-archive@incubator.apache.org Received: (qmail 46679 invoked by uid 500); 16 Apr 2008 12:51:32 -0000 Mailing-List: contact cxf-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-user@incubator.apache.org Delivered-To: mailing list cxf-user@incubator.apache.org Received: (qmail 46670 invoked by uid 99); 16 Apr 2008 12:51:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Apr 2008 05:51:32 -0700 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of freeman.fang@gmail.com designates 209.85.198.243 as permitted sender) Received: from [209.85.198.243] (HELO rv-out-0506.google.com) (209.85.198.243) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Apr 2008 12:50:46 +0000 Received: by rv-out-0506.google.com with SMTP id k29so1191596rvb.0 for ; Wed, 16 Apr 2008 05:50:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; bh=C0A7/0yJuiXo84DBwu2hqwVBtGCNFPHgNKLuIxpJA/A=; b=Hywlt0iBjmFf0Zpt/Nf+T2w0gNKtBEbMI64xYUvbFLb2l8zCCXDCyggzAHqjUSV6OiVd9bYW7Kdd1NmUYCq1TqcTlrBMqZCzrCO2dau2FIRHD6rOrKkd9XviIs7trqGTOVaDlIC6bewvaiF7x86AF39YCWchP23YtvDrAFDgLGs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=qbjKk+ztom0hLOVdDkXIrsawldq/wTU9fD4SYDEHm5fe1amVsIdUYRT/VhTvS2PdAK+ucpF2kyLzk1bqfofJg6rENrE6tiTumI48pO51l501XcjB94+gUL1UEgxqUedHxvN5XXbeOjQff/Fok6kZlakDvZf2SATgH6p6OaVGP7I= Received: by 10.141.3.17 with SMTP id f17mr5174736rvi.180.1208350259086; Wed, 16 Apr 2008 05:50:59 -0700 (PDT) Received: from ?192.168.2.110? ( [123.112.2.162]) by mx.google.com with ESMTPS id f42sm15755669rvb.9.2008.04.16.05.50.55 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 16 Apr 2008 05:50:58 -0700 (PDT) Message-ID: <4805F56A.8020501@gmail.com> Date: Wed, 16 Apr 2008 20:47:38 +0800 From: Freeman Fang User-Agent: Thunderbird 1.5.0.2 (X11/20060524) MIME-Version: 1.0 To: cxf-user@incubator.apache.org Subject: Re: CXF Spring client: getting the =?ISO-8859-1?Q?message=B4s_?= =?ISO-8859-1?Q?XML_payload?= References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Juanjo, I think you have several options option1. You can write an Interceptor which should be invoked after receive xml stream from the underlying transport, take a look at LoggingInInterceptor, your interceptor could be very similar with it. the key part in the interceptor looks like public YourInterceptor() { super(Phase.RECEIVE); } public void handleMessage(Message message) throws Fault { InputStream is = message.getContent(InputStream.class); if (is != null) { CachedOutputStream bos = new CachedOutputStream(); try { IOUtils.copy(is, bos); bos.flush();// you get the soap xml now is.close(); message.setContent(InputStream.class, bos.getInputStream());// don't forget to write inputstream back, the inputstream is still needed for next invoked interceptors } } and add to your spring configuration option2. add a jaxws soap protocol handler for your client to process the incoming soap messge, so that you can get the raw xml In your code, you can get the injected client proxy, so you can add handler programmatically YourHandler sh = new YourHandler(); List newHandlerChain = new ArrayList(); newHandlerChain.add(sh); ((BindingProvider)dummyServiceClient).getBinding().setHandlerChain(newHandlerChain); And key part of YourHandler looks like public class YourHandler implements SOAPHandler { public boolean handleMessage(SOAPMessageContext smc) { if ((Boolean)smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)) { //igore client outgoing message return true; } System.out.println("YourHandler : handleMessage Called...."); try { // get soap message SOAPMessageContext soapContext = (SOAPMessageContext)smc; SOAPMessage soapMessage = soapContext.getMessage();// now you get the soapMessage so you can dump the soap payload from saaj api Option 3. You can use jaxws disptach client to work with raw xml directly, but this way need no client proxy so it seems big difference with your current code base. more details please see the jaxws_dispatch_provider sample in kit Regards Freeman Juan Jos� V�zquez Delgado wrote: > Hi all, > > I have a CXF Spring client with the next application-context configuration > file: > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:context="http://www.springframework.org/schema/context" > xmlns:jaxws="http://cxf.apache.org/jaxws" > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd > http://www.springframework.org/schema/context > http://www.springframework.org/schema/context/spring-context-2.5.xsd > http://cxf.apache.org/jaxws > http://cxf.apache.org/schemas/jaxws.xsd"> > > > > serviceClass="services.DummyService" > address="http://localhost:9090/DummyService" > serviceName="s:DummyService" endpointName="e:DummyServicePort" > xmlns:s="http://services.es/" xmlns:e="http://services.es/"> > > > > > > > > This bean is injected in other beans as usual: > > public class DummyServiceTest extends > AbstractDependencyInjectionSpringContextTests { > > @Autowired > @Qualifier("services.dummyServiceClient") > private DummyService dummyServiceClient; > > @Override > protected String[] getConfigLocations() { > return new String[] { > > "classpath:spring/config/application-context-wsclient-test.xml"}; > } > > @SuppressWarnings("unchecked") > public void testDummyService () { > String greetings = dummyServiceClient.getGreetings(); > } > } > > This woks for me perfectly, but now, I need to get the response�s raw XML > (soap message�s payload) before the binding. How could I do this?. Any ideas > or comments are welcome. > > Thanks in advance, > > Juanjo. > >