My company has a service running on our server(2008 R2) that makes API calls to our Volusion store to get new orders.The service converts the exported orders into QuoteWerks xml format for use in BusinessWorks.
I've been tasked with making some changes and I'm now trying to test the service on my workstation(Win7). I can't get my altered version to work when running on my workstation, nor can I get the original service to run correctly. Both versions post errors regarding no root element for the xml. As far as I can tell this means the returned value either wasn't xml or was literally nothing. The error is thrown on the doc.Load(reader):
public static string GetXmlStringFromUrl(string apiUrl)
{
XmlDocument doc = null;
XmlTextReader reader = null;
StringWriter strWriter = null;
XmlTextWriter xmlWriter = null;
try
{
using(WebClient client = new WebClient()) {
string s = client.Download(apiUrl);
EventLogger.WriteToLog(s,EventLogEntryType.Information);
}
reader = new XmlTextReader(apiUrl);
doc = new XmlDocument();
doc.Load(reader);
strWriter = new StringWriter();
xmlWriter = new XmlTextWriter(strWriter);
doc.WriteTo(xmlWriter);
}
I added the "using" block as an attempt to read the returned values and throw them into my event log before the error was thrown and see if there was a formatting error. The URL has this format, which I have tried to check for errors without success.
http://www.yourdomain.com/net/WebService.aspx?Login=jon_doe@volusion.com &EncryptedPassword=471757EA629DDFD10B75D92A2AD223DFC00AD2E74C1D342B23F3254EC9A4965114351E&SELECT_Columns=*
My problem is that everything I can think of that could cause a bad return can't be the problem because the original service continues to run on the server while I make this change.
So my question is this, why would a windows service get nothing back from an API call when the same service running on another pc using the exact same code gets usable results? What should I check to track this down?