• Phil Ly

Web Enabling with ASP.NET and SOAP/AM – Part 2 – Step by Step Example

In my previous article (Learning Tools), I showed you how to download the Web Developer Express tool that you can use for web enabling. In this article, I will guide you through the steps for creating a simple ASP.NET example that can be used to Web-enable your NonStop application.

1. Build the Web Form (5 minutes)

A Simple ASP.NET Application

For this tutorial, I am using a very simple “logon” example to demonstrate how an ASP.NET application can interface to a simple NonStop server. This is what the user interface looks like. Simple ASP.NET page (1 minute video)

The rest of this article focuses on some of the steps needed to create such an ASP.NET application to communicate with a NonStop application using SOAPam.

Create an ASP.NET Web Application

First, you will need to start Visual Web Express and create a new project.

After Visual Web Developer (VWD) is loaded:

  1. Click on “New Project”

  2. Click “ASP.NET Web Application”

  3. Type in project name (I used “SimpleLogon” in this screen capture)

Create an ASP.NET Form

Form is the user interface part of ASP.NET. For our demo, we are going to build a very simple ASP.NET form that  captures the user input and calls the SOAPam Web Service on the NonStop. Creating a simple ASP.NET Form (3 minute video)

2. Set up communication between the Web and Server (5 minutes)

Make sure you have the WSDL

As I pointed out in my  “SOA 101” PPT presentation, WSDL (Web Service Description Language) is the blueprint of how a published Web Service can be accessed. A WSDL is usually generated by the Web Service tool on the platform, and doesn’t require any manual coding.

If you use SOAPam Server on the NonStop platform, you can generate the WSDL very easily by using the SOAPam Control Panel. Here is a video clip of how a NonStop program can be exposed as a Web Service by using SOAPam to create a WSDL. How to create a WSDL using SOAPam (3 minute video)

Importing the WSDL

Now that you have the WSDL ready, you will be able to add that as a “reference” to your project. That means your application can now “call” that server simply by using that reference name. Your program doesn’t know or care where that server resides, because the Web Service Interface makes it all transparent, which is exactly the beauty of this technology.

There are two ways to add the WSDL as a reference to be used by your program: Web Reference or Service Reference. For most practical purposes, they serve the same function, but if you are really interested in their technical differences, check out this Microsoft forum discussion.

I suggest that you use Web Reference when communicating with the NonStop. Here is a short video of what is involved in adding this web reference to your .NET project. How to add a web reference (2 minute video)

Using the Reference

Once the reference is created, your application can then use it to call the Web service and pass it the necessary input parameters (as required by the request IPM) and retrieve the reply parameters (as returned in the reply IPM).  Of course, before you do that, your application will need to go through the standard housekeeping activities common in all programs.

When the “Logon” button is clicked, the program branches to the “clicked” event routine to execute the code, which is explained below.

Here are the steps performed by the code behind this ASP.NET form:

  1. Create/declare local variables that map to the:

  2. Request

  3. Reply

  4. Web Service

  5. Populate the Request (input) parameters by:

  6. getting them from the user input (as we do for the 3 input fields in our case); or

  7. populating them programmatically (e.g., we could have hidden the request_code “101” field from the user)

  8. Call the Web Service by:

  9. invoking the METHOD (logon) in the Web service (logonClient)

  10. including the input parameters (logonReq structure)

  11. Extract the needed output from the returned reply (logonReply)

  12. In our case, we are populating the screen fields (Reply Code and Reply Detail) with the returned parameters  (reply_code and status_msg)

  13. Note that the reply actually has another returned parameter (status_code) that we did not use

Summary

So that’s it! That’s how simple it is for an ASP.NET or Windows .NET application to communicate to the NonStop using Web Service. Think about all the things that you DON’T have to do by using Web Service, like:

  1. trying to debate what protocols to use (HTTP and SOAP are standard)

  2. encryption (HTTPS is built-in)

  3. worrying about data mapping issues (XML and WSDL take care of that)

  4. creating code to handle protocol and error recovery (.NET generates all the necessary proxies for you)

And using SOAPam on the NonStop makes it so easy to “Web service-enable” your applications.

What’s next?

The best way to learn something is by doing. So I would suggest that you:

  1. Get some hands-on experience with Visual Web Developer by using some simple samples and resources available on http://www.asp.net

  2. Pick a simple Web Service (WSDL) on the Internet to work with, such as the weather services available from Cdyne

  3. Contact TIC for an evaluation copy of SOAPam Server and see it how it works on your NonStop system!

Next blog topic: Web Application Security: I will discuss important security information that you need to know to prevent your Web application or your Web-enabled NonStop programs from being compromised by external or internal hackers.

Feedback please Do you find this tutorial blog helpful? Let us know what you think, and how we can make it even better. Don’t forget, you can subscribe to our blogs (top right-hand corner of the home page) to get automatic email notification when a new blog is available.

 

TIC Software, a New York-based company specializing in software and services that integrate NonStop with the latest technologies, including Web Services, .NET and Java. Prior to founding TIC in 1983, Phil worked for Tandem Computer in technical support and software development.

#HPENonStop #NonStop #SOAP #TICSoftware

0 views0 comments

Recent Posts

See All