views:

485

answers:

3

I have a WCF service. It has multiple clients and three endpoints. The endpoint bindings are nettcp, wsHttp and basicHttp. If I attempt to connect to it via php'd builtin SoapClient class like so:

$service = new SoapClient
("http://service.companyname.local:6666/Service/?wsdl",
 array(
         "location" => "http://service.companyname.local:6666/Service/Basic",

 "trace" => true,
 'soap_version' => SOAP_1_1
     )
);

I get the following:

PHP Fatal error:  SOAP-ERROR: Parsing WSDL: PHP-SOAP doesn't support transport 'http://schemas.microsoft.com/soap/tcp' in c:\www\client.php on line 666

Right now my workaround is to save the wsdl manually and remove the nettcp binding. Is there a workaround that will allow me to use the automatically generated wsdl? Can I hide a binding from the wsdl in web.config? Can I generate different wsdls on different bindings. I don't want to deploy two service hosts.

+1  A: 

When you say you don't want to deploy two service hosts, I assume you're self-hosting a single ServiceHost in a Windows Service. I solved this problem by building a generic service host that can host as many service impls internally as I want (eg, it new's a ServiceHost for each service entry in the config). That way, I can flexibly host as many service impls in a single Windows Service as I need. This would solve your problem by allowing you to separate the basicHttp bound service from the others to keep the WSDL clean. There are some open-source examples of this floating around (here's one).

The only other way I could think of to do it would be to expose your own custom metadata endpoint built from WsdlExporter (see here)

Good luck!

nitzmahone
I have built a custom wsdl exporter. Its a bit hackish at the moment, but it basically works.
Justin Dearing
A: 

I filed a feature request with PHP. If they implement this I'll mark this as the correct answer. I'm still open to better workarounds though.

UPDATE: I submitted a patch to implement this. I am awaiting its approval. UPDATE: Patch committed to svn. Awaiting the next release of PHP. UPDATE: Patch is now part of PHP 5.3.3 and 5.2.14.

Justin Dearing
A: 

Another option I am currently researching is a third party soap client for PHP called WSF-PHP.

Justin Dearing