hmmm... FileDataSource should automatically pick up the MIME type...
Please check whether the message gets delivered using MTOM (using a MIME package) or with in line base64 string... Check by enabling MTOM as follows, If MTOM is not enabled. Options options =stub._getServiceClient().getOptions(); options.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM, Boolean.TRUE); HTH, ~Thilina On 9/20/06, VF <[EMAIL PROTECTED]> wrote:
Hi,please I have this question. Is ti possible to transfer PDF file with SOAP,MTOM and ADB? I have this fragment in WSDL: <xs:element name="getFileRequest"> <xs:complexType> <xs:sequence> <xs:element name="filein" type="xs:base64Binary" /> </xs:sequence> </xs:complexType> </xs:element> Axis generated this ADB binding: ------------------------------------------------- /** field for Filein */ protected javax.activation.DataHandler localFilein; /** * Auto generated getter method * * @return javax.activation.DataHandler */ public javax.activation.DataHandler getFilein() { return localFilein; } /** * Auto generated setter method * * @param param Filein */ public void setFilein(javax.activation.DataHandler param) { this.localFilein = param; } ---------------------------------------------------- I call it in client: * Auto generated test method */ public void testgetFile() throws java.lang.Exception { binary.axws.BinarytestStub stub = new binary.axws.BinarytestStub(); //the default implementation should point to the right endpoint binary.axtypes.GetFileRequest param18 = (binary.axtypes.GetFileRequest) getTestObject(binary.axtypes.GetFileRequest.class); // todo Fill in the param18 here DataHandler dh = new DataHandler(new FileDataSource("c:\\a.pdf")); param18.setFilein(dh); BinarytestSkeleton bts = new BinarytestSkeleton(); assertNotNull(bts.getFile(param18)); //assertNotNull(stub.getFile(param18)); param18.setFilein(dh); } ------------------------------------------------------- on server is this code: public binary.axtypes.GetFileResponse getFile( binary.axtypes.GetFileRequest param2) { DataHandler dh = param2.getFilein(); binary.axtypes.GetFileResponse resp = new binary.axtypes.GetFileResponse(); try { dh.writeTo(new FileOutputStream("c:\\a2.pdf")); resp.setFileout(dh); return resp; } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return resp; //Todo fill this with the necessary business logic //throw new java.lang.UnsupportedOperationException(); } ----------------------------------------------------------- Result: When I call it directly through service skeleton and save it on server it is ok and I can open new file, but if I use stub and send it over Axis2, then it s not possible to open this file. It says,that it is possible that it was sent as a mail attachement and it has bad encoding. How can i send it with pdf mime type? Thanks a lot. Vlada --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- http://webservices.apache.org/~thilina/ http://thilinag.blogspot.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]