it:ad:soapui:howto:generate_code:server_endpoints

IT:AD:SoapUI:HowTo:Generate Code/Server Endpoints

Summary

SoapUI internally uses IT:AD:WSDL.EXE… which has implications.

Because of all the above issues, consider the following process if you only need to provide Soap1.1 interfaces.

If you need to produce Soap1.2 interfaces consider the following tool instead: * IT:AD:WCSFBlue

Start SoapUI.

Select the endpoint and the option to generate code:

Before doing anything else, ensure the app knows where to find wsdl.exe, by clicking the Tools button:

which shows you the following dialog:

Enter the path to the wsdl.exe file.

To find wsdl.exe, consider using IT:AD:UltraSearch:

When done, return and fill in the rest of the info:

Run it…and get a summary of the actions undertaken:

The result is a Service Interface class:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.6413
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

// 
// This source code was auto-generated by wsdl, Version=2.0.50727.3038.
// 
namespace App.Presentation.API.Soap {
    using System.Xml.Serialization;
    using System.Web.Services;
    using System.ComponentModel;
    using System.Web.Services.Protocols;
    using System;
    using System.Diagnostics;
    
    
    /// <remarks/>
    // CODEGEN: The optional WSDL extension element 'binding' from namespace 'http://schemas.microsoft.com/soap-toolkit/wsdl-extension' was not handled.
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
    [System.Web.Services.WebServiceBindingAttribute(Name="SOAP_2SoapBinding", Namespace="http://tempuri.org/wsdl/")]
    public interface ISOAP_2SoapBinding {
        
        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://tempuri.org/action/SOAP_2.CreateMergeRequest", RequestNamespace="http://tempuri.org/message/", ResponseNamespace="http://tempuri.org/message/")]
        void CreateMergeRequest(string vsSecurityKey, string vsNSN0, string vsNSN1, string vsNSN2, string vsNSN3, string vsNSN4, string vsNSN5, string vsNSN6, string vsNSN7, string vsNSN8, string vsNSN9, string vsUser);
        
        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://tempuri.org/action/SOAP_2.Update", RequestNamespace="http://tempuri.org/message/", ResponseNamespace="http://tempuri.org/message/")]
        [return: System.Xml.Serialization.SoapElementAttribute("Result")]
        string Update(
                    string vsSessionKey, 
                    string vsNSN, 
                    string vsSurname, 
                    string vsForename1, 
                    string vsForename2, 
                    string vsForename3, 
                    string vsDOB, 
                    string vsPreferredName, 
                    string vsNameDOBVerification, 
                    string vsResidentialStatus, 
                    string vsResidentialVerification, 
                    string vsGender, 
                    string vsUser, 
                    string vsAltSurname, 
                    string vsAltForename1, 
                    string vsAltForename2, 
                    string vsAltForename3, 
                    string vsAltPreferredName, 
                    string vsAltNameDobVerification);
        
        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://tempuri.org/action/SOAP_2.Insert", RequestNamespace="http://tempuri.org/message/", ResponseNamespace="http://tempuri.org/message/")]
        [return: System.Xml.Serialization.SoapElementAttribute("Result")]
        string Insert(
                    string vsSecurityKey, 
                    string vsSurname, 
                    string vsForename1, 
                    string vsForename2, 
                    string vsForename3, 
                    string vsDOB, 
                    string vsPreferredName, 
                    string vsNameDOBVerification, 
                    string vsResidentialStatus, 
                    string vsResidentialStatusVerification, 
                    string vsGender, 
                    string vsAlias_lastname, 
                    string vsAlias_forename1, 
                    string vsAlias_forename2, 
                    string vsAlias_forename3, 
                    string vsAlias_prefered, 
                    string vsAlias_NameDOBVerification, 
                    string vsOverride, 
                    string vsUser);
        
        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://tempuri.org/action/SOAP_2.Search", RequestNamespace="http://tempuri.org/message/", ResponseNamespace="http://tempuri.org/message/")]
        [return: System.Xml.Serialization.SoapElementAttribute("Result")]
        string Search(string vsSecurityKey, string vsNSN, string vsName, string vsDOB, string vsGender, string vsResidentialStatus, string vsUser);
        
        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://tempuri.org/action/SOAP_2.Logout", RequestNamespace="http://tempuri.org/message/", ResponseNamespace="http://tempuri.org/message/")]
        void Logout(string vsSecurityKey);
        
        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://tempuri.org/action/SOAP_2.Login", RequestNamespace="http://tempuri.org/message/", ResponseNamespace="http://tempuri.org/message/")]
        [return: System.Xml.Serialization.SoapElementAttribute("Result")]
        string Login(string vsUserId, string vsPassword, int vlOrgId);
    }
}

Repeat the process, but this time without the following checked:

and with the following argument set:

This time, you'll get an abstract base class (note that it inherits from an old pre-WCF WebService class).

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.6413
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

// 
// This source code was auto-generated by wsdl, Version=2.0.50727.3038.
// 
namespace Foo {
    using System.Xml.Serialization;
    using System.Web.Services;
    using System.ComponentModel;
    using System.Web.Services.Protocols;
    using System;
    using System.Diagnostics;
    
    
    /// <remarks/>
    // CODEGEN: The optional WSDL extension element 'binding' from namespace 'http://schemas.microsoft.com/soap-toolkit/wsdl-extension' was not handled.
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
    [System.Web.Services.WebServiceAttribute(Namespace="http://tempuri.org/wsdl/")]
    [System.Web.Services.WebServiceBindingAttribute(Name="SOAP_2SoapBinding", Namespace="http://tempuri.org/wsdl/")]
    public abstract partial class nsi_soap : System.Web.Services.WebService {
        
        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://tempuri.org/action/SOAP_2.CreateMergeRequest", RequestNamespace="http://tempuri.org/message/", ResponseNamespace="http://tempuri.org/message/")]
        public abstract void CreateMergeRequest(string vsSecurityKey, string vsNSN0, string vsNSN1, string vsNSN2, string vsNSN3, string vsNSN4, string vsNSN5, string vsNSN6, string vsNSN7, string vsNSN8, string vsNSN9, string vsUser);
        
        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://tempuri.org/action/SOAP_2.Update", RequestNamespace="http://tempuri.org/message/", ResponseNamespace="http://tempuri.org/message/")]
        [return: System.Xml.Serialization.SoapElementAttribute("Result")]
        public abstract string Update(
                    string vsSessionKey, 
                    string vsNSN, 
                    string vsSurname, 
                    string vsForename1, 
                    string vsForename2, 
                    string vsForename3, 
                    string vsDOB, 
                    string vsPreferredName, 
                    string vsNameDOBVerification, 
                    string vsResidentialStatus, 
                    string vsResidentialVerification, 
                    string vsGender, 
                    string vsUser, 
                    string vsAltSurname, 
                    string vsAltForename1, 
                    string vsAltForename2, 
                    string vsAltForename3, 
                    string vsAltPreferredName, 
                    string vsAltNameDobVerification);
        
        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://tempuri.org/action/SOAP_2.Insert", RequestNamespace="http://tempuri.org/message/", ResponseNamespace="http://tempuri.org/message/")]
        [return: System.Xml.Serialization.SoapElementAttribute("Result")]
        public abstract string Insert(
                    string vsSecurityKey, 
                    string vsSurname, 
                    string vsForename1, 
                    string vsForename2, 
                    string vsForename3, 
                    string vsDOB, 
                    string vsPreferredName, 
                    string vsNameDOBVerification, 
                    string vsResidentialStatus, 
                    string vsResidentialStatusVerification, 
                    string vsGender, 
                    string vsAlias_lastname, 
                    string vsAlias_forename1, 
                    string vsAlias_forename2, 
                    string vsAlias_forename3, 
                    string vsAlias_prefered, 
                    string vsAlias_NameDOBVerification, 
                    string vsOverride, 
                    string vsUser);
        
        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://tempuri.org/action/SOAP_2.Search", RequestNamespace="http://tempuri.org/message/", ResponseNamespace="http://tempuri.org/message/")]
        [return: System.Xml.Serialization.SoapElementAttribute("Result")]
        public abstract string Search(string vsSecurityKey, string vsNSN, string vsName, string vsDOB, string vsGender, string vsResidentialStatus, string vsUser);
        
        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://tempuri.org/action/SOAP_2.Logout", RequestNamespace="http://tempuri.org/message/", ResponseNamespace="http://tempuri.org/message/")]
        public abstract void Logout(string vsSecurityKey);
        
        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://tempuri.org/action/SOAP_2.Login", RequestNamespace="http://tempuri.org/message/", ResponseNamespace="http://tempuri.org/message/")]
        [return: System.Xml.Serialization.SoapElementAttribute("Result")]
        public abstract string Login(string vsUserId, string vsPassword, int vlOrgId);
    }
}

Complete the process by

  • Import the Service file into your solution
  • Inherit from the abstract base class, and make an implementation.
  • Adding to your project a WebService file…
  • Remove the CodeBehind attribute (I think it's not needed – only in WebProject's, not Web Projects…)
  • Change the Service attribute from the default 'WebService1' class it generated (get rid of the class) and point it to your new concrete class.
  • Run it
  • Run SoapUI.
  • Create a new Request to the service <wrap important>make sure you are creating a Soap1.1 request, not a Soap1.2 request>
  • Amazingly, even if there are no Request/Response files, the arguments will be translated correctly.
  • /home/skysigal/public_html/data/pages/it/ad/soapui/howto/generate_code/server_endpoints.txt
  • Last modified: 2023/11/04 23:21
  • by 127.0.0.1