REVISED QUESTION
I have revised the original question (as seen below) so that I can mark a part of the problem as answered. So here goes:
I have built a tool to import sales orders from customer stores (magento) for integration into our legacy order processing system. I have five stores to import from. One of them has HTTP Authentication set on its store and my API Login fails because of this. How do I get past this?
ORIGINAL QUESTION (Title: Importing Sales Orders from Magento Using C#: There is an error in XML document (2, 372)):
I have built a tool to import sales orders from customer stores (magento) for integration into our legacy order processing system. I have five stores to import from. Three work fine.
-
PROBLEM 1: The fourth store throws up this exception upon executing
the salesOrderList() call:A first chance exception of type ‘System.InvalidOperationException’ occurred in System.Xml.dll
There is an error in XML document (2, 372).
The login succeeds, I am able to enumerate attribute values, etc.
But I am unable to run thesalesOrderList()function with any
filter (andnulltoo). It would be great if someone has experience
with this and can point me in the right direction. - PROBLEM 2: The fifth store has HTTP authorization to access its
main magento page. I have only worked with API User Name and API Key.
But it looks like I have to cross the HTTP Authorization hurdle to
get to the API login stage. TheLogin()function of magento web
service takes only the API User Name and API Key. Not sure how to
handle the extra layer of HTTP Authentication. Can anyone help?
This will happen often, you just got lucky and it’s the first time you’re having this problem.
What you can do is using fiddler verify why are you receiving a bad XML format, as .NET only parses it and sees that Magento did not sent anything that is worth of trying as it’s wrongly created.
Normally you end up parsing the raw responses from Magento as it’s way safer, or use XmlRpc calls.
But for now, check as you have more than one to test, the difference between the responses in fiddler.
Regarding your authentication, you need to ask the host for the credentials, and add them to your request as a new
NetworkCredentialsobject in the correct property of your service object.