.NET

A service that has already been prepared as an HTTP Web service does not need to be further modified for use as a WebSphere MQ Web service but it does need to be redeployed through a SOAP/WebSphere MQ deployment process. If the service code has not previously been prepared an HTTP Web service modify it to declare it as a web service and to identify how each method's parameters should be formatted. You must also check that any arguments to the methods of the service are compatible with the environment. Figure 4 shows a .NET class that has been prepared as a web service. The additions made are shown in bold type.

Figure 4. Example of .NET service programming
<%@ WebService Language="C#" Class="StockQuoteDotNet" %>

using System;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Services.Description;
using System.Threading;

[WebService (Namespace="http://dotnet.server")]
public class StockQuoteDotNet {

     [WebMethod] [SoapRpcMethod]
     public float getQuote(String symbol) {
          if (symbol.ToUpper().Equals("DELAY")) Thread.Sleep(5000);
          return 88.88F;
     }

     [WebMethod]
     public float getQuoteDOC(String symbol) {
          return 77.77F;
     }
}

If the web service uses classes that are external to the .NET infrastructure and the SOAP/WebSphere MQ run time environment, write and build the service source code as non-inline. This means the source for the service is separated from the asmx file. The asmx file must declare the name of the associated source file with the "codebehind" keyword and the source must be compiled prior to deployment.

A sample non-inline service program is supplied with WebSphere MQ transport for SOAP. This is the SQCS2DNNonInline sample described in Samples for .NET.