C# – Problem regarding consuming php web service in c# Desktop application

cdesktop applicationPHPweb services

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

Best Answer

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.

Related Topic