0

I have an application which expose WCF services from distance , here is an example of my services :

 [OperationContract(Name = "AddClient")]

    bool AddClient(Client c);

I tried to consume the WCF service from a Console Application , although the ConsoleAp. doesn't have any defenition of "Client" class, I can make an instance of "Client" through my ConsoleAp, and it works perfectly fine.

My question is , is it possible to call this function from a php based application, and will it let me insert the "Client" object or defined it in an equivalent way as .NET?

I thought I might jump over my head here, and all i should do is send simple parameters, the thing is that "Client" has 10+ properties/fields, and it doesn't seem clean/purify enough.

Thanks

David Rasuli
  • 812
  • 4
  • 15
  • 30

1 Answers1

1

I tried to consume the WCF service from a Console Application , although the ConsoleAp. doesn't have any defenition of "Client" class, I can make an instance of "Client" through my ConsoleAp, and it works perfectly fine.

It does. If you add a service reference, a proxy class is generated that contains the methods and classes defined by the service. You can see this in the file Reference.cs under the service reference, where you'll go if you click Go To Definition on a Client (or press F12).

Or, if the Console Application contains an assembly reference to the WCF Service, the ConsoleApp can access the public classes of the WCF project, but that has nothing to do with either WSDL or WCF.

If you want to generate classes from a WSDL in PHP, you can take a look at wsdl2php or wsdl2php-interpreter (found here) or search for another library or tool that does this.

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
  • Thanks for your answer, Will the end user of the WCF that consumes this service, has to implement the wsdl2php? – David Rasuli Nov 13 '12 at 15:11
  • 1
    @DavidRasuli they don't have to. The only thing the consumer *has* to do is craft valid SOAP messages according to your binding (Basic/WsHttpBinding, SOAP 1.1/2), how they do so is totally up to them. They can use SoapClient, wsdl2php, nusoap, Zend_Soap_Client, whatever they desire. – CodeCaster Nov 13 '12 at 15:15
  • Do you have a quick link to any client implementation of one of the methods you offered? I'm relatively new to php, suffice to say with calling services.. – David Rasuli Nov 13 '12 at 15:33
  • @DavidRasuli suit yourself, searching for "php soap client example" gave me this question: http://stackoverflow.com/questions/6634077/php-soap-client-tutorial-recommendation – CodeCaster Nov 13 '12 at 15:53