Skip to main content

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="docs.oasis-open.org/.../wsa:To><wsse:Security><wsu:Timestamp 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="">harlandfs/.../"><AuthenticateUserResult>43aa5a43-838c-454b-ba9f-5618061959df</AuthenticateUserResult></AuthenticateUserResponse></soap:Body></soap:Envelope>

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="docs.oasis-open.org/.../wsa:To><wsse:Security><wsu:Timestamp 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="">harlandfs/.../"><AuthenticateUserResult>43aa5a43-838c-454b-ba9f-5618061959df</AuthenticateUserResult></AuthenticateUserResponse></soap:Body></soap:Envelope>

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
"">harlandfs/.../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".


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
"">harlandfs/.../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".

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


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

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


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="docs.oasis-open.org/.../wsa:To><wsse:Security><wsu:Timestamp 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="">harlandfs/.../"><AuthenticateUserResult>43aa5a43-838c-454b-ba9f-5618061959df</AuthenticateUserResult></AuthenticateUserResponse></soap:Body></soap:Envelope>

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