手动添加服务参考 [英] Manually add a service reference

查看:59
本文介绍了手动添加服务参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

目前,我在一个网站上工作,需要使用网络服务来发出一些请求.我不知道URL,因此我无法通过右键单击来添加服务,然后选择添加服务引用并从那里添加它.

另一方面,我拥有的文件(包括WSDL文件)一直在试图执行.手动将文件添加到我的App_webrefences文件夹下,然后从该文件中将Web服务显示为来自文件的引用,但是文件未出现在列表中,我也无法浏览所需的文件.有人可以让我知道或逐步告诉我添加此服务吗?谢谢.

Hello all,

Currently I am working on a web site and need to use a web service to make some requests. I dont know the URL so I cant add the service by right click and select add a service reference and add it from there.

On the other hand, I have the files ( including the WSDL file) what I have been trying to do is; manually add the files under my App_webrefences fodler and show the web service as a reference from a file from there but the files arent appearing on the list nor i can browse for the desired file. Anyone who can let me know or tell me step by step to add this service ? Thanks.

推荐答案

赫雷斯实现的步骤:

1. WSDL是带有以下注释的自动生成的代码
//------------------------------------------------ ------------------------------
//< autogenic>
//此代码是由工具生成的.
//运行时版本:1.0.2914.16
//
//对此文件所做的更改可能会导致错误的行为,如果
//重新生成代码.
//
//------------------------------------------------ ------------------------------

//
//此源代码由wsdl自动生成,版本= 1.0.2914.16.
//


2.使用WSDL生成代理代码
wsdl.exe实用程序还可以将WSDL文件作为输入,而不是将URL指向可以获取WSDL的位置.

此C#代理源文件代表客户端可以针对其进行编译的Web服务的代理类.您将获得派生自System.Web.Services.Protocols.SoapHttpClientProtocol类的代理类.如果使用/protocol:HttpGet或/protocol:HttpPost参数,则代码从System.Web.Services.Protocols.HttpGetClientProtocol类或System.Web.Services.Protocols.HttpPostClientProtocol类派生.
3.将代理类编译为DLL库
在命令提示符处,执行以下Windows命令:
csc/t:库/r:System.Web.Services.dll/r:System.Xml.dll MyServer.cs

4.使用生成的代理实例的引用构建客户端解决方案(控制台/Web/Windows窗体).
Herez the steps to achieve:

1. WSDL is auto genrated code with the below comments
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.0.2914.16
//
// 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=1.0.2914.16.
//


2. Generate proxy code using WSDL
wsdl.exe utility can also take a WSDL file as input instead of a URL pointing to the location where the WSDL can be obtained.

This C# proxy source file represents the proxy class for the web service that clients can compile against. you will get proxy class that derives from the System.Web.Services.Protocols.SoapHttpClientProtocol class. If you use the /protocol:HttpGet or /protocol:HttpPost parameters, the code derives from either the System.Web.Services.Protocols.HttpGetClientProtocol class or the System.Web.Services.Protocols.HttpPostClientProtocol class.

3. Compile the Proxy class as a DLL Library
From the command prompt, execute the below windows commands:
csc /t:library /r:System.Web.Services.dll /r:System.Xml.dll MyServer.cs

4. Build the client solution (console/web/windows form) using reference of the generated proxy instance.


Herez实现步骤:

1. WSDL是带有以下注释的自动生成的代码
//------------------------------------------------ ------------------------------
//< autogenic>
//此代码是由工具生成的.
//运行时版本:1.0.2914.16
//
//对此文件所做的更改可能会导致错误的行为,如果
//重新生成代码.
//
//------------------------------------------------ ------------------------------

//
//此源代码由wsdl自动生成,版本= 1.0.2914.16.
//


2.使用WSDL生成代理代码
wsdl.exe实用程序还可以将WSDL文件作为输入,而不是将URL指向可以获取WSDL的位置.

此C#代理源文件代表客户端可以针对其进行编译的Web服务的代理类.您将获得派生自System.Web.Services.Protocols.SoapHttpClientProtocol类的代理类.如果使用/protocol:HttpGet或/protocol:HttpPost参数,则代码从System.Web.Services.Protocols.HttpGetClientProtocol类或System.Web.Services.Protocols.HttpPostClientProtocol类派生.
3.将代理类编译为DLL库
在命令提示符处,执行以下Windows命令:
csc/t:库/r:System.Web.Services.dll/r:System.Xml.dll MyServer.cs

4.使用生成的代理实例的引用来构建客户端解决方案(console/web/windows表单).
Herez the steps to achieve:

1. WSDL is auto genrated code with the below comments
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.0.2914.16
//
// 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=1.0.2914.16.
//


2. Generate proxy code using WSDL
wsdl.exe utility can also take a WSDL file as input instead of a URL pointing to the location where the WSDL can be obtained.

This C# proxy source file represents the proxy class for the web service that clients can compile against. you will get proxy class that derives from the System.Web.Services.Protocols.SoapHttpClientProtocol class. If you use the /protocol:HttpGet or /protocol:HttpPost parameters, the code derives from either the System.Web.Services.Protocols.HttpGetClientProtocol class or the System.Web.Services.Protocols.HttpPostClientProtocol class.

3. Compile the Proxy class as a DLL Library
From the command prompt, execute the below windows commands:
csc /t:library /r:System.Web.Services.dll /r:System.Xml.dll MyServer.cs

4. Build the client solution (console/web/windows form) using reference of the generated proxy instance.


这篇关于手动添加服务参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆