i've used the "attachment" sample from IBM's Webservice site. http://www.alphaworks.ibm.com/tech/webservicestoolkit
its different from the "echoattachment" sample, but it seems to be a good SOAP/RPC implementation for attaching files and getting them to the server. And it's WSDL describes the attachement parts (see below) Im trying to use it to prototype an ad-hoc data interface that uses SOAP/AXIS instead of SFTP or SSH. My problem is how to attach an array of files rather than a fixed number - im thinking of creating a JAR on the client and sending it to the server. My other problem is how to get a "MessageContext" or a "ServletContext" out of the RPC on the server. RPC seems to call into a method without passing any useful references. I need the context in order to control the file system and the path where i write the files to on the server. I had to make minor code changes to the client and server sides in order to alter the existing sample so that it would move 3 of my files from the client to the server. Snips of my code are at the very bottom of this post. The WSDL for the IBM "attachment" sample does describe the input/ output parameters. For example see "porttype" element below from file "..\demos\attachments\webapp\attachments-interface.wsdl": - <element name="attachments"> - <complexType> - <sequence> <element name="content" type="types:contentType" /> </sequence> </complexType> </element> </xsd:schema> </types> - <message name="RPCRequest"> <part name="listTitle" type="xsd:string" /> <part name="fileList" type="types:ArrayOfString" /> <part name="classFile" type="types:ArrayOfBinary" /> <part name="imageFile" type="types:ArrayOfBinary" /> <part name="htmlFile" type="xsd:string" /> </message> - <message name="RPCResponse"> <part name="list" type="xsd:string" /> </message> - <message name="MessageRequest"> <part element="types:listAttachments" name="listRequest" /> <part name="classFile" type="xsd:ArrayOfBinary" /> <part name="imageFile" type="xsd:ArrayOfBinary" /> <part name="htmlFile" type="xsd:string" /> </message> - <portType name="RPCAttachmentService"> - <operation name="listAttachments"> <input message="tns:RPCRequest" /> <output message="tns:RPCResponse" /> </operation> </portType> * * * my code change to client file "servicebindingexample.java" public static void bind(String wsdlURL, Call call) throws Exception { if (WSTKConstants.WSTK_DEBUG) System.out.println( "WSDL URL: " + wsdlURL ); if ( wsdlURL == null ) wsdlURL = wsdlSvcImplURL ; //rcr change 1 line below String[] fileList= {"demo.class", "demo.jpg", "demo.htm"}; String[] fileList= {"scnjava2.txt", "tm0104a.txt", "tm0116b.txt"}; * * * my code change to server file "attachmentservice.java" protected String listAttachments( String listTitle, String[] fileList, Object[] parts, // this is the attachment object containing 3 files ... for(int i=0; i< parts.length; ++i) { DataHandler datahandler= null; Part part= null; if( parts[i] instanceof Part){ part= (Part) parts[i]; // line below gets reference to the attachment ie. each of the 3 files datahandler= AttachmentUtils.getActiviationDataHandler(part); } else datahandler= (DataHandler) parts[i]; // my changes for writing files on the server with same names as they had on client FileOutputStream fMOut = new FileOutputStream( (new File(System.getProperty("user.dir"),fileList[i]))); int c; BufferedInputStream in = new BufferedInputStream(datahandler.getInputStream()); while((c=in.read()) != -1) { fMOut.write(c); } in.close(); fMOut.flush();