Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting to a WCF Service in PHP that has a a NetTCP Binding and a BasicHttpBinding

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.

like image 330
Justin Dearing Avatar asked Dec 03 '25 05:12

Justin Dearing


1 Answers

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!

like image 117
nitzmahone Avatar answered Dec 04 '25 17:12

nitzmahone