Consuming a 3rd Party, Commercial Web Service RRS feed

  • Question

  • Looking for the "best practices" way to consume a 3rd party, commercial web service in WWF 4.  I have  a WSDL address for access. 

    Some features include:

    • Web service access validation via a user ID, license key, etc.
    • Passing multiple parameters.
    • Receiving multiple results.

    Can't seem to find this topic anywhere.

    Any help is greatly appreciated?

    Tuesday, October 25, 2011 7:03 PM


  • This is actually a fairly large question.  In theory you can get by using the standard Send/Receive activities however they are somewhat awkward to work with as they do not currently support contract first development.

    For my solution I instead took a code generation approach.  I use the ServiceDescriptionImporter class to generate the core code (client and pocos).  From there I generate a set of activities that wrap the various Begin/End calls and also allow for type determination at runtime (some of the pocos that webservices return are polymorphic).  All told it is a fair bit of design and code to undertake connecting to arbitrary web services with full design time support.

    This is the code that I use to generate the core code, and hopefully will give you a starting point in your endeavor.


         var sr = new StringReader(_soap.Description); //The Description is the wdsl that is downloaded from the webservice
                        var description = ServiceDescription.Read(sr);
                        var importer = new ServiceDescriptionImporter { ProtocolName = "Soap",CodeGenerationOptions = System.Xml.Serialization.CodeGenerationOptions.GenerateProperties | System.Xml.Serialization.CodeGenerationOptions.GenerateOldAsync};
                        importer.AddServiceDescription(description, null, null);
                        _soap.ClientClassName = string.Format("Designer.{0}.{1}", _soap.CleanName, description.Services[0].Name.Replace("_x0020_", "").Replace("__", "_"));
                        var nmspace = new CodeNamespace(string.Format("Designer.{0}", _soap.CleanName));
                        var unit = new CodeCompileUnit();
                        var warning = importer.Import(nmspace, unit);
                        return warning == 0 ? unit : null;

    • Marked as answer by LeoTang Tuesday, November 1, 2011 10:25 AM
    Tuesday, October 25, 2011 8:55 PM