On Monday 06 August 2007 02:02, petrica wrote:
> I have a CXF server and generate automatically a XFire client.
> I used mtom sample from CXF distribution and testMtom function that
> marshall/unmarshall a DataHandler INOUT parameter. The client will
> send OK a file as an attachment through DataHandler parameter to
> server , but it seems the server cannot send another file back to
> client.
> In example below, the file <server.zip> from testMtom server function
> does not arrive on client side.
The code looks OK to me. Couple of questions:
1) Does the client spit out any error or does it just return no data?
2) Is the server running in tomcat or is this a standalone? We
discovered a bug in tomcat where the mtom headers were getting messed
up. We've worked around the tomcat bug in the latest trunk code.
3) Any chance of getting a tcpdump of the response? I'd like to know if
the data is on the wire or not. Since you seem to be using spring
config on the server, you could just try adding:
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature"/>
</jaxws:features>
and looking at the log output.
4) You could also try something similar to what you are doing on the
client side: create a ByteArrayDataSource and use a DataHandler
wrapping that. It's POSSIBLE that something isn't working with the
FileDataSource.
Dan
>
> 1. I activated in client and server optiopns for MTOM ( <mtom.enabled
> >) In client -> client.setProperty("mtom-enabled", "true"); In server
> -> <jaxws:properties> <entry key="mtom-enabled" value="true"/> .....
>
> 2. Alocate an instance of DataHandler on client :
>
> Holder<DataHandler> handler = new Holder<DataHandler>();
> byte[] data = new byte[(int) fileSize];
> new FileInputStream("c:\\temp\\client.zip").read(data);
> handler.value = new DataHandler(new ByteArrayDataSource(data,
> "application/octet-stream"));
>
> MtomType xpMtom = new MtomType();
> xpMtom.setAttachinfo( handler.value );
> service.testMtom( xpMtom );
>
> 3. On server :
> void testMtom( Holder<DataHandler> attachinfo) {
> InputStream mtomIn = attachinfo.value.getInputStream();
> long fileSize = 0;
> for (int i = mtomIn.read(); i != -1; i = mtomIn.read()) {
> fileSize++;
> }
> System.out.println("The image holder data length is " +
> mtomIn.available());
>
> attachinfo.value = new DataHandler( new
> FileDataSource("c:\\temp\\server.zip") );
> }
>
> Where is the mistake ?
>
> Can anybody give me an advice
>
> Any help is appreciated,
> Petrica
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727 C: 508-380-7194
[EMAIL PROTECTED]
http://www.dankulp.com/blog