Hi,

I want to retrieve the full WSDL file content, i.e. the XML content preferably as a string. The input will be the URL of the WSDL. If anyone has got any idea then please do reply.

-
Thanks
Ambar

Recommended Answers

I don't know why you'd do this, but here is a method to read an entire WSDL document into a string:

using System.IO;
using System.Net;

namespace GetWsdlAsString
{
   class CGetWsdlAsString
   {
      static void Main(string[] args)
      {
         WebClient wc = new WebClient();
         StreamReader fileIn = new StreamReader(
            wc.OpenRead("
       
Jump to Post

All 4 Replies

I don't know why you'd do this, but here is a method to read an entire WSDL document into a string:

using System.IO;
using System.Net;

namespace GetWsdlAsString
{
   class CGetWsdlAsString
   {
      static void Main(string[] args)
      {
         WebClient wc = new WebClient();
         StreamReader fileIn = new StreamReader(
            wc.OpenRead("http://presentedbymiller.com/smsservice.asmx?WSDL"));

         string strWsdlData = fileIn.ReadToEnd();
         fileIn.Close();
      }
   }
}
commented: Good suggestion. +6

Thanks a lot. It's working like a charm.

I don't know why you'd do this, but here is a method to read an entire WSDL document into a string:

I will tell you why. I have a WSDL url (as you already know), a webserivce url, one function name of the webservice which is being called by some app. So I am searching for the particular function name in the wsdl and then getting the parameter names. I don't know if there is any other easier ways to do it.
Thanks again. :)

-
Ambar

It doesn't retrieve the wsdl itself it just retrieve the xxx.asmx....why? and how can I retrieve the wsdl content iteself?

Why don't you just add the wsdl as a web reference to your project? This way it will automatically create all the necessary code so you can access any method in that web service.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.