DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 15 Aug 2007 02:06:19 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    unknown
          2    John Saunders [MVP] john.saunders at trizetto.com


Need for NewDataSet when processing data from web service   
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.
Date:Wed, 15 Aug 2007 02:06:19 -0700   Author:  

Re: Need for NewDataSet when processing data from web service   
wrote in message 
news:1187168779.072339.278700@22g2000hsm.googlegroups.com...

> 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.


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.
-- 
John Saunders [MVP]
Date:Wed, 15 Aug 2007 09:38:49 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us