Last post Sep 02, 2016 04:57 AM by Yohann Lu
Aug 31, 2016 02:45 PM|VoidWhereProhibited|LINK
I work for a small non-profit agency and we need to consume an older XML web service for one of our partners. Since I'm the only one around with any programming background, it's fallen to me to get this working.
I'm completely self taught and very new to both C# and ASP.NET.
This web service has a WSDL file which I've consumed with WCF. Everything went fine and I'm set up with a client.
However, I'm having trouble getting it working. I've put a method called "DownloadFile" in my HomeController and here is the code. Note that I've marked the client attributes with "null" to prevent the username, password and other information from being
public ActionResult DownloadFile()
BasicHttpBinding binding = new BasicHttpBinding();
binding.MaxReceivedMessageSize = 65536*2;
var clientSCHED = new nullClient();
var firstDate = DateTime.Today;
var firstDateStr = firstDate.ToShortDateString();
var lastDate = DateTime.Today;
var lastDateStr = lastDate.ToShortDateString();
var task1 = clientSCHED.AppointmentDataRawAsync("null", "null", "null",
firstDateStr, lastDateStr, null, null);
I know that it's wrong but I'm not certain why it's wrong. The client is supposed to return a list of appointments in XML format. Any assistance on this would be appreciated.
Aug 31, 2016 06:36 PM|march11|LINK
You may not be typing the response from the service correctly. there are actually wizards that will build your proxy and connection to the service so that all you need to do is provide the username and password, and any other required parameters.
Which version of Visual Studio are you using?
is the service providing an .asmx pages? You state that it is older. You do not need WCF to consume the page.
Take a look at this link...
Aug 31, 2016 07:27 PM|VoidWhereProhibited|LINK
I'm using VS 2015 Community with Update 3.
I appreciate you posting that link, I will take a look at it. I'm more than certain that this should be way easier than I'm making it.
I believe that it does provide .asmx pages though I'm not completely certain. I'm able to add it as a Service Reference with WCF I'm just not entirely sure how to get the appointment records from the Service once I've added it.
I'll look through your link and update this post. Thanks again.
Sep 01, 2016 12:22 PM|march11|LINK
I am not quite sure you should be creating Service Reference, I believe it should be a Web Reference, which is buried in VS2013 so I am sure it will be tough to find in VS2015. Let me see if I can find it.
Yea,. I found it, when you right click on project to add Service Reference, scroll to the bottom of the screen that opens and click on the button that says... Advanced.
then scroll to the bottom again and click on the button that says Add Web Reference.
then enter the URL to the ASMX pages. provide a name for the Web Reference on the right hand side. then click Add Reference. when this wizard builds out the connection it should be much easier to get your data, by opening the proxy then simply querying the
web functions from the service. You'll of course need to include the user name and password in your call, any other required parameters.
Sep 01, 2016 04:54 PM|VoidWhereProhibited|LINK
Thanks, I will certainly try that.
My big question is, though, what to do after I've gotten the reference. Do I put a new class together with the parameters and pass them in some way? That's part that I'm lost on. Do I create an ActionResult in the HomeController? Should I use a FileStream?
This is a large XML document with 3,000-5,000 lines that will need to be refactored and sent to another web service. What's the best method for getting all of that data and transmitting it?
Sep 01, 2016 07:47 PM|march11|LINK
5000 records is nothing, I send 40000 through an xml asmx connection with only minor delays because the hardware is not the fastest.
If you know the datatype coming back from the service you can load it straight into a datatable for example. I am not clear though when you say XML file. XML is what the web service will pass, it does not mean that you are getting the data in an xml file,
that is only the format.
you could very well be getting a datatable or dataset. That is what is cool about these services, a dataset can actually be strongly typed internally, so you know exactly what is coming through the pipe.
Sep 02, 2016 04:57 AM|Yohann Lu|LINK
For your case about ASMX and other Web Services, please go to the following forum for suitable help.
WCF, ASMX and other Web Services: