[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: Sending Attachment in WSDL2RPG



Jim,

Actually WSDL2RPG should automatically create a MIME message, as soon as you called * _Attachments_addFile() to add a file as an attachment to the soap request message.

For example:

// Attach file to request message.
DownloadAttachment12_setAttachment_Attachments_addFile(
   path: 'text/plain': WSDL_MIME_BINARY);

// Set the parameter values of the request message
// of the web service.
//    assign values here
requestMessage.fileName = path;

// Now let's call the web service.
setAttachmentResponse =
   DownloadAttachment12_setAttachment(
       requestMessage:
       errText);

Please check the debug log, whether or not WSDL2RPG created a MIME message. A MIME starts with:

MIME-Version: 1.0
Content-Type: multipart/related;
	type="application/soap+xml";
	boundary="MIMEBoundary_20161014102651910000_791705";
	start="<C1648006CDC119E1A5DC0004AC1AF51A.2@xxxxxxxxxxx>"

Each attachment is separte by a "mime boundary", which looks like this:

sendraw(): entered
--MIMEBoundary_20161014102651910000_791705
Content-Type: application/soap+xml; action="http://tools400.de/wsdl2rpg/webservice/sample/downloadattachment/service/setAttachment";
Content-Transfer-Encoding: binary
Content-ID: <C1648006CDC119E1A5DC0004AC1AF51A.2@xxxxxxxxxxx>

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"; xmlns:tns="http://tools400.de/wsdl2rpg/webservice/sample/downloadattachment/service";><soapenv:Body><tns:setAttachmentRequest><fileName>Hello World.txt</fileName></tns:setAttachmentRequest></soapenv:Body></soapenv:Envelope>
--MIMEBoundary_20161014102651910000_791705
Content-Type: text/plain;
	name="Hello World.txt"
Content-Transfer-Encoding: binary
Content-ID: <C1099006CDC119E1A5DC0004AC1AF51A.1@xxxxxxxxxxx>

Hello World!
--MIMEBoundary_20161014102651910000_791705--

Thomas

-----Ursprüngliche Nachricht-----
Von: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] Im Auftrag von Jim Franz
Gesendet: Donnerstag, 13. Oktober 2016 17:10
An: HTTPAPI and FTPAPI Projects
Betreff: Sending Attachment in WSDL2RPG

Calling web service to send a pdf file - they received file upload request with parameters but no file. Using latest wsdl2rpg and libhttp versions (within last month).
Have never uploaded so not sure where to look in WSDL2RPG - there is a
2011 faq that mentions altering the generated source, but assuming that is an "old way".
Not familiar with MTOM (in soap Body) and am told not needed for small files (this is 3 kb pdf).
debug is on but no apparent issue



 <soapenv:Body>
  <tns:addDocument>
   <tns:username>SVC-XYZ</tns:username>
   <tns:password>abc</tns:password>
   <tns:document>
    <tns:contentList>
     <tns:content>goGihfb0</tns:content>
     <tns:contentMTOM>goGihfb0</tns:contentMTOM>
     <tns:fileName>/EKDFILENET/KEY0133993_20160710.PDF</tns:fileName>
     <tns:mimeType>APPLICATION/PDF</tns:mimeType>
    </tns:contentList>
.. more

debug

recvresp(): entered
HTTP/1.1 200 OK
Date: Thu, 13 Oct 2016 13:47:50 GMT
X-Powered-By: Servlet/3.0
Transfer-Encoding: chunked
Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:e06303dd-fbc2-454e-b3fa-faa4b101b3bd"; start="< root.message@xxxxxxxxxxxxxx>"; start-info="text/xml"
Content-Language: en-US

SetError() #13: HTTP/1.1 200 OK
recvresp(): end with 200
recvdoc parms: chunked 0
header_load_cookies() entered
recvchunk(): entered
get_chunk_size(): entered
1ed
chunk size = 493
get_chunk_size returned 493
calling comm_blockread
--uuid:e06303dd-fbc2-454e-b3fa-faa4b101b3bd
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml";
Content-Transfer-Encoding: binary
Content-ID: <root.message@xxxxxxxxxxxxxx> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";><soap:Body><addDocumentResponse
xmlns="http://services.p8.imaging.xyz.com/
"><return>{C3763938-1559-411E-930D-93A2B6CF3E52}</return></addDocumentResponse></soap:Body></soap:Envelope>
--uuid:e06303dd-fbc2-454e-b3fa-faa4b101b3bd--
comm_blockread returned 493
** 2016-10-13-09.47.54.798000: Preparing to parse received message
** 2016-10-13-09.47.54.942000: Detected MIME message

get_chunk_size(): entered
0
chunk size = 0
get_chunk_size returned 0
http_close(): entered
HTTPAPI Ver 1.32 released 2016-02-10
NTLM Ver 1.4.0 released 2014-12-22
OS/400 Ver V7R1M0
WSDL2RPG (eXpat error): (3) no element found
    received at line: 1
           at column: 0
      from procedure: WSDL2R97_XMLSAXParser_endParse
       and statement: 111800
** 2016-10-13-09.47.54.969000: Leaving P8ServiceImplPort_addDocument()

Jim Franz
--
IMPORTANT NOTICE:
This email is confidential, may be legally privileged, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone else is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender.
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------