none
How is the OperationContractAttribute.Action value is set in a reference.cs file created by "Add Service Reference" ? RRS feed

  • Question

  • i'm using the "Add Service Reference" option in visual studio in order to create a proxy class using a WSDL file given to me by a third party. i got 2 versions of the WSDL - we'll call them "OLD" and "NEW"

    even though the WSDL files suppose to be the same (the new one got updated methods version) , when creating the proxy classes i get a different values in the OperationContractAttribute.Action for every methods

    in the OLD wsdl it looks like that:

        [System.ServiceModel.OperationContractAttribute(Action="http://webservices.amadeus.com/SATRQT_13_2_1A", ReplyAction="*")]
    

    in the new wsdl it looks like that:

      [System.ServiceModel.OperationContractAttribute(Action="http://xml.amadeus.com/AmadeusWebServicesPT/Air_MultiAvailabilityRequest", ReplyAction="http://xml.amadeus.com/AmadeusWebServicesPT/Air_MultiAvailabilityResponse")]
    

    i can't figure it out from where the "Action" value is taken from.

    when i look in the OLD wsdl file i can see a "soapAction" with the same value --> this seems to be where it's taken from. however in the NEW wsdl there is a value there extacly like in the OLD wsdl

    <wsdl:operation name="Air_MultiAvailability">
      <soap:operation soapAction="http://webservices.amadeus.com/SATRQT_13_2_1A" />


    in the old WSDL the value is valid , but in the new WSDL is completely wrong and i get an exception when trying to use the service in the WS

    Can anyone direct to me to the right place ?

    thanks

    ******UPDATE***********************

    After reading some more on the "Action" element i realized that the value that i see in the NEW wsdl is the DEFAULT value

    Now i need to understand WHY in the OLD wsdl file we get the Action value to be the correct one (i'm guessing from the soapAction defined in the wsdl file under the correct operation) and in the NEW wsdl there is no match and a default value is populated ?


    • Edited by dardar4 Wednesday, May 9, 2018 1:20 PM
    Wednesday, May 9, 2018 11:32 AM

Answers

  • Hi,

    I managed to understand and fix the problem

    in the WSDL file there were multiple "Operation" with the same name

    <wsdl:portType name="WebServices"> 

      <wsdl:operation name="DoSomething">       <wsdl:input message="ns:DoSomething_1_1" />       <wsdl:output message="ns:DoSomething_1_1" />     </wsdl:operation>     <wsdl:operation name="DoSomething">       <wsdl:input message="ns:DoSomething_2_2" />       <wsdl:output message="ns:DoSomething_2_2" />     </wsdl:operation>

      </wsdl:portType>

    <wsdl:binding type="ns:WebServices" name="WebServicesBinding">

        <wsdl:operation name="DoSomething">       <soap:operation soapAction="http://webservices.my.com/DoSomething_1_1" />     </wsdl:operation>     <wsdl:operation name="DoSomething">       <soap:operation soapAction="http://webservices.my.com/DoSomething_2_2" />     </wsdl:operation>

    </wsdl:binding>

    the "DoSomethin" got 2 version in this example 1.1 and 2.2

    once i deleted\renamed ALL duplicated operations (i had multiple of them) the "Action" value was taken from the "soapAction" element

    hope this will help someone in the future !


    • Marked as answer by dardar4 Wednesday, May 16, 2018 7:46 AM
    • Edited by dardar4 Wednesday, May 16, 2018 8:02 AM
    Wednesday, May 16, 2018 7:45 AM

All replies

  • Hi dardar4,

    >> i got 2 versions of the WSDL

    Could you share us the reason you keep two versions of the wsdl? In general, we update service reference instead of generating different client proxy for different wsdl.

    >> in the old WSDL the value is valid , but in the new WSDL is completely wrong and i get an exception when trying to use the service in the WS

    What error did you get? What do you mean by “the new one got updated methods version”? What changes do you make for the methods? I made a test with WCF Service, and add new methods to existing service, the value for action did not change.

    Based on your description, this service is provided by a third party, I am afraid you need to confirm with them how to resolved this error. They are familiar with their service implementation and know the limits.

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, May 10, 2018 2:10 AM
  • Hi

    since we are working with a third party i have my current WSDL file for production. it's has a limited services that i use.

    when we want to add more services to work with , out third party partner send us a new WSDL with more services we can test and implement.  btw, the WSDL file is a local one so not sure if i can update it . we usually delete the current one and adding the new WSDL file.

    what i need to understand is HOW the "Action" value is determined.

    since in the old WSDL file the value is not a default one i wish to understand how the value is set.

    in the new WSDL file the value is the DEFAULT value (namespace + class name + method name + request\response) . 

    so for some reason in the new WSDL the value is set from some other resource but in the new one it does not

    thanks

    Amir

    Thursday, May 10, 2018 8:47 AM
  • Hi  Amir,

    I could not reproduce your issue.

    Could you reproduce this issue with your own WCF Service to generate wsdl?

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, May 11, 2018 5:30 AM
  • Hi,

    I managed to understand and fix the problem

    in the WSDL file there were multiple "Operation" with the same name

    <wsdl:portType name="WebServices"> 

      <wsdl:operation name="DoSomething">       <wsdl:input message="ns:DoSomething_1_1" />       <wsdl:output message="ns:DoSomething_1_1" />     </wsdl:operation>     <wsdl:operation name="DoSomething">       <wsdl:input message="ns:DoSomething_2_2" />       <wsdl:output message="ns:DoSomething_2_2" />     </wsdl:operation>

      </wsdl:portType>

    <wsdl:binding type="ns:WebServices" name="WebServicesBinding">

        <wsdl:operation name="DoSomething">       <soap:operation soapAction="http://webservices.my.com/DoSomething_1_1" />     </wsdl:operation>     <wsdl:operation name="DoSomething">       <soap:operation soapAction="http://webservices.my.com/DoSomething_2_2" />     </wsdl:operation>

    </wsdl:binding>

    the "DoSomethin" got 2 version in this example 1.1 and 2.2

    once i deleted\renamed ALL duplicated operations (i had multiple of them) the "Action" value was taken from the "soapAction" element

    hope this will help someone in the future !


    • Marked as answer by dardar4 Wednesday, May 16, 2018 7:46 AM
    • Edited by dardar4 Wednesday, May 16, 2018 8:02 AM
    Wednesday, May 16, 2018 7:45 AM
  • The solution you gave (to de-duplicate the operations) is helping a lot.
    Thanks for having posted it !! 

    Friday, June 26, 2020 7:55 AM