Writing and Deploying a .NET (C Sharp) Client Wrapper for a RPC-encoded Web Service

Writing a .NET wrapper for non-WS-I-compliant Web services requires that you have the proper environment configured on your computer. This example uses Microsoft Visual Studio 2008, although there are other options available.

Requirements

Basic steps

  1. Write the wrapper Web service
  2. Use the new Web service in Process Designer
  3. Deploy and test the wrapped service

Write the wrapper Web service

You can find instructions for creating an ASP .NET Web service in Visual Web Developer here.

  1. Open Visual Studio and create a Web service in IIS, following the instructions in the document linked to above. Name the web site CICSAcctsDemoWrappedService.

    IIS Location Dialog Box

  2. From the View menu, open Solution Explorer. Add a new Web service named CICSAcctsDemoWrappedService.

    Add Item Dialog Box

  3. To add a Web reference to the VHI 6.5 CICSAcctsDemo RPC-encoded Web service, right-click on the project in Solution Explorer and select Add Web Reference, then enter the URL to the VHI Web service and click Go . The Web service loads and displays the available operations. Click Add Reference.

    Add Web Reference Dialog Box

    Solution Explorer should display the newly imported service as a reference:

    Solution Explorer

  4. Add a "using" statement to the top of the CICSAcctsDemoWrappedService.cs file to import the new namespace.

  5. Modify the existing CICSAcctsDemoWrappedService class:

Sample code for the CICSAcctsDemoSessionService class

// sample code for the CICSAcctsDemoSessionService class
using System;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;

using lessp_2k3srv_vm;
/// <summary>
/// Summary description for CICSAcctsDemoWrappedService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
public class CICSAcctsDemoWrappedService : System.Web.Services.WebService {
    private CICSAcctsDemoSessionService service;
    public CICSAcctsDemoWrappedService () {
        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
        service = new CICSAcctsDemoSessionService();
    }
    [WebMethod]
    public GetAccountDetailRecord[] GetAccountDetail(int acctNum) {
        return service.getAccountDetail(acctNum);
    }
    
}
////////////////////////////////////////////////////////////////////////

You can test the new Web service using the instructions in the document linked to above. There should be one operation, GetAccountDetail.

Use the new Web service in Process Designer

The steps you follow to use the Web service are basically the same steps you follow to test and deploy any other Web service in Process Designer.

  1. Open the Process Design Studio and create a new project.

    Import Service

  2. Select Import a service from the Internet and choose the CICSAcctsDemoWrappedService.asmx?WSDL. Click Next.

  3. Complete importing the service using the values below:

    Name and Confirm

  4. Modify the default project to call the Get Account Detail operation.

    Create Copy Rule

  5. When you are prompted to generate an initializer, click Yes.

    Initialize Variable

  6. Verify that the Include Optional Content setting is selected. Do not clear this option.

    Initialize Variable

Deploy and test the wrapped service

The instructions for deploying and testing the wrapped service are the same as those you'd use with any Process Designer Web service. See online help topic, How to Deploy Your Service.

  1. From the File menu, select Deploy to Process Server.
  2. Enter the name of the Process Server, and if required, supply the needed credentials.
  3. When the deployment completes, click Test Service to launch the Web Services Explorer where you can test your service.

    Web Services Explorer

Related Topics
Bullet Using Non-WS-I Compliant Web Services
Bullet Writing a Java Client Wrapper for a RPC-encoded Web Service
Bullet Importing Web Services