HashCoder
HashCoder

Reputation: 946

Change schema location in wsdl

I have the below config in my web.config for WCF.

<serviceMetadata httpGetEnabled="true" /> 

So once I do this I will get schema location in wsdl as

<xsd:import schemaLocation="http://mysever/Projectname/Services/myService?xsd=xsd0" namespace="MyServiceHost/Service/01/2011"/>

But i want to change that to https://mysever/Projectname/Services/myService?xsd=xsd0.

I cannot enable httpsGetEnabled = true as i will be getting wsdl through http, but i wanted to have the service requests in https.

I am using a loadbalancer, where loadbalancer to webservers traffic is over http.

Any suggestions?

Upvotes: 0

Views: 1857

Answers (1)

k0stya
k0stya

Reputation: 4315

I would suggest to use WCFExtras (HOWTO) or WCFExtrasPlus.

How to use ECFExtras:

  1. Add following extension to the config file

    <extensions>
      <behaviorExtensions>
        <add
          name="wsdlExtensions"
          type="WCFExtras.Wsdl.WsdlExtensionsConfig, WCFExtras, Version=1.0.0.0, Culture=neutral"
        />
      </behaviorExtensions>
    </extensions>
    
  2. Add custom behavior

    <behavior name="CustomBehavior">
      <wsdlExtensions location="https://mysever/Projectname/Services/myService.svc"/>
    </behavior>
    

Also you can use SoapExtensionReflector.

Moreover you would need to add the following attribute to the service declaration ot be able to use the service through the load balancer.

[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]

Upvotes: 5

Related Questions