In WCF how to remove bindings from the metadata?
The WSDL generated by WCF is describing all my bindings, and I want it to describe only the wsHttpBinding
.
I want it because a PHP client can't parse the WSDL if it contains unknown bin开发者_如何学JAVAdings.
There is a way to do that?
Have a service and an endpoint that exposes nothing but the wsHttpBinding and connect to that endpoint using your PHP client - that ought to work. There's really nothing else you can do, I think - if a service exposes more than one endpoint with various bindings, all those bindings and endpoints will end up in the WSDL.
So just have a separate service entry:
<services>
<service name="MyService">
<endpoint name="WsHttpEndpoint"
address="......."
binding="wsHttpBinding"
contract="IMyService" />
</service>
</services>
and have the PHP client connect here - since there's only a single wsHttpBinding endpoint, that should work.
So you can't really remove any bindings from the metadata - but you can prevent some metadata from being included.
The other option would be to have a separate WSDL for your service, that will work with PHP. You can even define a static external metadata WSDL using the serviceMetadata
behavior:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="test">
<serviceMetadata
externalMetadataLocation="http://YourServer/Service/WSDL/MyService.wsdl"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
精彩评论