I need to bind purticular external webservice webmethods name with in asp:dropdownlist at run time. anybody can help please..
Thanks in advance..
Suganya.B
I need to bind purticular external webservice webmethods name with in asp:dropdownlist at run time. anybody can help please..
Thanks in advance..
Suganya.B
wanted the web-method names of an external service to appear in an asp:DropDownList at runtime. Both client-side calls (as suggested by ) and parsing XML responses (as shown by ) are valid approaches, but a more robust route is to read the service metadata itself so the list reflects the actual operations the service exposes.
For ASMX services the metadata (WSDL) can be downloaded and parsed with the .NET ServiceDescription API (ServiceDescription class). Example pattern (C#):
using System.Web.Services.Description;
using System.Xml;
using System.Linq;
string wsdlUrl = "https://example.com/service.asmx?WSDL";
using (var xr = XmlReader.Create(wsdlUrl))
{
var sd = ServiceDescription.Read(xr);
var opNames = sd.PortTypes
.Cast<PortType>()
.SelectMany(pt => pt.Operations.Cast<Operation>())
.Select(o => o.Name)
.Distinct()
.OrderBy(n => n);
DropDownList1.Items.Clear();
foreach (var n in opNames) DropDownList1.Items.Add(new ListItem(n));
} If the service is WCF, retrieve metadata with a metadata exchange client and import it (see MetadataExchangeClient). If a client proxy was already generated in the project, reflecting the proxy type to list public methods is a quick alternative. For REST endpoints check for an OpenAPI/Swagger document and extract operationId or path entries (OpenAPI spec).
Notes and pitfalls: metadata may be disabled or require auth—WSDL/MEX must be reachable from the web app. Consider caching the operation list and populate once (e.g., Page_Load on first load). Map raw method names to friendly labels and filter out internal/duplicate entries. If metadata is unavailable, ask the service owner for a simple metadata endpoint (JSON list) — that is the cleanest long-term solution.
Jump to Post— kvprajapati 1,826>Bind Webmethod names with in asp.net control
First, you can call webservice on client (JavaScript) to retrieve the data.
>Bind Webmethod names with in asp.net control
First, you can call webservice on client (JavaScript) to retrieve the data.
It depends on what format you are receiving the data from the WebService but the syntax is as follows:
Dim reader As New System.IO.StringReader(<Webservice>)
DataSet dataset = new DataSet();
dataset.ReadXml(reader);
myDropDownList.DataSource = dataset.Tables[0];
myDropDownList.DataValueField = "value_field"
myDropDownList.DataTextField = "text_field"
myDropDownList.DataBind(); The reader object is used to access the Webservice feed which and is expecting an XML string (for this example)
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.