Prodataset temp-tables empty after read-xml

Potish

Member
I have an XML I am trying to process using read-xml into a prodataset. The process runs successfully but when I access the temp-tables they are empty. I cannot determine what is causing this. I have used similar code with success in the past.

Sample XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<req:ResponseMsg xmlns:req="http://api-v1.gen.mm.vodafone.com/mminterface/request"><![CDATA[<?xml version="1.0" encoding="UTF-8"?><response xmlns="http://api-v1.gen.mm.vodafone.com/mminterface/response"><ResponseCode>0</ResponseCode><ServiceStatus>0</ServiceStatus></response>]]></req:ResponseMsg>
</soapenv:Body>
</soapenv:Envelope>

My code
define variable vmfile as memptr no-undo.
define variable vlcfile as longchar no-undo.
define variable hEnvelop as handle no-undo.
define variable vlreturn as logical no-undo.

define temp-table ttBody xml-node-name "soapenv:Body"
field id as integer serialize-hidden.

define temp-table ttResponseMsg xml-node-name "req:ResponseMsg"
field id as integer serialize-hidden
field ResponseMsg as character xml-node-type "text".

define dataset dsEnvelop namespace-prefix "soapenv"
xml-node-name "Envelope"
FOR ttBody,
ttResponseMsg

data-relation r01 for ttBody, ttResponseMsg relation-fields (id, id) nested.


file-info:file-name = "sample.xml".
set-size(vmfile) = file-info:file-size.

input from value(file-info:file-name) binary no-map no-convert.
import vmfile.
input close.

copy-lob from vmfile to vlcfile.

hEnvelop = dataset dsEnvelop:handle.

/* this is a debug message */
message "vlcfile -> " string(vlcfile) view-as alert-box.

vlreturn = hEnvelop:read-xml("longchar",
vlcfile,
"empty",
?,
no) no-error.

/* this is a debug message */
message "vlreturn -> " vlreturn view-as alert-box.

/* temp-tables are empty */
for each ttBody:
display ttBody.
end.

/* temp-tables are empty */
for each ttBody:
display ttBody.
end.


Let me know what I might be doing wrong.
 

peterjudge

Member
You really don't need to do this.

Code:
input from value(file-info:file-name) binary no-map no-convert.
import vmfile.
input close.

copy-lob from vmfile to vlcfile.

You can just use COPY-LOB to read the file directly ...
Code:
copy-lob from file file-info:full-pathname to vlcFile.
 

peterjudge

Member
Are you calling the SOAP service yourself? Or is this just an XML file that you are being asked to process?

If a SOAP service: if you have a WSDL for the SOAP service, you can use the $DLC/bin/bprowsdldoc script to generate documentation on the WSDL, including ProDataSet definitions.

If it's just an XML file to load, you are probably going to be better off using the SAX reader than just READ-XML. Not all XML documents match a ProDataSet structure.
 

Potish

Member
You really don't need to do this.

Code:
input from value(file-info:file-name) binary no-map no-convert.
import vmfile.
input close.

copy-lob from vmfile to vlcfile.

You can just use COPY-LOB to read the file directly ...
Code:
copy-lob from file file-info:full-pathname to vlcFile.
Thank you for the suggestion.

I have made the update to simply the code.
 

Potish

Member
Are you calling the SOAP service yourself? Or is this just an XML file that you are being asked to process?

If a SOAP service: if you have a WSDL for the SOAP service, you can use the $DLC/bin/bprowsdldoc script to generate documentation on the WSDL, including ProDataSet definitions.

If it's just an XML file to load, you are probably going to be better off using the SAX reader than just READ-XML. Not all XML documents match a ProDataSet structure.
We currently don't yet have access to call the service so I am using some sample response XML files provided by the vendor.

As soon as we have access to the WSDL I will look into using bprowsdldoc
 

Cecil

19+ years progress programming and still learning.
We currently don't yet have access to call the service so I am using some sample response XML files provided by the vendor.

As soon as we have access to the WSDL I will look into using bprowsdldoc
Check with Developer Guide of the SOAP service that there are no requirements to include custom HTTP headers.
The ABL SOAP client does not offer a method to include custom HTTP headers in the web request.
 
Top