Skip to main content
How to fix the problem when referencing a web service in K2Studio with Methods using Typed Datasets as return types or as parameters.

In order for you to understand, I will explain how we reference a web service in K2.net Studio:

Step1: Create a WSDL file by using the Disco.exe (To be found in the MS.net Framework SDK tools systemrootMicrosoft.NETSDKv1.1Bin)

Step2: Create a C# library(css file) from the created WSDL file by using the WSDL.exe file(To be found in the MS.net Framework SDK tools systemrootMicrosoft.NETSDKv1.1Bin)

Step3: Create the Proxy Dll from the C# library using the CSC.exe (C:WindowsMicrosoft.NetFrameWorkV1.1.4322)

Step4: Reference the Proxy Dll in K2.net Studio to create a reference to the Specific Web service.

I have found however as shown in the news group discussion below that there is a bug in the way Microsoft creates the C# library in the WSDL.exe when using a Typed Dataset as a return type or Parameter:

http://groups.google.com/groups?hl=en&lr=&threadm=O9vE9JS1DHA.3824%40TK2MSFTNGP11.phx.gbl&rnum=1&prev=/groups%3Fq%3DTyped%2BdataSet%2BXMLElement%26hl%3Den%26lr%3D%26selm%3DO9vE9JS1DHA.3824%2540TK2MSFTNGP11.phx.gbl%26rnum%3D1

The only way to solve the problem is to create a Proxy dll manually and referencing it in K2.net Studio. This can be done by following the steps as described below

Step1: Download and install the Web Services Enhancements (WSE) 2.0 SP1 for Microsoft .NET

http://www.microsoft.com/downloads/details.aspx?FamilyId=FC5F06C5-821F-41D3-A4FE-6C7B56423841&displaylang=en

(Choose the Visual Studio Developer option when installing)

After installing you will see in the Readme that one of the following changes were made in a tool called WseWsdl2:

WseWsdl2 tool changes:

Generated proxy classes for Web service methods that use a DataSet type for a parameter or return value, now use the DataSet type as the Web service method. Previously, the proxy class would generate the System.Xml.XmlElement type for DataSet types.

Step2: Create the WSDL file needed by running the Disco.exe in the CMD line:

Disco.exe WebServiceURL Target Directory

The file with WSDL extension will be created at the Target Directory

Step3: Use the installed WseWsdl2.exe tool to create the C# library from the created WSDL file in Step2

File can be found in the C:Program FilesMicrosoft WSEv2.0ToolsWsdl directory

Run in CMD line: WseWsdl2.exe "C:Target Directoryservice1.wsdl" "C:TargetDirectoryCSharpLib.cs""

Step4: Open the created C# library in VS.net.
Add the following references in VS.net: Microsoft.Web.Services2
System.Web

You should be able to compile the C# lib to a proxy dll using VS.net.

Step5: Reference your created Proxy Dll in K2.net Studio
Also add the following 2 references in your K2 Project: Microsoft.Web.Services2
System.Web

Call your code as the code Snippet show below:
Dim myService As New DataSetService
Dim oResponse As GetDataSetResponse
Dim oRequest As New GetDataSet
oResponse = myService.GetDataSet(oRequest)
Console.WriteLine(oResponse.GetDataSetResult.Employees(0).FirstName)

Step6: Compile and Export your Process.
Error in running Step 3 as follows:
An error occurred processing this WSDL. More information:

System.InvalidCastException: Specified cast is not valid.

at ClientGen.ClientGen.WriteCSOperationBinding(StreamWriter writer, ServiceDescription desc, OperationBinding op)

at ClientGen.ClientGen.WriteOperationBinding(StreamWriter writer, ServiceDescription desc, OperationBinding op)

at ClientGen.ClientGen.WriteClass(StreamWriter writer, ServiceDescription desc, String className, String url, Binding binding)

at ClientGen.ClientGen.GenerateCode(ServiceDescription desc, String outputFile, XmlSchemas schemas)

at ClientGen.ClientGen.GenerateCode(String descriptionFile, String outputFile, XmlSchemas schemas)

As an alternative, I used the steps onlined below and worked:

1. In your development environment, make sure you are using: .NET Framework version 1.1, VS.net 2003, K2.net 2003

2. Create proxy.dll to reference to your web services

2.1 Create proxy.cs using tool wsdl.exe from VS.net 2003, as an example:

C:Program FilesMicrosoft Visual Studio .NET 2003SDKv1.1Bin>wsdl /o:c:miscproxy.cs http://MyWebsite/MyWebserviceSite/MyWebservices.asmx
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 1.1.4322.573]
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Writing file c:miscproxy.cs .

2.2 Create proxy.dll using VS.net 2003

2.2.1 New Project -> Visual C# Project -> Class Library

2.2.2 Add the existing item proxy.cs into the project proxy

2.2.3 Make sure to add references to include the following:
system
system.web
system.web.services
system.xml

2.2.4 Build solution, the proxy.dll will be generated and locate at, for example:
C:Documents and SettingsAdministratorMy DocumentsVisual Studio ProjectsproxyinDebug

3. Use the created proxy.dll in your K2 project

3.1 Add proxy.dll to reference so the project references have:
proxy.dll
System.dll
System.Web.Services.dll

3.2 Modify a K2 Web Service and Assembly event

3.2.1 Right-click the Web Service Event, Properties -> Event Item and click button Edit Code, make web method calls as if you do in VS.NET.

Reply