Webservice Data

I am trying to publish using webservice along with Navision and there is a doc file stating each step on how attached.

Now my question is below is the code where I am going to parse an xml file using the streamreader object and on processing where exactly is the data going to go, into a Navision database or where...I just need to know the concept

namespace R_and_M_XMLReader
    using Cust;
    using Items;
    using SaleOrd;

    class Program
        public void ReadfromXML()
            if (!Directory.Exists(@"E:\Old_R&M_XML_files"))

            if (Directory.Exists(@"E:\R&M_XML files"))
                Item_Service itm_svc = new Item_Service();
                itm_svc.UseDefaultCredentials = true;
                itm_svc.Url = @"http://absvii.abs.com:7087/DynamicsNAVRnM/WS/R%20&%20%20M/Page/Item";

                DirectoryInfo Item_di = new DirectoryInfo(@"E:\R&M_XML files");
                FileInfo[] Item_files = Item_di.GetFiles(@"*.xml");
                foreach (FileInfo file in Item_files)
                    StreamReader Item_sr = new StreamReader(file.DirectoryName + @"\" + file.Name);
                    XmlDocument ItemXML = new XmlDocument();
                    Item itm;
                    XmlNodeList nodelist = ItemXML.SelectNodes("/Items/item");
                    foreach (XmlNode node in nodelist)
                        string itmnum = String.Empty;
                            itm = new Item();
                            itm.No = node["itemNumber"].InnerText;
                            itmnum = itm.No;
                            itm_svc.Create(ref itm);
                            itm.Item_Category_Code = node["productGroup"].InnerText;
                            itm.Product_Group_Code = node["productGroup2"].InnerText;
                            itm.Description = node["articleDescription"].ChildNodes[1].InnerText.Substring(0,30);
                            itm.Business_Product_Group = node["kernelProductGroup"].InnerText;
                            itm.Units_per_Parcel = decimal.Parse(node["packingUnit"].InnerText);
                            itm.Excise_Prod_Posting_Group = node["customsTariffNumber"].InnerText;
                            itm.Country_Region_of_Origin_Code = node["itemProductionCountry"].InnerText;
                            itm.Net_Weight = decimal.Parse(node["netWeight"].InnerText);
                            itm.Minimum_Order_Quantity = decimal.Parse(node["minimumOrderQuantity"].InnerText);
                            itm.Reordering_Policy = Reordering_Policy.Lot_for_Lot;
                            itm.Large_Description = node["articleDescription"].ChildNodes[1].InnerText;
                            itm_svc.Update(ref itm);
                            Console.WriteLine("Item Created Successfully");
                        catch (Exception ex)

static void Main(string[] args)
            Program pg = new Program();

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rahul AgarwalTeam LeaderCommented:
they have items namespace which have properties and probably insert statements to insert/ update date directly to database.
They parse the XML the set the value of item namespace properties.
and after setting properties values they call itm_svc.update command to update data to database.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Moizsaif123Author Commented:
when im running this code and put a break point on this statement, it gives an error on this statement and raises an exeption, I have attached a screenshot showing the error..

itm_svc.Create(ref itm);
Moizsaif123Author Commented:
The Exception detail below....

System.Net.WebException was caught
  Message=The remote name could not be resolved: 'items'
       at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
       at System.Net.HttpWebRequest.GetRequestStream()
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       at R_and_M_XMLReader.items.Item_Service.Create(Item& Item) in C:\Users\abs_sali\Documents\Visual Studio 2010\Projects\R and M XMLReader\R and M XMLReader\Web References\items\Reference.cs:line 278
       at R_and_M_XMLReader.Program.ReadfromXML() in C:\Users\abs_sali\Documents\Visual Studio 2010\Projects\R and M XMLReader\R and M XMLReader\Program.cs:line 82
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.