Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Highlighted
josephgilbat Respected Contributor.
Respected Contributor.
173 views

Need advise on XML AcuGT cobol

Jump to solution

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

0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Re: Need advise on XML AcuGT cobol

Jump to solution

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

---
Martin Turner
Product Support Engineer
Micro Focus
0 Likes
20 Replies
josephgilbat Respected Contributor.
Respected Contributor.

Re: Need advise on XML AcuGT cobol

Jump to solution

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

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Need advise on XML AcuGT cobol

Jump to solution

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 - https://community.microfocus.com/t5/Extend-and-ACUCOBOL-Knowledge/Consume-web-services-with-extend/ta-p/1738915

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

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Need advise on XML AcuGT cobol

Jump to solution

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. 

08-11-19-MT-183.png

 

 

 

 

 

 

 

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?

---
Martin Turner
Product Support Engineer
Micro Focus
0 Likes
josephgilbat Respected Contributor.
Respected Contributor.

Re: Need advise on XML AcuGT cobol

Jump to solution

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? 

 

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Need advise on XML AcuGT cobol

Jump to solution

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 Turner
Product Support Engineer
Micro Focus
0 Likes
josephgilbat Respected Contributor.
Respected Contributor.

Re: Need advise on XML AcuGT cobol

Jump to solution

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
"http://harlandfs/ECM/Services/Search/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="http://harlandfs/ECM/Services/Search/">
<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>

 

 

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Need advise on XML AcuGT cobol

Jump to solution

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 Turner
Product Support Engineer
Micro Focus
0 Likes
josephgilbat Respected Contributor.
Respected Contributor.

Re: Need advise on XML AcuGT cobol

Jump to solution

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

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Need advise on XML AcuGT cobol

Jump to solution

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

---
Martin Turner
Product Support Engineer
Micro Focus
0 Likes
josephgilbat Respected Contributor.
Respected Contributor.

Re: Need advise on XML AcuGT cobol

Jump to solution

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

0 Likes
josephgilbat Respected Contributor.
Respected Contributor.

Re: Need advise on XML AcuGT cobol

Jump to solution

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. 

0 Likes
josephgilbat Respected Contributor.
Respected Contributor.

Re: Need advise on XML AcuGT cobol

Jump to solution

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

0 Likes
josephgilbat Respected Contributor.
Respected Contributor.

Re: Need advise on XML AcuGT cobol

Jump to solution

IN my cobol program below code might cause issue

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

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Need advise on XML AcuGT cobol

Jump to solution

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="http://harlandfs/ECM/Services/Search/">
      <AuthenticatedTicket>0e4e22bf-6c9a-4fed-aeb0-2a672226c304</AuthenticatedTicket>
    </AuthTicket>
  </soap:Header>
  <soap:Body>
    <GetURLByDocumentIDs xmlns="http://harlandfs/ECM/Services/Search/">
      <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>
---
Martin Turner
Product Support Engineer
Micro Focus
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.