Skip to main content

Below is a program, that i am getting XML-OK value as "30" while execution. Any advise please? my requirement is to pass username and password to web service and return response as token. I am trying web service first time in acucobolgt cobol.

Procedure division.
main.
stop ' '
XML INITIALIZE.
XML EXPORT FILE
Doc-Authentication
"Authrequest.xml"
"Doc-Authentication"
"AuthrequestF2C.xsl".
if not XML-OK go to z.

 

MY full program below.

=============================

Identification division.
Program-id. Test.
Data division.
Working-storage section.
01 Doc-Authentication.
02 Doc-User Pic X(13) value 'Tester'.
02 Doc-Pwd Pic X(09) value '123456'.
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(90) value
'"'.">harlandfs/.../ExecuteSearch"'.
05 filler pic x value x"00".

01 Post-Address pic x(63) value
"https://px-demo.avcm.esvccenter.com/services/wse/WebSearch
- ".asmx".
01 Content-Type pic X(25) value "text/xml; charset=utf-8".
linkage section.
01 http-response pic x(100).

procedure division.
main.
stop ' '
XML INITIALIZE.
XML EXPORT FILE
Doc-Authentication
"Authrequest.xml"
"Doc-Authentication"
"AuthrequestF2C.xsl".
if not XML-OK go to z.

XML EXPORT TEXT
Doc-Authentication
request-payload
response-len
"Doc-Authentication"
"AuthrequestF2C.xsl".
if not XML-OK go to z.

call "NetInit"
giving
response-status.

call "NetSetSSLCA" using "ca-bundle.crt".

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
"AuthResponse.xml".
if not XML-OK go to z.

XML IMPORT TEXT
Doc-response
response-payload
response-len
"Doc-response"
"AuthResponseF2C.xsl".
if not XML-OK go to z.

call "NetFree"
using
response-payload.

call "NetCleanup".

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

Below is a program, that i am getting XML-OK value as "30" while execution. Any advise please? my requirement is to pass username and password to web service and return response as token. I am trying web service first time in acucobolgt cobol.

Procedure division.
main.
stop ' '
XML INITIALIZE.
XML EXPORT FILE
Doc-Authentication
"Authrequest.xml"
"Doc-Authentication"
"AuthrequestF2C.xsl".
if not XML-OK go to z.

 

MY full program below.

=============================

Identification division.
Program-id. Test.
Data division.
Working-storage section.
01 Doc-Authentication.
02 Doc-User Pic X(13) value 'Tester'.
02 Doc-Pwd Pic X(09) value '123456'.
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(90) value
'"'.">harlandfs/.../ExecuteSearch"'.
05 filler pic x value x"00".

01 Post-Address pic x(63) value
"https://px-demo.avcm.esvccenter.com/services/wse/WebSearch
- ".asmx".
01 Content-Type pic X(25) value "text/xml; charset=utf-8".
linkage section.
01 http-response pic x(100).

procedure division.
main.
stop ' '
XML INITIALIZE.
XML EXPORT FILE
Doc-Authentication
"Authrequest.xml"
"Doc-Authentication"
"AuthrequestF2C.xsl".
if not XML-OK go to z.

XML EXPORT TEXT
Doc-Authentication
request-payload
response-len
"Doc-Authentication"
"AuthrequestF2C.xsl".
if not XML-OK go to z.

call "NetInit"
giving
response-status.

call "NetSetSSLCA" using "ca-bundle.crt".

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
"AuthResponse.xml".
if not XML-OK go to z.

XML IMPORT TEXT
Doc-response
response-payload
response-len
"Doc-response"
"AuthResponseF2C.xsl".
if not XML-OK go to z.

call "NetFree"
using
response-payload.

call "NetCleanup".

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

I would check the permissions and location of the XSL file first.

 

30 Error - in function: LoadStyleSheet An error was detected while trying to load an internal or external XSLT stylesheet. This normally means that there was a problem locating the document (either the document does not exist or there is a problem with permissions). Another possible cause is that the XML parser software is not properly installed.

 

Summary of Error Messages - http://bit.ly/2P9wK7t