Question Xml Document Partial Load From Memptr

Potish

Member
I have XML data in a memptr and would like to save the file to a document. When I compete the save process only part of the XML document is saved to the file. My code looks as follows

Code:
DEFINE VARIABLE hDoc AS HANDLE NO-UNDO.
CREATE X-DOCUMENT hDoc.

hDoc:LOAD("memptr",  avariablememptr, FALSE).
hDoc:SAVE("FILE", axmlfile).
DELETE OBJECT hDoc.

The data in the mempr looks as follows

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE protocol SYSTEM "https://www.url.com/payxml/payxml_v4.dtd">
<protocol ver="4.0" pgid="10011072130" pwd="test"><authrx tid="65340489" cref="BH Record Locator: 79285" stat="1" sdesc="Approved" res="990017" rdesc="Auth Done" ctype="1" bno="0" auth="5TLQZ3" risk="AX"/></protocol>

The data saved to the XML file is only this portion

Code:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE protocol SYSTEM "https://www.url.com/payxml/payxml_v4.dtd">

Attempting to open the XMl file results on the following error

This page contains the following errors:
error on line 2 at column 76: Extra content at the end of the document
Below is a rendering of the page up to the first error.


What would cause only part of the XML data in the memptr to be saved to the xml file and how to I fix this?
 

Cecil

19+ years progress programming and still learning.
I get a different error, unable to open the DTD https://www.url.com/payxml/payxml_v4.dtd. This gives me a clue that the ABL is actually referencing this DTD file. Does the DTD match/validate the schema of the XML data in the memptr?

I'm guessing, if the XML data does not validate against the DTD it won't output XML content (somebody else can correct me if I'm wrong).

Just for testing purpose, is it possible to omit the DTD in the XML document header and see if you get the same error? I don't know if this is the cause of your problem but it's just something to try to eliminate as the cause of your problem.

becomes this:
<!DOCTYPE protocol >
 

Cecil

19+ years progress programming and still learning.
A quick google and looking at the documentation for payxml_v4.dtd ( http://stage.saol.com/tut.pdf pa ), is the XML you are trying to import into the ABL a response from a payment gateway server?

What are you using to handle the comunication between the client (ABL) and the web services?
 
Last edited:

Potish

Member
I had removed the URL from the DTD as it is a vendor URL. Here is what the XML looks like exactly as passed by the Vendor

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE protocol SYSTEM "https://www.paygate.co.za/payxml/payxml_v4.dtd">
<protocol ver="4.0" pgid="10011072130" pwd="test"><authrx tid="65340489" cref="BH Record Locator: 79285" stat="1" sdesc="Approved" res="990017" rdesc="Auth Done" ctype="1" bno="0" auth="5TLQZ3" risk="AX"/></protocol>

The XML is passed to us as part of a response from the vendor after we post payment transaction details to them from a webpage. I am using the following code in webspeed to capture the XML data into a memptr. I suspect the COPY-LOB might be the source of the problem.

Code:
define variable mpXMLData as memptr    no-undo.

if web-context:is-xml then
do:
SET-SIZE(mpXMLData) = 0.
COPY-LOB FROM WEB-CONTEXT:FORM-LONG-INPUT TO mpXMLData.

run programtoparsexml.p
end.
 

Cecil

19+ years progress programming and still learning.
Is there a limit set on your Apache WebServer (Only Guessing) for the size of the POST requests.
 

Cecil

19+ years progress programming and still learning.
I had removed the URL from the DTD as it is a vendor URL. Here is what the XML looks like exactly as passed by the Vendor

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE protocol SYSTEM "https://www.paygate.co.za/payxml/payxml_v4.dtd">
<protocol ver="4.0" pgid="10011072130" pwd="test"><authrx tid="65340489" cref="BH Record Locator: 79285" stat="1" sdesc="Approved" res="990017" rdesc="Auth Done" ctype="1" bno="0" auth="5TLQZ3" risk="AX"/></protocol>

The XML is passed to us as part of a response from the vendor after we post payment transaction details to them from a webpage. I am using the following code in webspeed to capture the XML data into a memptr. I suspect the COPY-LOB might be the source of the problem.

Code:
define variable mpXMLData as memptr    no-undo.

if web-context:is-xml then
do:
SET-SIZE(mpXMLData) = 0.
COPY-LOB FROM WEB-CONTEXT:FORM-LONG-INPUT TO mpXMLData.

run programtoparsexml.p
end.

How about something like this (UNTESTED ):

Code:
DEFINE VARIABLE hDoc AS HANDLE NO-UNDO.

if web-context:is-xml then
do:
   
    /** Not Sure if this is needed??? **/
    WEB-CONTEXT:XML-SUPPRESS-NAMESPACE-PROCESSING = true.

    hDoc = WEB-CONTEXT:X-DOCUMENT.
 
    if VALID-HANDLE( hDoc ) then
    do:
   
        if hDoc:TYPE EQ 'X-document':U then
        do:
 
            hDoc:SAVE("memptr", mpXMLData).
           
            run programtoprocessxml.p
 
        end.
     
    end.
 
end.
 

Cecil

19+ years progress programming and still learning.
I having problems with the URL for the DTD. "Unsupported protocol in URL (9082)". The workaround solution for this error talks about SCHEMA-PATH attribute, but that does not work. for me.

Also, I tried using this as-well.
hDoc:STRICT-ENTITY-RESOLUTION = false.
 

Potish

Member
How about something like this (UNTESTED ):

Code:
DEFINE VARIABLE hDoc AS HANDLE NO-UNDO.

if web-context:is-xml then
do:
  
    /** Not Sure if this is needed??? **/
    WEB-CONTEXT:XML-SUPPRESS-NAMESPACE-PROCESSING = true.

    hDoc = WEB-CONTEXT:X-DOCUMENT.
 
    if VALID-HANDLE( hDoc ) then
    do:
  
        if hDoc:TYPE EQ 'X-document':U then
        do:
 
            hDoc:SAVE("memptr", mpXMLData).
          
            run programtoprocessxml.p
 
        end.
    
    end.
 
end.


My initial test of this code is not successful but i will keep trying to see if I can get it to work.
 

Cecil

19+ years progress programming and still learning.
Can you output the CONTENT LENGTH ?
Code:
message "CONTENT_LENGTH:" GET-CGI('CONTENT_LENGTH').
 

Cecil

19+ years progress programming and still learning.
I know that the FORM-LONG-INPUT does terminate at the first NULL character.
 
Top