English 中文(简体)
使用 WSDL 和 XSD 文件的网络服务
原标题:Consuming webservice having WSDL and XSD files

我们已请求一家公司写入一个网络服务,我们可以用来获取一些信息。 他们已经给我们发送了 WSDL 和 XSD 文件。 请告诉我如何使用这些文件查询数据? 如果我能链接到一个网络服务, 我可以很容易地做到这一点。 我只是提供链接, 视觉工作室会为我生成网络参考。 之后, 我就可以像普通类一样使用该引用。 在这种情况下, 我没有链接。 仅上面提到的文件。 谢谢。

最佳回答

您可以从 wsdl 文件创建代理文件( 在视觉工作室中添加服务参考 ) 。 您可以在 < a href=" http:// msdn.microsoft.com/ en- us/library/ aa347733.aspx" rel = "noreferrer" > http://msdn. microsoft. com/ en- us/library/aa347733.aspx < /a > 上读到有关 svcutil 的信息, 但 VS2010 允许您在添加服务参考时将 wsdl 文件放在 adress 上 。

问题回答

VS2010 can t create a web service reference from some WSDLs. Have to write custom wrapper for those. OR edit your WSDL in a way so VS can consume it. For example it may be ok for you to remove web service method references for the methods that you are not planning to use if those references create trouble for you.

除非您重新使用.NET 2. 0, 否则您不应该使用ASMX网络服务技术。

您应该使用“ 添加服务引用” 并将其指向磁盘上的 WSDL。 它会创建一套“ 代理” 类, 其方法可以被称为“ 正常” 类 。

见“”http://johnwsaunders3.wordpress.com/2009/05/17/how-to-consume-a-web-service/" rel=“不跟随 nofollow norefererr'>“如何设置网站服务 ”, 以作为实例进行步行。

使用 < a href=" "http://msdn.microsoft.com/en-us/library/7h3ystb6.aspx" rel = "nofollow noreferrer">WSDL.EXE wiltive 来生成来自 WSDL 的网络服务代理 。

例如:

wsdl /language:CS /n:"Microsoft.SqlServer.ReportingServices2010" http://<Server 
Name>/reportserver/reportservice2010.asmx?wsdl

< a href=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Ref:
WSDL and consume web service
consume non .NET webservice through WSDL file
How to use a WSDL





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签