Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

Need for NewDataSet when processing data from web service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
fergallydon@hotmail.com - 15 Aug 2007 10:06 GMT
I'm retrieving some data from a webservice as follows

       Dim RestXML As New Data.DataSet
       Dim returnedXML As System.Xml.XmlDataDocument

       RestXML.ReadXml(functionURL)
       returnedXML = New XmlDataDocument(RestXML)

The return is something like this..

 <?xml version="1.0" encoding="utf-8" ?>
- <CallResults>
   - <ServiceOutput>
         <accountBalance>46.5</accountBalance>
         <rentalPrice>3.5</rentalPrice>
         <purchasePrice>6.5</purchasePrice>
     </ServiceOutput>
   - <ServiceResult>
     <ResultCode>01</ResultCode>
     <ResultAdvisory>message</ResultAdvisory>
     </ServiceResult>
 </CallResults>

I extract the Result code as follows

       strReturncode = returnedXML.DocumentElement.SelectSingleNode("/
CallResults/ServiceResult/ResultCode").InnerText

However with different input parameters to functionURL the XML
returned can be as follows (ServiceOutput is empty)

<?xml version="1.0" encoding="utf-8" ?>
- <CallResults>
     <ServiceOutput />
   - <ServiceResult>
         <ResultCode>00</ResultCode>
         <ResultAdvisory>Message</ResultAdvisory>
     </ServiceResult>
 </CallResults>

In this case there is a failure unless I add "/NewDataSet" to identify
which element I want to extract as follows.

       strReturncode = returnedXML.DocumentElement.SelectSingleNode("/
NewDataSet/CallResults/ServiceResult/ResultCode").InnerText

Am I retrieving the response from the web service correctly. How can I
process it so that it works whether ServiceOutput is empty or not.

Thanks for reading.
John Saunders [MVP] - 15 Aug 2007 14:38 GMT
> I'm retrieving some data from a webservice as follows
>
[quoted text clipped - 44 lines]
> Am I retrieving the response from the web service correctly. How can I
> process it so that it works whether ServiceOutput is empty or not.

It would seem that you would have the same problem regardless of where you
got this XML from. Try loading the problem XML directly into an XmlDocument
and see if the problem still occurs.
Signature

John Saunders [MVP]


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.