Highlighted
Super Contributor.
Super Contributor.
163 views

XML generates and string logic

Hi MicroFocus community Team,

XML PUT TEXT
response-payload
response-len
"Doc-response"
if not XML-OK go to z.

The above logic has been executed and generated below XML file, i just wanted to know how do we get <AuthenticateUserResult> values(marked below as red) into one variable? using String/Inspect verb we can play  or any other way?

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><soap:Header><wsa:Action>http://harlandfs/ECM/Services/Security/AuthenticateUserResponse</wsa:Action><wsa:MessageID>urn:uuid:c7530596-4919-44e9-9edb-56f21ec0926d</wsa:MessageID><wsa:RelatesTo>urn:uuid:ed4c7951-6e45-41b0-a596-b20ca46a196d</wsa:RelatesTo><wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/a... wsu:Id="Timestamp-706eb5b2-5679-4772-8f70-7e8beeac6642"><wsu:Created>2019-11-13T13:14:17Z</wsu:Created><wsu:Expires>2019-11-13T13:19:17Z</wsu:Expires></wsu:Timestamp></wsse:Security></soap:Header><soap:Body><AuthenticateUserResponse xmlns="http://harlandfs/ECM/Services/Security/"><AuthenticateUserResult>43aa5a43-838c-454b-ba9f-5618061959df</AuthenticateUserResult></AuthenticateUserResponse></soap:Body></soap:Envelope>

0 Likes
4 Replies
Highlighted
Super Contributor.
Super Contributor.

Re: XML generates and string logic

My full program below for your reference.

 

Identification division.
Program-id. One-pro.
Data division.
Working-storage section.
01 Doc-response.
02 Doc-token pic X(80).
01 request-payload usage pointer.
01 response-payload usage pointer.
01 response-status pic 9(3) value zero.
01 response-status-2 pic 9(3) value zero.
01 response-len pic s9(4).
01 request-len pic s9(4).
01 a-single-char pic x.

copy "lixmlall.cpy".

01 Desired-SOAP-Action.
05 filler pic x(10) value 'SOAPAction'.
05 filler pic x value x"00".
05 filler pic x(63) value
"http://harlandfs/ECM/Services/Security/AuthenticateUser".
05 filler pic x value x"00".

78 post-address value
"https://px-demo.avcm.esvccenter.com/services/wse/Authenticat
- "ion.asmx".
78 Content-Type value "text/xml; charset=utf-8".

linkage section.
01 http-response pic x(100).
procedure division.
main.
XML INITIALIZE
if not XML-OK go to z.

XML GET TEXT
request-payload
request-len
"payload2.xml"
IF NOT XML-OK GO TO Z.

call "NetInit"
giving
response-status.

CALL "NetSSLVerifyPeer" USING 0

call "HttpPost"
using
Post-Address
Content-Type
request-payload
request-len
response-payload
response-len
Desired-SOAP-Action
giving
response-status.

set address of http-response to response-payload.

display "Response: ", response-status.

if not response-status = 0
call "NetGetError" using response-payload response-len
giving response-status-2
set address of http-response to response-payload
display "Error! ", response-status
display "Error message: ", http-response(1:response-len)
call "NetFree" using response-payload
go to z
end-if.

XML FREE TEXT
request-payload.

if response-payload = NULL
display "Error: NULL pointer returned", line 10, blink
accept a-single-char prompt
go to z
end-if.

XML PUT TEXT
response-payload
response-len
"Doc-response"
if not XML-OK go to z.

display Doc-token.

call "NetFree"
using
response-payload.

call "NetCleanup"

GOBACK.

z.
copy "lixmltrm.cpy".
display "finished.", line 20 position 5.
accept a-single-char prompt tab.
stop run.
copy "lixmldsp.cpy".

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: XML generates and string logic

Also, i think this we need to play with xml file.

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: XML generates and string logic

while creating response xml-- can we get that data into one variable?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: XML generates and string logic

There a variety of ways to parse XML data using Acu. I would look at using C$XML 

https://www.microfocus.com/documentation/extend-acucobol/1021/extend-Interoperability-Suite/BKITITNONVS027.html

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.