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.
TonyLeBlanc Super Contributor.
Super Contributor.
1501 views

Consuming a BIS web service from Extend Cobol program

Jump to solution

We have several web services running using BIS/IIS in a test environment; we're able to consume those services from C# and from ASP web pages.  We need to ensure we can consume them with an Extend Cobol program as well - first attempts were abysmal (no doubt reflecting lack of understanding of XML extensions).  Is there a sample program provided with BIS which demonstrates consuming a BIS web service?

0 Likes
1 Solution

Accepted Solutions
Knowledge Partner
Knowledge Partner

RE: Consuming a BIS web service from Extend Cobol program

Jump to solution

Hi Tony,

As far as I am aware, there is no super-easy way of doing this - nothing like the automated creation of WSDL and request/response processing found in the creation of a BIS web service.  This is no doubt due to the fact that consumption of web services from existing COBOL programs is less in demand.

There is nothing special about a BIS web service that distinguishes it from other SOAP web services.  What I have always done is to use a SOAP testing tool - typically soapUI - to get exemplars of the request and response that you then craft into XSLT to be used for consuming the web service.

Point soapUI at the web service to fetch the WSDL.  When soapUI processes the WSDL it creates an exemplar of the SOAP request, with question marks as placeholders for the data that must be provided in the request.  Copy the XML exemplar to a text editor.  Now, to create an XSL from this XML, wrap the XML in a stylesheet and template declarations as follows:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="utf-8"/>
<xsl:template match="/">
XML request exemplar here
</xsl:template
>
</xsl:stylesheet>
 

Now go through the XML request exemplar replacing all the '?' with - typically - <xsl:value-of> instructions that will pull data from the raw XML document that can be seen by exporting your data structure with no stylesheet.  If you are processing arrays, you will probably need to turn to <xsl:for-each> to iterate through repeating data.  A total example is probably not practical here, but I hope you get the idea.

You can also use the XML response obtained by soapUI in a similar manner to create an XSLT that will pull data from the response into an XML document that matches your data structure used to import the data returned by the web service.

XSLT editors (I use Stylus Studio) make this XSLT creation a bit easier.  Stylus Studio can use the XML exemplar obtained from soapUI and another obtained from XML Extensions in a visual mapping tool.  However, I typically just use the text editor because the process, once learned, is quite straightforward. 

I hope this helps.


Tom Morrison
Consultant

View solution in original post

0 Likes
3 Replies
Knowledge Partner
Knowledge Partner

RE: Consuming a BIS web service from Extend Cobol program

Jump to solution

Hi Tony,

As far as I am aware, there is no super-easy way of doing this - nothing like the automated creation of WSDL and request/response processing found in the creation of a BIS web service.  This is no doubt due to the fact that consumption of web services from existing COBOL programs is less in demand.

There is nothing special about a BIS web service that distinguishes it from other SOAP web services.  What I have always done is to use a SOAP testing tool - typically soapUI - to get exemplars of the request and response that you then craft into XSLT to be used for consuming the web service.

Point soapUI at the web service to fetch the WSDL.  When soapUI processes the WSDL it creates an exemplar of the SOAP request, with question marks as placeholders for the data that must be provided in the request.  Copy the XML exemplar to a text editor.  Now, to create an XSL from this XML, wrap the XML in a stylesheet and template declarations as follows:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="utf-8"/>
<xsl:template match="/">
XML request exemplar here
</xsl:template
>
</xsl:stylesheet>
 

Now go through the XML request exemplar replacing all the '?' with - typically - <xsl:value-of> instructions that will pull data from the raw XML document that can be seen by exporting your data structure with no stylesheet.  If you are processing arrays, you will probably need to turn to <xsl:for-each> to iterate through repeating data.  A total example is probably not practical here, but I hope you get the idea.

You can also use the XML response obtained by soapUI in a similar manner to create an XSLT that will pull data from the response into an XML document that matches your data structure used to import the data returned by the web service.

XSLT editors (I use Stylus Studio) make this XSLT creation a bit easier.  Stylus Studio can use the XML exemplar obtained from soapUI and another obtained from XML Extensions in a visual mapping tool.  However, I typically just use the text editor because the process, once learned, is quite straightforward. 

I hope this helps.


Tom Morrison
Consultant

View solution in original post

0 Likes
TonyLeBlanc Super Contributor.
Super Contributor.

RE: Consuming a BIS web service from Extend Cobol program

Jump to solution

Thanks, Tom - I think I followed your explanation, and I'll give that a try (as soon as i dig out of this week's crises)!

Tony

0 Likes
Knowledge Partner
Knowledge Partner

RE: Consuming a BIS web service from Extend Cobol program

Jump to solution

Note that I changed the method attribute in the <xsl:output> from html (in the original post) to xml.  

I too am a bit under water this week.


Tom Morrison
Consultant

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.