Skip to main content

Hi MicroFocus Community Team,  

I am using ACUGT cobol. 

My requirement is to call below web service and get the pdf document thru webservice and place pdf file on  my local C drive. ..  Any sample program  or manual to study this please?

https://px-demo.avcm.esvccenter.com/services/wse/delivery.asmx

Hi MicroFocus Community Team,  

I am using ACUGT cobol. 

My requirement is to call below web service and get the pdf document thru webservice and place pdf file on  my local C drive. ..  Any sample program  or manual to study this please?

https://px-demo.avcm.esvccenter.com/services/wse/delivery.asmx

No one has clue on this please? Please advise me manual which would b great help.


Hi MicroFocus Community Team,  

I am using ACUGT cobol. 

My requirement is to call below web service and get the pdf document thru webservice and place pdf file on  my local C drive. ..  Any sample program  or manual to study this please?

https://px-demo.avcm.esvccenter.com/services/wse/delivery.asmx

We do not have an example like the scenario you are attempting. You need to use RMNet (which is part of the runtime) along with XML extensions in order to copy the pdf locally.

RMNet is an HTTP client for the extend Runtime, and, it allows your COBOL program to make HTTP requests.  XML Extensions  will allow you to create XML SOAP requests and import XML SOAP responses.

There is an RMNet tutorial - /cobol/acucobol/w/wikiid-122/31850/consume-web-services-with-extend

XML Extensions has functions like XML IMPORT FILE or XML IMPORT TEXT


No one has clue on this please? Please advise me manual which would b great help.

According to the URL you posted, there are two operations permitted: GetURL and GetURLByDocumentIDs

 

The operation GetURL it is expecting method POST and you can see the specifics at the start of the sample request. Replace all the placeholder text with the required information when you are constructing your payload. 

 

 

 

 

 

 

 

Now when you execute the HTTPPOST with the correct payload and payload length you will receive a response containing the URL -  <GetURLResult>string</GetURLResult>

 

Is that URL supposed to be a link to the PDF you mentioned?


According to the URL you posted, there are two operations permitted: GetURL and GetURLByDocumentIDs

 

The operation GetURL it is expecting method POST and you can see the specifics at the start of the sample request. Replace all the placeholder text with the required information when you are constructing your payload. 

 

 

 

 

 

 

 

Now when you execute the HTTPPOST with the correct payload and payload length you will receive a response containing the URL -  <GetURLResult>string</GetURLResult>

 

Is that URL supposed to be a link to the PDF you mentioned?

Hi Martin,

Thanks for info! Now, I got the point now, I can proceed further .

Just one question, once i receive response XML with URL link,  how do i trigger browser in Acu COBOL? 

 


Hi Martin,

Thanks for info! Now, I got the point now, I can proceed further .

Just one question, once i receive response XML with URL link,  how do i trigger browser in Acu COBOL? 

 

Excellent.

 

You could use the web browser control - http://bit.ly/2vacACG

 

Or you could use C$SYSTEM and open the URL in a external browser with the command line "START http://google.com" but obviously replace Google with your URL - http://bit.ly/2DVM4Ca


Excellent.

 

You could use the web browser control - http://bit.ly/2vacACG

 

Or you could use C$SYSTEM and open the URL in a external browser with the command line "START http://google.com" but obviously replace Google with your URL - http://bit.ly/2DVM4Ca

Martin,

I am facing one more challenge in this. Please advise. 

My requirement is I am trying to display document page using URL thru web browser.. My authenticate token is correct. but, i am getting XML output as "bad request"

my Acu cobol program

Identification division.
Program-id. avcm-program1.
Data division.
Working-storage section.
01 CMD-LINE pic X(300).
01 EXIT-STATUS pic x(2).
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(56) VALUE
"">harlandfs/.../GetURLByDocumentIDs".
05 FILLER PIC X VALUE x"00".

78 Post-Address VALUE
"https://px-demo.avcm.esvccenter.com/services/wse/delivery.a
- "smx".

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
"avcm-request-frm-cobol1.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
"CMD-LINE"
if not XML-OK go to z.

CALL "C$SYSTEM"
USING CMD-LINE
GIVING EXIT-STATUS.

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 Input  xml file

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sear="">harlandfs/.../">
<soapenv:Header>
<sear:AuthTicket>
<!--Optional:-->
<sear:AuthenticatedTicket>29cc8928-feb6-4f7f-8e70-ed56153d80f2</sear:AuthenticatedTicket>
</sear:AuthTicket>
</soapenv:Header>
<soapenv:Body>
<sear:GetURLByDocumentIDs>
<!--Optional:-->
<sear:DocumentIds>
<!--Zero or more repetitions:-->
<sear:int>658405</sear:int>
</sear:DocumentIds>
<!--Optional:-->
<sear:DocumentRequest>
<!--Optional:-->
<sear:Parameters>
<!--Zero or more repetitions:-->
<sear:DeliveryParameter>
<!--Optional:-->
<sear:Section>Format</sear:Section>
<!--Optional:-->
<sear:Name>Description</sear:Name>
<!--Optional:-->
<sear:Value>PDF</sear:Value>
</sear:DeliveryParameter>
</sear:Parameters>
</sear:DocumentRequest>
</sear:GetURLByDocumentIDs>
</soapenv:Body>
</soapenv:Envelope>

 

my output is below.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request</h2>
<hr><p>HTTP Error 400. The request is badly formed.</p>
</BODY></HTML>

 

 


Martin,

I am facing one more challenge in this. Please advise. 

My requirement is I am trying to display document page using URL thru web browser.. My authenticate token is correct. but, i am getting XML output as "bad request"

my Acu cobol program

Identification division.
Program-id. avcm-program1.
Data division.
Working-storage section.
01 CMD-LINE pic X(300).
01 EXIT-STATUS pic x(2).
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(56) VALUE
"">harlandfs/.../GetURLByDocumentIDs".
05 FILLER PIC X VALUE x"00".

78 Post-Address VALUE
"https://px-demo.avcm.esvccenter.com/services/wse/delivery.a
- "smx".

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
"avcm-request-frm-cobol1.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
"CMD-LINE"
if not XML-OK go to z.

CALL "C$SYSTEM"
USING CMD-LINE
GIVING EXIT-STATUS.

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 Input  xml file

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sear="">harlandfs/.../">
<soapenv:Header>
<sear:AuthTicket>
<!--Optional:-->
<sear:AuthenticatedTicket>29cc8928-feb6-4f7f-8e70-ed56153d80f2</sear:AuthenticatedTicket>
</sear:AuthTicket>
</soapenv:Header>
<soapenv:Body>
<sear:GetURLByDocumentIDs>
<!--Optional:-->
<sear:DocumentIds>
<!--Zero or more repetitions:-->
<sear:int>658405</sear:int>
</sear:DocumentIds>
<!--Optional:-->
<sear:DocumentRequest>
<!--Optional:-->
<sear:Parameters>
<!--Zero or more repetitions:-->
<sear:DeliveryParameter>
<!--Optional:-->
<sear:Section>Format</sear:Section>
<!--Optional:-->
<sear:Name>Description</sear:Name>
<!--Optional:-->
<sear:Value>PDF</sear:Value>
</sear:DeliveryParameter>
</sear:Parameters>
</sear:DocumentRequest>
</sear:GetURLByDocumentIDs>
</soapenv:Body>
</soapenv:Envelope>

 

my output is below.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request</h2>
<hr><p>HTTP Error 400. The request is badly formed.</p>
</BODY></HTML>

 

 

Your XML input does not look like it matches what the web service is expecting - https://px-demo.avcm.esvccenter.com/services/wse/delivery.asmx?op=GetURLByDocumentIDs

 

You would be better asking your web service support team why you are receiving that error. The error is with  regards the payload format and not an error in RMNET.


Your XML input does not look like it matches what the web service is expecting - https://px-demo.avcm.esvccenter.com/services/wse/delivery.asmx?op=GetURLByDocumentIDs

 

You would be better asking your web service support team why you are receiving that error. The error is with  regards the payload format and not an error in RMNET.

Martin,

Thanks for reply!

No, Soap UI returns the below web service as  expected URL result. Seems to issues with  my cobol program .

https://px-demo.avcm.esvccenter.com/services/wse/delivery.asmx


Martin,

Thanks for reply!

No, Soap UI returns the below web service as  expected URL result. Seems to issues with  my cobol program .

https://px-demo.avcm.esvccenter.com/services/wse/delivery.asmx

The URL is correct. The XML payload is incorrect. You should check it and make sure it matches.


The URL is correct. The XML payload is incorrect. You should check it and make sure it matches.

Soap UI generated xml and same has been used in XML payload. But no luck., Soap UI got successful URL.


Soap UI generated xml and same has been used in XML payload. But no luck., Soap UI got successful URL.

Attached my payload xml and soap UI XML ...there is no issue with my payload XML.

Only issue with my program code.  Content type might casue issue?   Any clue please? please check once. 


Attached my payload xml and soap UI XML ...there is no issue with my payload XML.

Only issue with my program code.  Content type might casue issue?   Any clue please? please check once. 

Please ignore last attachment.... here i attached correct one


Please ignore last attachment.... here i attached correct one

IN my cobol program below code might cause issue

78 Content-Type value "text/xml; charset=utf-8".


IN my cobol program below code might cause issue

78 Content-Type value "text/xml; charset=utf-8".

Your program works fine. Your XML payload is the issue. I used your exact program and the following payload and it works and I receive the URL.

 

<?xml version="1.0" encoding="utf-8"?>
  <soap:Header>
    <AuthTicket xmlns="">harlandfs/.../">
      <AuthenticatedTicket>0e4e22bf-6c9a-4fed-aeb0-2a672226c304</AuthenticatedTicket>
    </AuthTicket>
  </soap:Header>
  <soap:Body>
    <GetURLByDocumentIDs xmlns="">harlandfs/.../">
      <DocumentIds>
        <int>658405</int>
      </DocumentIds>
      <DocumentRequest>
        <Parameters>
          <DeliveryParameter>
            <Section>Format</Section>
            <Name>Description</Name>
            <Value>PDF</Value>
          </DeliveryParameter>
        </Parameters>
      </DocumentRequest>
    </GetURLByDocumentIDs>
  </soap:Body>
</soap:Envelope>

Your program works fine. Your XML payload is the issue. I used your exact program and the following payload and it works and I receive the URL.

 

<?xml version="1.0" encoding="utf-8"?>
  <soap:Header>
    <AuthTicket xmlns="">harlandfs/.../">
      <AuthenticatedTicket>0e4e22bf-6c9a-4fed-aeb0-2a672226c304</AuthenticatedTicket>
    </AuthTicket>
  </soap:Header>
  <soap:Body>
    <GetURLByDocumentIDs xmlns="">harlandfs/.../">
      <DocumentIds>
        <int>658405</int>
      </DocumentIds>
      <DocumentRequest>
        <Parameters>
          <DeliveryParameter>
            <Section>Format</Section>
            <Name>Description</Name>
            <Value>PDF</Value>
          </DeliveryParameter>
        </Parameters>
      </DocumentRequest>
    </GetURLByDocumentIDs>
  </soap:Body>
</soap:Envelope>

Great Martin! Excellent Job. 

But, i did not get luck. I am still trying and getting below error.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request</h2>
<hr><p>HTTP Error 400. The request is badly formed.</p>
</BODY></HTML>

 

 


Great Martin! Excellent Job. 

But, i did not get luck. I am still trying and getting below error.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request</h2>
<hr><p>HTTP Error 400. The request is badly formed.</p>
</BODY></HTML>

 

 

I used your same pay load xml which you mentioned above.no luck


I used your same pay load xml which you mentioned above.no luck

Also, did you modify my cobol program and tried??


Also, did you modify my cobol program and tried??

Any chance to debug this?? I am totally confused why not working in my PC.


Any chance to debug this?? I am totally confused why not working in my PC.

I did not modify your program at all. I only changed the XML payload as shown previously. I would suggest reaching out to our professional services for assistance. They can show you exactly how to develop your program to work with web services and how to construct a valid payload. You can contact your account manager at Micro Focus or the Sales team to enquire about professional services.

 

Thank you


I did not modify your program at all. I only changed the XML payload as shown previously. I would suggest reaching out to our professional services for assistance. They can show you exactly how to develop your program to work with web services and how to construct a valid payload. You can contact your account manager at Micro Focus or the Sales team to enquire about professional services.

 

Thank you

Ok Thanks Martin, will inform my manager.