steverb.com

Things I Felt Like Posting

WSDL Flattening Revisited

I apologize it has taken so long for me to post this, but as promised, here is the .cs file for the wsdl flattener.

FlatWSDL.cs (10.75 kb) 

To use it, you need to modify your web config and add a reference to the library in the behavior extensions section:

 (YOUR ACTUAL ENTRIES MAY VARY)

 <system.serviceModel>
   <extensions>
      <behaviorExtensions>
          <add name="FlatWSDL" type="SteverB.Services.Extensions.FlattenWsdlBehavior, SteverB.Services.Extensions, Version=1.0.0.0,  Culture=neutral, PublicKeyToken=[something]" />
      </behaviorExtensions>
   <extensions> 

 

And then to turn it on, modify the service behavior by adding the <FlatWSDL /> tag:

 

<behaviors>
   <serviceBehaviors>
      <behavior name="MyBehavior">
         <serviceMetadata httpGetEnabled="true"/>
         <FlatWSDL />
      </behavior>
    </serviceBehaviors>
</behaviors>

 

I hope that helps someone! 

Comments (6) -

  • Steve

    2/17/2010 12:06:30 PM |

    I have re-enabled comments.

  • Christo

    7/5/2011 1:01:31 AM |

    Hi Stever B,

    I hope you still read comments on this post.

    I've tried to implement you code with the example above, but for some reason when I try to consume the WCF, I get the following error:

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: An error occurred creating the configuration section handler for system.serviceModel/extensions: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)


    Line 181:    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    Line 182:    <extensions>
    Line 183:      <behaviorExtensions>
    Line 184:        <add name="FlatWSDL" type="MyCompany.TDS.WCF.FlattenWsdlBehavior, MyCompany.TDS.WCF, Version=1.0.0.0,  Culture=neutral, PublicKeyToken=[something]" />


    Can you please shed some light on my problem. I'm a newby to this WCF stuff and tried to implement your code as best I can.

    Mant thanks,
    C

  • Christo

    7/5/2011 1:01:54 AM |

    Hi Stever B,

    I hope you still read comments on this post.

    I've tried to implement you code with the example above, but for some reason when I try to consume the WCF, I get the following error:

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: An error occurred creating the configuration section handler for system.serviceModel/extensions: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)


    Line 181:    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    Line 182:    <extensions>
    Line 183:      <behaviorExtensions>
    Line 184:        <add name="FlatWSDL" type="MyCompany.TDS.WCF.FlattenWsdlBehavior, MyCompany.TDS.WCF, Version=1.0.0.0,  Culture=neutral, PublicKeyToken=[something]" />


    Can you please shed some light on my problem. I'm a newby to this WCF stuff and tried to implement your code as best I can.

    Mant thanks,
    C

  • Christo

    7/5/2011 1:02:07 AM |

    Hi Stever B,

    I hope you still read comments on this post.

    I've tried to implement you code with the example above, but for some reason when I try to consume the WCF, I get the following error:

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: An error occurred creating the configuration section handler for system.serviceModel/extensions: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)


    Line 181:    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    Line 182:    <extensions>
    Line 183:      <behaviorExtensions>
    Line 184:        <add name="FlatWSDL" type="MyCompany.TDS.WCF.FlattenWsdlBehavior, MyCompany.TDS.WCF, Version=1.0.0.0,  Culture=neutral, PublicKeyToken=[something]" />


    Can you please shed some light on my problem. I'm a newby to this WCF stuff and tried to implement your code as best I can.

    Mant thanks,
    C

  • Christo

    7/5/2011 1:02:43 AM |

    Test

  • Christo

    7/5/2011 1:03:14 AM |

    Hi Stever B,

    I hope you still read comments on this post.

    I've tried to implement you code with the example above, but for some reason when I try to consume the WCF, I get the following error:

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: An error occurred creating the configuration section handler for system.serviceModel/extensions: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)


    Line 181:    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    Line 182:    <extensions>
    Line 183:      <behaviorExtensions>
    Line 184:        <add name="FlatWSDL" type="MyCompany.TDS.WCF.FlattenWsdlBehavior, MyCompany.TDS.WCF, Version=1.0.0.0,  Culture=neutral, PublicKeyToken=[something]" />


    Can you please shed some light on my problem. I'm a newby to this WCF stuff and tried to implement your code as best I can.

    Many thanks,
    C

Comments are closed