# IT:AD:SoapUI:HowTo:Generate Code/Server Endpoints # * [[../|(UP)]] {{indexmenu>.#2|nsort tsort}} SoapUI internally uses [[IT/AD/WSDL.exe/]]... which has implications. * [[IT/AD/WSDL.exe/]] is depracated and superceded by [[IT/AD/SVCUTIL/]].exe. * [[IT/AD/WSDL.exe/]] isn't good for much else than producing SOAP1.1 WebServices (ie, the early stuff that existed before WCF). * Even if SoapUI gets updated to use [[IT/AD/SVCUTIL/]].exe, [[IT/AD/SVCUTIL/]].exe is geared towards producing *client* code -- not *server* side code. 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/]] ## Process ## Start SoapUI. Select the endpoint and the option to generate code: ![](https://dl.dropboxusercontent.com/u/11851202/Posted/IT/About/SoapUI/GenerateCode01.png) Before doing anything else, ensure the app knows where to find `wsdl.exe`, by clicking the `Tools` button: ![](https://dl.dropboxusercontent.com/u/11851202/Posted/IT/About/SoapUI/GenerateCode02.png) which shows you the following dialog: ![](https://dl.dropboxusercontent.com/u/11851202/Posted/IT/About/SoapUI/GenerateCode03.png) Enter the path to the `wsdl.exe` file. To find wsdl.exe, consider using [[IT/AD/UltraSearch/]]: ![](https://dl.dropboxusercontent.com/u/11851202/Posted/IT/About/UltraSearch/ResultsScreen.png) When done, return and fill in the rest of the info: ![](https://dl.dropboxusercontent.com/u/11851202/Posted/IT/About/SoapUI/GenerateCode04.png) Run it...and get a summary of the actions undertaken: ![](https://dl.dropboxusercontent.com/u/11851202/Posted/IT/About/SoapUI/GenerateCode07.png) ### The First Output The result is a Service *Interface* class: //------------------------------------------------------------------------------ // // 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. // //------------------------------------------------------------------------------ // // 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; /// // 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 { /// [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); /// [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); /// [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); /// [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); /// [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); /// [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); } } ### The Second Result... Repeat the process, but this time without the following checked: ![](https://dl.dropboxusercontent.com/u/11851202/Posted/IT/About/SoapUI/GenerateCode08.png) and with the following argument set: ![](https://dl.dropboxusercontent.com/u/11851202/Posted/IT/About/SoapUI/GenerateCode09.png) This time, you'll get an abstract base class (note that it inherits from an old pre-WCF `WebService` class). //------------------------------------------------------------------------------ // // 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. // //------------------------------------------------------------------------------ // // 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; /// // 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 { /// [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); /// [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); /// [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); /// [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); /// [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); /// [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 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.