繁体中文
设为首页
加入收藏
当前位置:.Net技术首页 >> Asp.Net开发 >> HOW TO: BETA: Integrate a .NET Client with an Apache SOAP 2.2 XML Web Service

HOW TO: BETA: Integrate a .NET Client with an Apache SOAP 2.2 XML Web Service

2007-07-15 08:00:00  作者:  来源:互联网  浏览次数:0  文字大小:【】【】【
简介:HOW TO: BETA: Integrate a .NET Client with an Apache SOAP 2.2 XML Web Service -------------------------------------------------------------------------------- The information in this article appli...

HOW TO: BETA: Integrate a .NET Client with an Apache SOAP 2.2 XML Web Service

--------------------------------------------------------------------------------

The information in this article applies to:

Microsoft Visual Studio .NET Beta 2

--------------------------------------------------------------------------------

This article discusses a Beta release of a Microsoft product. The information in this article is provided as-is and is subject to change without notice.

No formal product support is available from Microsoft for this Beta product. For information about obtaining support for a Beta release, please see the documentation included with the Beta product files, or check the Web location from which you downloaded the release.

IN THIS TASK

SUMMARY

Requirements

Prepare WSDL File for .NET

Create the Proxy

Use the Wsdl.exe Tool to Create the Proxy

Use the Visual Studio .NET IDE to Create the Proxy

SUMMARY

This article describes how to integrate a .NET client with an Apache SOAP 2.2-based Web service. This article assumes that a Web Services Description Language (WSDL) file exists and was created by using the IBM Web Services Toolkit.

back to the top

Requirements

This article assumes that you are familiar with the following topics:

Reading and editing WSDL files

Microsoft .NET Framework Software Development Kit (SDK)

back to the top

Prepare the WSDL File for .NET

The IBM Web Services Toolkit places the WSDL information in two files:

Java class name _Service.wsdl (the service file)

Java class name _Service-interface.wsdl (the interface file)

The first file contains the service information. The second file contains the message, port type, and binding definitions. Because of incompatibilities between IBM-generated WSDL and the Microsoft .NET WSDL implementation, you must edit the files that the IBM Web Services Toolkit generates so that the .NET environment can read them in.

NOTE : The .NET environment can handle WSDL imports. However, the WSDL that the IBM Web Services Toolkit generates improperly uses the targetNamespace attribute and incorrectly references other internal elements (specifically, the , , and elements). The easiest and quickest approach is to merge and edit the files as follows:

Copy both .wsdl files to your computer.

Open the service file, and delete the element.

Open the interface file, and copy all of the elements except for the tags. Paste these elements into the service file above the element.

In the element, append the "tns:" string to the message attribute values on the and child elements.

In the element, append the "tns:" string to the type attribute value.

In the element, append the "tns:" string to the binding and name attribute values on the child element.

For the root-level element, set XMLns:xsd namespace to reference http://www.w3.org/2001/XMLSchema URI (that is, change "1999" to "2001").

back to the top

Create the Proxy

To create the proxy, you can use either of the following methods:

Use the Wsdl.exe tool, and include the file in a project.

Create a Web reference from within the Microsoft Visual Studio .NET Integrated Development Environment (IDE).

After you create the proxy, you can use the proxy as you would any other Microsoft .NET class.

back to the top

Use the Wsdl.exe Tool to Create the Proxy

From the Start menu, point to Programs , point to Microsoft Visual Studio .NET , point to Visual Studio .NET Tools , and then click Visual Studio .NET Command Prompt .

At the command prompt, browse to the folder that contains the edited .wsdl file.

Type the following command to produce a Microsoft Visual C# .NET language file that you can include in your project:

wsdl Java class name _Service.wsdl

If you want Wsdl.exe to create the proxy in a different language, use the /language switch as follows:

For Microsoft Visual Basic .NET, use the following command:

wsdl Java class name_Service.wsdl /language:VB

For Microsoft JScript .NET, use the following command:

wsdl Java class name_Service.wsdl /language:JS

For Microsoft C# .NET, use the following command:

wsdl Java class name_Service.wsdl /language:CS

To obtain this information, as well as other options, type wsdl /? at the command prompt.

back to the top

Use the Visual Studio .NET IDE to Create the Proxy

In Visual Studio .NET, from the Project menu, click Add Web Reference .

In the Add Web Reference dialog box, in the Address combo box, type the path to the local copy of the Java class name _Service.wsdl file, and then click the arrow button next to the combo box.

Click Add Reference . This produces a file in the project language and automatically includes the file in your project.

The third-party products discussed in this article are manufactured by vendors independent of Microsoft; we make no warranty, implied or otherwise, regarding these products' performance or reliability.

back to the top

责任编辑:admin
相关文章