none
Best Practice for WSDL Generate Proxy Class for Web Service with Two Versions RRS feed

  • Question

  • Dear All

    Thank you in advance for you help.

    I would like to generate proxy classes for same function but with two versions.

    Old version web service (v23.2) is used for stable modules in a project which is not going to modify.

    However, enhancement is added in new version web service (v24) and is going to use in any future modules.

    For example,

    wsdl.exe -o="TestProxy.cs" -l:CS -n:Test -sharetypes https://community.workday.com/custom/developer/API/Notification/v23.2/Notification.wsdl https://community.workday.com/custom/developer/API/Notification/v24.0/Notification.wsdl

    It generates similar classes with an '1' added at the end of the class name.

    ublic partial class Event_TargetObjectType {
            
            private Event_TargetObjectIDType[] idField;
            
            ...
        }
    

    public partial class Event_TargetObjectType1 { private Event_TargetObjectIDType1[] idField;

    ...

    }


    Since the function inside some class is the same, is it possible for WSDL.exe to generate proxy classes automatically that if the class is the same, then generate one class only (sameFunction())  but if it detects the class is different, then add '1' to the end of class name (differentFunction() and differentFunction1())

    i.e.

    public class sameFunction() { } public class differentFunction() {
    private int a;

    } public class differentFunction1() {

    private int b; }




    Best Regards
    mintssoul

    Friday, April 24, 2015 10:11 AM

Answers

  • Hi  mintssoul,
      As per this case, I have shared corresponding details below :
    1.As far as I know, WCF doesn’t support method overloading directly

    2.Because WSDL doesn’t support method overloading (not OOPs).

    3.WCF generates WSDL which specifies the location of the service and the operation or methods the service exposes.

    4.WCF use Document/Literal WSDL Style : Microsoft proposed this standard where the soap body element will contain the web method name.

    5.By default all the WCF services conform to the document literal standard where the soap body should include the method name.

    6.but you can differ the method in the same manually by using Name attribute like below 
    For example:

        [OperationContract(Name="Integers")]

        int Display(int a,int b)

        [OperationContract(Name="Doubles")]

    double Display(double a,double b)

    7. Or I suggest you that can use svcutil to map multiple namespaces for generating wcf service proxies .
        for more information about this, refer here :
    http://stackoverflow.com/questions/1103686/use-svcutil-to-map-multiple-namespaces-for-generating-wcf-service-proxies

    • Marked as answer by mintssoul Tuesday, April 28, 2015 4:17 AM
    Tuesday, April 28, 2015 1:06 AM