Really need help to handle "BIG" 40~70kb file to

Posted by OctavioOlguin on 12-Jan-2018 23:29

Please  help... I'm really behind schedule.

Have this structure working for 7 years now, but this year, change (increasing requirements) on law, order me to send an XML file to authorized  processor for him to sign my xml (That process is for electronic bill, here in Mexico).

The problem is the file can grow to 60 or 70KB (perhaps a little more) .  This is the process able to send to sign a small file:

DEFINE TEMP-TABLE quick_stamp NO-UNDO
        NAMESPACE-URI "facturacion.finkok.com/stamp"
        FIELD xml      AS RAW
        FIELD username AS CHARACTER
        FIELD password AS CHARACTER .
DEFINE DATASET quick_stampDset NAMESPACE-URI "facturacion.finkok.com/stamp"
        XML-NODE-TYPE "HIDDEN"
        FOR quick_stamp.


COPY-LOB FROM FILE NomArchXMLTemp TO OBJECT lcXMLcfdi.

PUT-STRING (lcRAWdata, 1, LENGTH (lcXMLcfdi)) = STRING(lcXMLcfdi).

CREATE quick_stamp.
ASSIGN
    username = wsUser
    password = wsPassword
    xml      = lcRAWdata.


RUN quick_Stamp IN hApplication (INPUT DATASET quick_stampDset, OUTPUT lcXMLcfdi ) .   /* after this, lcXMLcfdi  got the original XML, but with a node added (the signing)  ... */
      

My nightmare now, is to send a 40 - 70KB... have tryed this but to no avail.

COPY-LOB FROM FILE NomArchXMLTemp TO OBJECT memptrRawData.
//PUT-STRING (lcRAWdata, 1, LENGTH (lcXMLcfdi)) = STRING(lcXMLcfdi).

CREATE quick_stamp.
put-bytes(quick_stamp.xml,1) =  memptrRawData.

ASSIGN
    username = wsUser
    password = wsPassword
    xml      = lcRAWdata.
 
        RUN quick_Stamp IN hApplication (INPUT DATASET quick_stampDset, OUTPUT lcXMLcfdi ) .   
        

Response I got is  "PUTBYTE/LENGTH too long  -- increase -s"

Added  -s 50  to Agent parameters, but now I got "Server Terminated Unexpectedly"

I'm really confused..

Thanks in advance for your help.

Posted by Stefan Drissen on 16-Jan-2018 05:32

If you look at the wsdl (in Eclipse) - it shows the xml field as a base64binary.

So just define the field as a BLOB (not a CLOB) and any xml operation on the field will automatically base64 encode it.

You can copy-lob directly to the blob.

All Replies

Posted by OctavioOlguin on 12-Jan-2018 23:35

The last time I got response from app server (embedded lots of messages in the proces)... is on the line #3 in the second sample, so I gues the  PUT-BYTES is where I got problems..

Posted by OctavioOlguin on 13-Jan-2018 00:30

Apparently.. changing to this, make me more closer to solution

DEFINE TEMP-TABLE quick_stamp NO-UNDO
        NAMESPACE-URI "facturacion.finkok.com/stamp"
        FIELD xml      AS clob
        FIELD username AS CHARACTER
        FIELD password AS CHARACTER .
    DEFINE DATASET quick_stampDset NAMESPACE-URI "facturacion.finkok.com/stamp"
        XML-NODE-TYPE "HIDDEN"
        FOR quick_stamp.


COPY-LOB FROM FILE NomArchXMLTemp TO OBJECT memptrRawData.
CREATE quick_stamp.
COPY-LOB memptrRawData TO quick_stamp.xml.
ASSIGN
  username = wsUser
  password = wsPassword.
  //xml      = lcRAWdata.
RUN quick_Stamp IN hApplication (INPUT DATASET quick_stampDset, OUTPUT lcXMLcfdi ) .

The field was changed to CLOB.

Posted by OctavioOlguin on 13-Jan-2018 00:32

Perhaps can avoid copy to mem then mem to field,  by   copy-lob from file to database.field ??

At least it compiles... but web service didn't accepted the new format (CLOB) of field...  I think...  

I'm contacting them....

Posted by Marco Mendoza on 13-Jan-2018 00:54

Some years ago I have a similar error on PUT-STRING.

I defined a temp-table

DEFINE TEMP-TABLE latablaT NO-UNDO

FIELD secuencia-latablaT AS INTEGER

FIELD texto-latablaT AS CHAR

INDEX primario secuencia-latablaT.

And copied the XML on small sections to the temp-table.

And later:

PUT-STRING(mRequest,1) = vcRequest.

Mposicion = 0.

Mposicion = LENGTH(vcRequest) + 1.

FOR EACH latablaT:

PUT-STRING(mRequest,Mposicion) = texto-latablaT.

Mposicion = Mposicion + LENGTH(texto-latablaT).

END.

Im not sure if that can work with your code.

Posted by Matt Gilarde on 13-Jan-2018 07:46

[quote]Added  -s 50  to Agent parameters, but now I got "Server Terminated Unexpectedly"[/quote]

I believe that the default setting for -s is 128 so you actually decreased the stack size. Try setting it to 300 or higher. If that helps you can worry about figuring about the best value.

Posted by OctavioOlguin on 13-Jan-2018 08:12

ok!!!.. I'll try...  Thanks Matt

I figured out about increasing 20% to the current using... as I found a KB about -yd to find current max usage... but as you mention 128kb default, that same kb states that beign the default...  Just tought that appserver agent was different...

The problem now is reduced to what the appservice receives...

Posted by OctavioOlguin on 15-Jan-2018 19:06

Not yet.. still having problems....  I have this situation:

// following code  works ok for small (<32 kb data field)
PUT-STRING (lcRAWdata, 1, LENGTH (lcXMLcfdi)) = STRING(lcXMLcfdi).       
CREATE quick_stamp.
ASSIGN
    quick_stamp.username = wsUser
    quick_stamp.password = wsPassword
    quick_stamp.xml      = lcRAWdata.
RUN quick_Stamp IN hApplication (INPUT DATASET quick_stampDset, OUTPUT lcXMLcfdi ) .

But otherwise, the following, won't work

RUN quick_Stamp IN hApplication (INPUT lcxmlcfdi, INPUT wsUser, INPUT wsPassword,  OUTPUT lcXMLcfdiOUT ) .

It shows a Invalid Handle. Points to deleted handle. (3135)

And need to send > 60 KB in the  quick_stamp.xml field, so the need to expand capacity...

Posted by Stefan Drissen on 16-Jan-2018 05:32

If you look at the wsdl (in Eclipse) - it shows the xml field as a base64binary.

So just define the field as a BLOB (not a CLOB) and any xml operation on the field will automatically base64 encode it.

You can copy-lob directly to the blob.

Posted by OctavioOlguin on 16-Jan-2018 07:17

Thanks!!!!!!

That's it!!!

This thread is closed