Hi,
I'm using an https webservice with Webspeed and I would like to attach a PDF file using MULTIPART/RELATED Mime header before sending the SOAP Message to the webservice.
But it doesn't seem to work although its working with SOAPUI.
When I remove the boundary part :
+ '------=_Part_2_9697824.1414659778799~n' + 'Content-Type: text/xml; charset=UTF-8~n' + 'Content-Transfer-Encoding: 8bit~n' + 'Content-ID: <rootpart@soapui.org>~n'
and the other
+ '------=_Part_2_9697824.1414659778799~n' + 'Content-Type: application/pdf; name=minimal.pdf~n' etc...
It's working alright.
The SOAP Message :
POST https://mywebservice HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: multipart/related; type="text/xml"; start="<rootpart@soapui.org>"; boundary="----=_Part_2_9697824.1414659778799" SOAPAction: "" MIME-Version: 1.0 Content-Length: 2945 Host: mywebservice Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5) + '------=_Part_2_9697824.1414659778799~n' + 'Content-Type: text/xml; charset=UTF-8~n' + 'Content-Transfer-Encoding: 8bit~n' + 'Content-ID: <rootpart@soapui.org>~n' <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mul="MyWS"> <soapenv:Header> </soapenv:Header> <soapenv:Body> <mul:sendMessage> <mul:wsMessage> <mul:content>Contenu</mul:content> <mul:custId></mul:custId> <mul:from></mul:from> <mul:fullContenu>Full Contenu</mul:fullContenu> <mul:orgName></mul:orgName> <mul:resumeContent></mul:resumeContent> <mul:sendProfiles> <mul:strategy></mul:strategy> <mul:subject></mul:subject> <mul:to></mul:to> </mul:wsMessage> </mul:sendMessage> </soapenv:Body> </soapenv:Envelope> + '------=_Part_2_9697824.1414659778799~n' + 'Content-Type: application/pdf; name=minimal.pdf~n' + 'Content-Transfer-Encoding: binary~n' + 'Content-ID: <mdws-attached/minimal.pdf>~n' + 'Content-Disposition: attachment; name="minimal.pdf"; filename="minimal.pdf"~n' + '~n' + '%PDF-1.1~n' + '%¥±ë~n' + '~n' + '1 0 obj~n' + '<< /Type /Catalog~n' + '/Pages 2 0 R~n' + '>>~n' + 'endobj~n' + '~n' + '2 0 obj~n' + '<< /Type /Pages~n' + '/Kids [3 0 R]~n' + '/Count 1~n' + '/MediaBox [0 0 300 144]~n' + '>>~n' + 'endobj~n' + '~n' + '3 0 obj~n' + '<< /Type /Page~n' + '/Parent 2 0 R~n' + '/Resources~n' << /Font~n' + '<< /F1~n' + '<< /Type /Font~n' + '/Subtype /Type1~n' + '/BaseFont /Times-Roman~n' + '>>~n' + '>>~n' + '>>~n' + '/Contents 4 0 R~n' + '>>~n' + 'endobj~n' + '~n' + '4 0 obj~n' + '<< /Length 55 >>~n' + 'stream~n' + 'BT~n' + '/F1 18 Tf~n' + '0 0 Td~n' + '(Hello World) Tj~n' + 'ET~n' + 'endstream~n' + 'endobj~n' + '~n' + 'xref~n' + '0 5~n' + '0000000000 65535 f~n' + '0000000018 00000 n ~n' + '0000000077 00000 n ~n' + '0000000178 00000 n ~n' + '0000000457 00000 n ~n' + 'trailer~n' + '<< /Root 1 0 R~n' + '/Size 5~n' + '>>~n' + 'startxref~n' + '565~n' + '%%EOF~n' + '~n' + '------=_Part_2_9697824.1414659778799--~n'
Any tips would by great.
API used : https://community.progress.com/community_groups/openedge_development/f/19/t/506.aspx
Note I've got the same issue with my .NET application, where I can't see an addAttachment method like this one.
(JAVA AXIS CODE)
FileDataSource file = new FileDataSource("C/repertoire/exemple.txt"); DataHandler data = new DataHandler(file); AttachmentPart attachmentPart = new AttachmentPart(data); attachmentPart.setContentId("mdws-attached/exemple.txt"); myStubService.addAttachment(attachmentPart); myStubService.sendMessage(myMessage);