0

I am developing an Custom Server Control (Ex: a TextBox) which would help a deveoper to bind a control directly to the service layer.

My Requirement.

  1. The text box will have the Attributes like (Service URL, Method, Parameter under my new category called Service Properties)
  2. In URL, I can pass the service host path.

is there any way where we can populate the methods available in the service on the Method Attribute as a dropdown (Like Enum) automatically.

then the developer can choose the right parameter based on the selected method.

I know it's very hard, but is there any way to overcome this requirement.

Shankar
  • 155
  • 1
  • 7

1 Answers1

0

If the web service is a SOAP service then you can get the wsdl into a XDocument object or XmlDocument and then read the wsdl:operation elements within wsdl:portType element to get all the operations available.

NOTE: This is possible only if the wsdl is exposed by the service provider.

Sample wsdl with few operations as shown:

<wsdl:portType name="ISampleService">
    <wsdl:operation name="GetData">
      <wsdl:input wsaw:Action="http://tempuri.org/ISampleService/GetData" message="tns:ISampleService_GetData_InputMessage" />
      <wsdl:output wsaw:Action="http://tempuri.org/ISampleService/GetDataResponse" message="tns:ISampleService_GetData_OutputMessage" />
    </wsdl:operation>
    <wsdl:operation name="GetEmail">
      <wsdl:input wsaw:Action="http://tempuri.org/ISampleService/GetEmail" message="tns:ISampleService_GetEmail_InputMessage" />
      <wsdl:output wsaw:Action="http://tempuri.org/ISampleService/GetEmailResponse" message="tns:ISampleService_GetEmail_OutputMessage" />
    </wsdl:operation>
    <wsdl:operation name="GetPersonCount">
      <wsdl:input wsaw:Action="http://tempuri.org/ISampleService/GetPersonCount" message="tns:ISampleService_GetPersonCount_InputMessage" />
      <wsdl:output wsaw:Action="http://tempuri.org/ISampleService/GetPersonCountResponse" message="tns:ISampleService_GetPersonCount_OutputMessage" />
    </wsdl:operation>
  </wsdl:portType>

The above section from a service exposes 3 methods:

  1. GetData
  2. GetEmail
  3. GetPersonCount
Rajesh
  • 7,766
  • 5
  • 22
  • 35