Web引用与服务引用 [英] Web Reference vs. Service Reference

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

问题描述

我只是打了一个巨大的砖墙与Paypal。我创造了一个常规的C#项目中使用的WSDL创造一些包装类。

I just hit a huge brick wall with Paypal. I had created a regular C# project to create some wrapper classes using their WSDL.

如果您创建一个非web项目,你能添加一个WSDL唯一的选择是一个Web服务引用。而这个建立还挺同一组代理类是将一个Web引用,但不really..it增加了更多的,即使是贝宝人是不知道的。

If you create a non-web project, the only option you get to add a wsdl is a Web Service Reference. And this builds kinda the same set of proxy classes as a Web Reference would but not really..it adds more that even the PayPal guys are not aware of.

所以我是这个整个的时间寻找合适的接口的代理类列表作为服务(SoapBinding)和 PayPalAPIAASoapBinding 不在那里我不停地告诉使用我们的PayPal点接触。

So I was this entire time looking for the right Interface in this list of proxy classes to use as the service (SoapBinding) and the PayPalAPIAASoapBinding was not there I kept telling our PayPal point in contact.

我只能看到下面的2个接口的出现给我什么,我需要使用,因为我没有看到一个 PayPalAPIAASoapBinding 你可以在一个Web引用基于服务见参考:

I could only see the following 2 Interfaces that appeared to me what I needed to use since I did not see a PayPalAPIAASoapBinding which you CAN see in a Web Reference based service reference:

PayPalAPIAAInterfaceClient
PayPalAPIInterfaceClient 

所以我想通了,噢,我大概已经创建了一个服务引用与Web引用该Web引用是在Web项目中的一个选项。但我不希望我的服务引用紧耦合到我的web项目。所以这就是为什么我创建了C#项目。

So I figured out oh, I probably had created a Service Reference vs. a Web Reference which Web Reference is an option in a Web project. But I don't want my service reference tightly coupled to my web project. So that's why I created the C# Project.

那么到底是什么服务引用与Web参考?而且我怎么分开了这一点到花药的项目,如果服务引用要扔我一个循环,并给我一组不同的接口不是Web引用会?

So what the heck is a Service Reference vs. Web Reference? And how am I supposed to separate this out into anther project if Service Reference is going to throw me a loop and give me a set of different interfaces than a Web Reference would?

另外,为了使事情变得更加混乱,VS 2008有一个Web服务应用程序项目。

Also, to make things even MORE confusing, VS 2008 has a Web Service Application project.

所以,我用什么? 我们在使用.NET 3.5框架和我们的没有的准备移动到WCF 。所以,我还可以使用新的服务引用,即使不使用WCF还是什么?如果您在使用.NET 3.5,而不是WCF但你仍然想要做基本的Web服务,你还是去服务参考路线,只是不使用WCF框架?含义可以把它像使用一个.NET 2.0的Web仍然参考,只是你会得到一个完全不同的一代的WSDL?

So what do I use? We're using the .NET 3.5 framework and we're not ready to move to WCF. So can I still use the new Service Reference even if not using WCF or what? IF you're using .NET 3.5 and not WCF yet and you still want to do basic web services, do you still go the Service Reference route and just not use the WCF framework? Meaning can it be used like a .NET 2.0 Web Reference still, just that you're going to get an entirely different generation of the WSDL?

推荐答案

添加Web引用是旧式的,德precated ASP.NET Web服务(ASMX)技术(仅使用XmlSerializer的为你的东西) - 如果你这样做,你会得到一个ASMX客户端的ASMX Web服务。你可以在几乎任何项目做到这一点(Web应用程序,Web站点,控制台应用程序,的WinForms - 你的名字)。

Add Web Reference is the old-style, deprecated ASP.NET webservices (ASMX) technology (using only the XmlSerializer for your stuff) - if you do this, you get an ASMX client for an ASMX web service. You can do this in just about any project (Web App, Web Site, Console App, Winforms - you name it).

添加服务引用是这样做的新途径,增加了WCF服务引用,它给你的不仅仅是普通的旧的ASMX的东西更加先进,更加灵活的服务模式。

Add Service Reference is the new way of doing it, adding a WCF service reference, which gives you a much more advanced, much more flexible service model than just plain old ASMX stuff.

既然你还没有准备好迁移到WCF,也可以仍然添加了旧式的Web参考,如果你真的必须:当你做一个添加服务引用,在出现的对话框中,点击在按钮左侧角球[高级]按钮:

Since you're not ready to move to WCF, you can also still add the old-style web reference, if you really must: when you do a "Add Service Reference", on the dialog that comes up, click on the [Advanced] button in the button left corner:

和出现的下一个对话框,挑[添加Web引用]按钮,在底部的:

and on the next dialog that comes up, pick the [Add Web Reference] button at the bottom:

这篇关于Web引用与服务引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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