1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Question Xml Document Partial Load From Memptr

Discussion in 'Development' started by Potish, Oct 14, 2017.

  1. Potish

    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 (progress):
    1.  
    2. DEFINE VARIABLE hDoc AS HANDLE NO-UNDO.
    3. CREATE X-DOCUMENT hDoc.
    4.  
    5. hDoc:LOAD("memptr",  avariablememptr, FALSE).
    6. hDoc:SAVE("FILE", axmlfile).
    7. DELETE OBJECT hDoc.
    8.  
    The data in the mempr looks as follows

    Code (progress):
    1.  
    2. <?xml version="1.0" encoding="UTF-8"?>
    3. <!DOCTYPE protocol SYSTEM "https://www.url.com/payxml/payxml_v4.dtd">
    4. <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>
    5.  
    The data saved to the XML file is only this portion

    Code (progress):
    1.  
    2. <?xml version="1.0" encoding="UTF-8" ?>
    3. <!DOCTYPE protocol SYSTEM "https://www.url.com/payxml/payxml_v4.dtd">
    4.  
    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?
     
  2.  
  3. Cecil

    Cecil 17+ 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:
     
  4. Cecil

    Cecil 17+ 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: Oct 15, 2017
  5. Cecil

    Cecil 17+ years progress programming and still learning.

    Have you tried using the SAX reader?
     
  6. Potish

    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 (progress):
    1.  
    2. <?xml version="1.0" encoding="UTF-8"?>
    3. <!DOCTYPE protocol SYSTEM "https://www.paygate.co.za/payxml/payxml_v4.dtd">
    4. <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>
    5.  
    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 (progress):
    1.  
    2. define variable mpXMLData as memptr    no-undo.
    3.  
    4. if web-context:is-xml then
    5. do:
    6. SET-SIZE(mpXMLData) = 0.
    7. COPY-LOB FROM WEB-CONTEXT:FORM-LONG-INPUT TO mpXMLData.
    8.  
    9. run programtoparsexml.p
    10. end.
    11.  
     
  7. Cecil

    Cecil 17+ years progress programming and still learning.

    Is there a limit set on your Apache WebServer (Only Guessing) for the size of the POST requests.
     
  8. Cecil

    Cecil 17+ years progress programming and still learning.

    How about something like this (UNTESTED ):

    Code (progress):
    1.  
    2. DEFINE VARIABLE hDoc AS HANDLE NO-UNDO.
    3.  
    4. if web-context:is-xml then
    5. do:
    6.    
    7.     /** Not Sure if this is needed??? **/
    8.     WEB-CONTEXT:XML-SUPPRESS-NAMESPACE-PROCESSING = true.
    9.  
    10.     hDoc = WEB-CONTEXT:X-DOCUMENT.
    11.  
    12.     if VALID-HANDLE( hDoc ) then
    13.     do:
    14.    
    15.         if hDoc:TYPE EQ 'X-document':U then
    16.         do:
    17.  
    18.             hDoc:SAVE("memptr", mpXMLData).
    19.            
    20.             run programtoprocessxml.p
    21.  
    22.         end.
    23.      
    24.     end.
    25.  
    26. end.
    27.  
     
  9. Cecil

    Cecil 17+ 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.
     
  10. Potish

    Potish Member

    Our deployment is as follows

    Progress OE 11.3
    Windows Server 2012 R2
    IIS 6.0
     
  11. Potish

    Potish Member


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

    Cecil 17+ years progress programming and still learning.

    Can you output the CONTENT LENGTH ?
    Code (progress):
    1.  
    2. message "CONTENT_LENGTH:" GET-CGI('CONTENT_LENGTH').
    3.  
     
  13. Cecil

    Cecil 17+ years progress programming and still learning.

    I know that the FORM-LONG-INPUT does terminate at the first NULL character.
     

Share This Page