I am trying to implement a web service that uses soap attachments. I have set up two operations, one that receives a DataSource object and one that returns a DataSource object. The service that receives a DataSource object is working nicely, but I get an attachment could not be found exception when trying to call the service that returns a DataSource. Below are snippets of code. I have zipped up a small example of my problem and it can be downloaded from:
http://geocities.com/netb0y1/mtom_datasource.tar.gz Thanks, Chris Web service: public interface MTOMService { public DataSource dataSourceOut(); public void dataSourceIn(DataSource source); } public class MTOMServiceImpl implements MTOMService { public DataSource dataSourceOut() { return new FileDataSource("myfile.txt"); } public void dataSourceIn(DataSource data) { try { BufferedReader reader = new BufferedReader(new InputStreamReader(data.getInputStream())); System.out.println("[dataSourceIn] Received data: "); for (String s; (s = reader.readLine()) != null;) { System.out.print("[dataSourceIn] "); System.out.println(s); } } catch (Exception e) { e.printStackTrace(); } } } Client: MTOMService service = (MTOMService) new XFireProxyFactory().create(SERVICE_MODEL, "url to server"); Client client = Client.getInstance(service); client.setProperty("mtom-enabled", "true"); client.setProperty(HttpTransport.CHUNKING_ENABLED, "true"); This call works: service.dataSourceIn(new FileDataSource("myfile.txt")); This call throws an exception: DataSource data = service.dataSourceOut(); org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Could not find the attachment cid:11715509681567128031386@http://www.w3.org/2001/XMLSchema org.codehaus.xfire.fault.XFireFault: Could not find the attachment cid:11715509681567128031386@http://www.w3.org/2001/XMLSchema at org.codehaus.xfire.aegis.type.mtom.AbstractXOPType.readInclude(AbstractXOPType.java:62) at org.codehaus.xfire.aegis.type.mtom.AbstractXOPType.readObject(AbstractXOPType.java:45) at org.codehaus.xfire.aegis.AegisBindingProvider.readParameter(AegisBindingProvider.java:162) at org.codehaus.xfire.service.binding.AbstractBinding.read(AbstractBinding.java:206) at org.codehaus.xfire.service.binding.WrappedBinding.readMessage(WrappedBinding.java:50) at org.codehaus.xfire.soap.handler.SoapBodyHandler.invoke(SoapBodyHandler.java:42) at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131) at org.codehaus.xfire.client.Client.onReceive(Client.java:382) at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139) at org.codehaus.xfire.transport.http.XFireServletChannel.send(XFireServletChannel.java:48) at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26) at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131) at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75) at org.codehaus.xfire.client.Client.invoke(Client.java:335) at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77) at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57) at $Proxy1.dataSourceOut(Unknown Source) at org.codehaus.xfire.mtom.MTOMServiceTest.testDataSourceOut(MTOMServiceTest.java:46) ____________________________________________________________________________________ Never miss an email again! Yahoo! Toolbar alerts you the instant new Mail arrives. http://tools.search.yahoo.com/toolbar/features/mail/ --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
