Problem regarding consuming php web service in c# Desktop application

戏子无情 提交于 2019-12-10 20:46:00

问题


I am developing a c# desktop application and using a webservies which is developed in a php application when i try to consume that application. I just add web REference of that web service and try to access throught the following code

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

it throws the error when i try to call the method verify. the error is

Possible SOAP version mismatch: Envelope namespace http://schemas.xmlsoap.org/wsdl/ was unexpected. Expecting http://schemas.xmlsoap.org/soap/envelope/.

and the web service link was like

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


回答1:


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. Usually, you access the WSDL by appending either "?wsdl" or "wsdl" to the service URI.

There are two elements to the webservice you are attempting to consume.

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:

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. Alternatively, you can alter the properties of the pdl variable, and change the endpoint in code.



来源:https://stackoverflow.com/questions/2062722/problem-regarding-consuming-php-web-service-in-c-sharp-desktop-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!