zchpit
zchpit

Reputation: 3121

Consuming PHP web service by WCF client

I have a problem in consuming PHP web service by WCF. First, I try to make a proxy class by 'Add service reference' but this don't work:

enter image description here

Full error message:

There was an error downloading 'http://xxx.yyy.zzz.pl/Swdsoapserver/query?wsdl/_vti_bin/ListData.svc/$metadata'.
The request failed with the error message:
--
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>Sender</faultcode><faultstring>Invalid XML</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

--.
Metadata contains a reference that cannot be resolved: 'http://xxx.yyy.zzz.pl/Swdsoapserver/query?wsdl'.
The content type text/html; charset=UTF-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:tns="http://xxx.yyy.zzz.pl/Swdsoapserver/query" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="SwdQuerySoap"
    targetNamespace="http://xxx.yyy.zzz.pl/Swdsoapserver/query">
    <wsdl:types>
        <xsd:schema 

I talk with person, that hosting this web service in php, and he says me, that he consume this web service in something like this:

$Http = new Zend_Controller_Request_Http();
       $client = new SoapClient("http://".$Http->getServer('HTTP_HOST')."/Swdsoapserver/queryko?wsdl", array        ('trace'         => true));
       $object->sy = "12345678";
       $client->getParcel($object, base64_encode('xyzxyz'));

This base64_encode('xyzxyz') is Hash that is needed to connection.

Any advice how to consume this service in C# .NET??

edit: Screens from IE: IE1 IE2 IE3

edit: Save file on disk and add to visual studio (there are also my 2 other wcf service) enter image description here

Upvotes: 1

Views: 2580

Answers (1)

Rom Eh
Rom Eh

Reputation: 2063

First of all, you should browse the WSDL in your favorite navigator. The save the file on your local compouter.

Step 2, you must make a Service Reference to this file. It will normally create a client (WCF) to your PHP web service in your project.

Last step, you only have to instanciate a client in WCF.

Upvotes: 1

Related Questions