首页 > 编程 > .NET > 正文

HOW TO: BETA: Integrate a .NET Client with an Apac

2024-07-10 13:05:31
字体:
来源:转载
供稿:网友
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 <binding>, <message>, and <porttype> 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 <import> element.


open the interface file, and copy all of the elements except for the <definitions> tags. paste these elements into the service file above the <service> element.


in the <porttype> element, append the "tns:" string to the message attribute values on the <input> and <output> child elements.


in the <binding> element, append the "tns:" string to the type attribute value.


in the <service> element, append the "tns:" string to the binding and name attribute values on the <port> child element.


for the root-level <definitions> 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

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表