简体   繁体   English

有关在C#桌面应用程序中使用php Web服务的问题

[英]Problem regarding consuming php web service in c# Desktop application

I am developing ac# desktop application and using a webservies which is developed in a php application when i try to consume that application. 我正在开发ac#桌面应用程序,并使用当我尝试使用该应用程序时在php应用程序中开发的webservies。 I just add web REference of that web service and try to access throught the following code 我只是添加了该Web服务的Web参考,并尝试通过以下代码访问

WebReference.TestWSDL pdl = new testingApp.WebReference.TestWSDL();
string copy = pdl.verify("testing");

it throws the error when i try to call the method verify. 当我尝试调用方法verify时,它将引发错误。 the error is 错误是

Possible SOAP version mismatch: Envelope namespace http://schemas.xmlsoap.org/wsdl/ was unexpected. 可能的SOAP版本不匹配:信封名称空间http://schemas.xmlsoap.org/wsdl/是意外的。 Expecting http://schemas.xmlsoap.org/soap/envelope/ . 期待http://schemas.xmlsoap.org/soap/envelope/

and the web service link was like 和网络服务链接就像

http://171.139.101.12/code/index.php/webservice/wsdl http://171.139.101.12/code/index.php/webservice/wsdl

The error you are encountering is informing you that when you invoke the webservice, you are being given the WSDL (Web Service Definition Language) for the service - this is the metadata that describes the service functions, but cannot actually be used to invoke the service. 您遇到的错误是在通知您,当您调用Web服务时,将获得服务的WSDL(Web服务定义语言)-这是描述服务功能的元数据,但实际上不能用于调用服务。 Usually, you access the WSDL by appending either "?wsdl" or "wsdl" to the service URI. 通常,通过在服务URI后面附加“?wsdl”或“ wsdl”来访问WSDL。

There are two elements to the webservice you are attempting to consume. 您要使用的Web服务有两个元素。

The actual service exists at: 实际服务位于:

http://171.139.101.12/code/index.php/webservice

The metadata describing it, which Visual Studio via wsdl.exe used to generate a proxy, resides here: Visual Studio通过wsdl.exe用来描述代理的描述它的元数据位于此处:

http://171.139.101.12/code/index.php/webservice/wsdl

You need to edit the properties of the Web Reference and update the address appropriately. 您需要编辑Web参考的属性并适当地更新地址。 Alternatively, you can alter the properties of the pdl variable, and change the endpoint in code. 或者,您可以更改pdl变量的属性,并在代码中更改端点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM