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

RE: Sending Attachment in WSDL2RPG



Thomas,

Reading the logs you sent, the MTOM "on" log shows a http 500 error and did not complete the attachment processing (see end of this post).

I am going back through how I generated the programs to give you more info.
I am currently not authorized to save the wsdl2rpg lib and zip to you for analysis (developers can't save/export anything).
Most of the source has 8/24/16 change dates, and I downloaded on 9/19/16 There was a previous version 1.16.4 library I renamed before new install and was not in libl

LIBHTTP is 1.32  and installed same day (first) There was a prev version 1.29 and renamed before new install System at ptf cume 15142 (...).

I will be first to admit working in ILE is a challenge to me so pardon my ignorance - This is part of the generated test program - is the 3rd line with ".contentMTOM" my problem? Should it be commented out? I only modified filename and mimeType

// Clear array item
clear parameters.document.contentList.content(X_A2);

// Set array item values:
parameters.document.contentList.content(X_A2).content = 'base64'; parameters.document.contentList.content(X_A2).contentMTOM = 'base64+ '; parameters.document.contentList.content(X_A2).fileName = %trim(j2FILEPATH); parameters.document.contentList.content(X_A2).mimeType = %trim(j2MIMETYPE);

... required parameters to send with document

// Create attachments
j3transferEnc = 'WSDL_MIME_BASE64';
j3suggFileNam = %trim(j2DOCTITLE);
j3filePath    = %trim(j2FILEPATH);
j3mimeType    = %trim(j2MIMETYPE);

partID =
   P8ServiceImplPort_addDocument_Attachments_addFile(
      j3filePath: j3mimeType
      : j3transferEnc: j3suggFileNam);


// Now let's call the web service.
addDocumentResponse =
   P8ServiceImplPort_addDocument(
       parameters:
       errText);



Jim Franz

MTOM "on" log you sent

SetError() #13: HTTP/1.1 500 Internal Server Error
recvresp(): end with 500
recvdoc parms: chunked 0
header_load_cookies() entered
recvchunk(): entered
get_chunk_size(): entered
257

chunk size = 599
get_chunk_size returned 599
calling comm_blockread
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";><soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing";><wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action></soapenv:Header><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:VersionMismatch</soapenv:Value></soapenv:Code><soapenv:Reason><soapenv:Text xml:lang="en-US">Transport level information does not match with SOAP Message namespace URI</soapenv:Text></soapenv:Reason><soapenv:Detail /></soapenv:Fault></soapenv:Body></soapenv:Envelope>
comm_blockread returned 599
** 2016-10-15-16.18.01.702000: Preparing to parse received message
WSDL2RPG: USR0042: Unexpected Soap element received from web service.
                   Cause . . . . . :   The web service sent an element that was not expected. This error often happens if the web service sends a Soap header that has not been declared in the wsdl file. Please enable the debug log to see what actually was
returned by the web service. Most likely you then want to disable sending this escape message in procedures 'SOAPMessage_unexpectedElementStart' and 'SOAPMessage_unexpectedElementEnd'.
          received from procedure: BASICS1R1_f_sndPgmMsg
                    and statement: 54400 WSDL2RPG (eXpat error): (-1009) Unexpected Soap element received from web service.

    received at line: 1
           at column: 177
      from procedure: WSDL2R97_XMLSAXParser_parse
       and statement: 107600
** 2016-10-15-16.18.01.729000: Failed parsing XML message
** 2016-10-15-16.18.01.729000: Failed parsing XML message
SetError() #16: recvchunk: saveproc: Not all data was writtenÜ
http_close(): entered
HTTPAPI Ver 1.33-BETA2 released 2016-10-13 NTLM Ver 1.4.0 released 2014-12-22
OS/400 Ver V7R2M0

** 2016-10-15-16.18.01.730000: Leaving DownloadAttachment12_setAttachment()


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Thomas Raddatz
Sent: Saturday, October 15, 2016 10:34 AM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Sending Attachment in WSDL2RPG

I have no idea, why it should not work for you. I tested MTOM support again and I could switch MTOM on and off by the debugger. Please find the example logs attached.

Just to make sure: Did you properly compile the "WS_OPER" module and link the stub service program? Maybe you should try to debug procedure
MessageContext_new() of moduleWSDL2R85 of service program WSDL2RPGRT and change "isMTOM" there.

I also do not understand why MTOM should be the default. For sure it is not the default value.

Maybe you should send to me the source members that you generated with WSDL2RPG and the zip file of your version of WSDL2RPG.

PM: thomas dot raddatz at tools400 dot de

Thomas.

Am 14.10.2016 um 17:41 schrieb Jim Franz:
>    Thanks for the info - file got there, but they could not handle
>    using  MTOM - the 1.16.5beta3 seems to default it  and I can't see how
>    to not use it. They asked I not use MTOM..
>    Jim
> 
>    On Fri, Oct 14, 2016 at 4:41 AM, Thomas Raddatz
>    <[1]thomas.raddatz@xxxxxx> wrote:
> 
>      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="<[2]C1648006CDC119E1A5DC00
>      04AC1AF51A.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="[3]http://tools400.de/
>      wsdl2rpg/webservice/sample/downloadattachment/service/setAttachment"
>      Content-Transfer-Encoding: binary
>      Content-ID: <[4]C1648006CDC119E1A5DC0004AC1AF51A.2@xxxxxxxxxxx>
>      <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope
>      xmlns:soapenv="[5]http://www.w3.org/2003/05/soap-envelope";
>      xmlns:tns="[6]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: <[7]C1099006CDC119E1A5DC0004AC1AF51A.1@xxxxxxxxxxx>
>      Hello World!
>      --MIMEBoundary_20161014102651910000_791705--
>      Thomas

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------