none
WCF - WSDL service name change dynamically RRS feed

  • Question

  • Hi all - 
    I have a simple service called LiveStreamingService, defined like this : 
        <services>
          <service   name="Api.Livestreaming.LiveStreamingService" />
        </services>

    Also, i have several service activators to be able to expose the same service to several addresses, like this : 
     <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true">
          <serviceActivations>
            <add service="Api.Livestreaming.LiveStreamingService" relativeAddress="ex1.svc" />
            <add service="Api.Livestreaming.LiveStreamingService" relativeAddress="ex2.svc" />
            <add service="Api.Livestreaming.LiveStreamingService" relativeAddress="ex3.svc" />
            <add service="Api.Livestreaming.LiveStreamingService" relativeAddress="ex4.svc" />
          </serviceActivations>
        </serviceHostingEnvironment>
      </system.serviceModel>
    Problem is, the WSDL generated when i reach www.host.ex1.svc?wsdl has the attribute name='livestreamingservice' , but i really need it to be equals to the relative address.
    What i really need is a way to generate wsdl's name attribute dynamically, based on the request. Is that even possible,? I qould like ot avoid to have to copy several classes totally the same just for this little problem.

    Can anyone help? Thank you very much.
    Nicola Atorino


    Thursday, October 22, 2015 11:06 AM

Answers

  • Hi Nicola Atorino,

    I am not sure what do you want, but I test it, when I reach http://localhost:25981/exe1.svc

    it worked .

    Also, you can add more endpoint to your web.config  file.

    like this:

    <endpoint name="GoodStockService" 
                      binding="basicHttpBinding" 
                      contract="EssentialWCF.IGoodStockService"/>
            <endpoint name="BetterStockService" 
                      address="better" 
                      binding="basicHttpBinding"
                      contract="EssentialWCF.IGreatStockService"/>
            <endpoint name="BestStockService" 
                      address="best"
                      binding="wsHttpBinding" 
                      contract="EssentialWCF.IGreatStockService"/>
            <endpoint name="AllStockServices" 
                      address="all" 
                      binding ="wsHttpBinding" 
                      contract="EssentialWCF.IAllStockServices"/>
            <endpoint name ="mex" 
                      binding ="mexHttpBinding" 
                      contract="IMetadataExchange"
    

    As far as I know, I am not sure there have any way to generate the  wsdl's name

    attribute dynamically. 

    Best Regards,

    Grady

    Friday, October 23, 2015 2:35 AM
    Moderator