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, 01 Aug 2007 13:38:06 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    esource
          2    Peter Bromberg [C# MVP]
          3    John Saunders [MVP] john.saunders at trizetto.com
          4    esource


web service issue   
hi all
I created a web service with one web method:
<WebMethod()> Public Function RequestPremium(ByVal web_request As
XmlDocument) As XmlDocument

it basically accepts a xmldocument then queries a database and returns
results in a xmldocument
I've confirmed that the code in the web method works, it fails when
the web method tries to return the new xmldocument:
last couple of lines in web method...
o_xmlreturn.Save("C:\temp\WS.xml")   ' this works, xmldocument has
data and saves to the web server in c:temp
RequestPremium = o_xmlreturn ' this fails when it returns back to
calling program

my calling program is just a test windows vb.net app.  the calling
lines are
ws_webservice = New WebService.POCservice  ' web reference
ws_webservice.Credentials = New System.Net.NetworkCredential("user",
"pwd", "domain")
xml_return = ws_WIS_webservice.RequestPremium(xml_send)

error message in calling program is:
"system.invalidcastexception: specified cast is not valid"

can you return a xmldocument in a web service? I passed one and it
worked fine, just won't return it
any help would be appreciated.  thanks
Date:Wed, 01 Aug 2007 13:38:06 -0700   Author:  

RE: web service issue   
If I recall correctly, it will be happier returning an XmlNodeList or 
XmlDocumentFragment. Try that.
Peter
-- 
Recursion: see Recursion
site:  http://www.eggheadcafe.com
unBlog:  http://petesbloggerama.blogspot.com
bogMetaFinder:    http://www.blogmetafinder.com



"esource" wrote:


> hi all
> I created a web service with one web method:
> <WebMethod()> Public Function RequestPremium(ByVal web_request As
> XmlDocument) As XmlDocument
> 
> it basically accepts a xmldocument then queries a database and returns
> results in a xmldocument
> I've confirmed that the code in the web method works, it fails when
> the web method tries to return the new xmldocument:
> last couple of lines in web method...
> o_xmlreturn.Save("C:\temp\WS.xml")   ' this works, xmldocument has
> data and saves to the web server in c:temp
> RequestPremium = o_xmlreturn ' this fails when it returns back to
> calling program
> 
> my calling program is just a test windows vb.net app.  the calling
> lines are
> ws_webservice = New WebService.POCservice  ' web reference
> ws_webservice.Credentials = New System.Net.NetworkCredential("user",
> "pwd", "domain")
> xml_return = ws_WIS_webservice.RequestPremium(xml_send)
> 
> error message in calling program is:
> "system.invalidcastexception: specified cast is not valid"
> 
> can you return a xmldocument in a web service? I passed one and it
> worked fine, just won't return it
> any help would be appreciated.  thanks
> 
> 
Date:Wed, 1 Aug 2007 13:52:01 -0700   Author:  

Re: web service issue   
"esource"  wrote in message 
news:1186000686.219397.65420@l70g2000hse.googlegroups.com...

> hi all
> I created a web service with one web method:
> <WebMethod()> Public Function RequestPremium(ByVal web_request As
> XmlDocument) As XmlDocument
>
> it basically accepts a xmldocument then queries a database and returns
> results in a xmldocument
> I've confirmed that the code in the web method works, it fails when
> the web method tries to return the new xmldocument:
> last couple of lines in web method...
> o_xmlreturn.Save("C:\temp\WS.xml")   ' this works, xmldocument has
> data and saves to the web server in c:temp
> RequestPremium = o_xmlreturn ' this fails when it returns back to
> calling program
>
> my calling program is just a test windows vb.net app.  the calling
> lines are
> ws_webservice = New WebService.POCservice  ' web reference
> ws_webservice.Credentials = New System.Net.NetworkCredential("user",
> "pwd", "domain")
> xml_return = ws_WIS_webservice.RequestPremium(xml_send)
>
> error message in calling program is:
> "system.invalidcastexception: specified cast is not valid"
>
> can you return a xmldocument in a web service? I passed one and it
> worked fine, just won't return it
> any help would be appreciated.  thanks


You say that the exception is in the calling code, yet you posted the code 
of the service. Did you look at the calling code (that is, at the proxy 
class)?

If you look at your proxy class (Reference.vb usually), you'll see that the 
proxy method returns XmlNode, not XmlDocument.
-- 
John Saunders [MVP]
Date:Wed, 1 Aug 2007 18:34:33 -0400   Author:  

Re: web service issue   
On Aug 1, 5:34 pm, "John Saunders [MVP]" <john.saunders at
trizetto.com> wrote:

> "esource"  wrote in message
>
> news:1186000686.219397.65420@l70g2000hse.googlegroups.com...
>
>
>
>
>
> > hi all
> > I created a web service with one web method:
> > <WebMethod()> Public Function RequestPremium(ByVal web_request As
> > XmlDocument) As XmlDocument
>
> > it basically accepts a xmldocument then queries a database and returns
> > results in a xmldocument
> > I've confirmed that the code in the web method works, it fails when
> > the web method tries to return the new xmldocument:
> > last couple of lines in web method...
> > o_xmlreturn.Save("C:\temp\WS.xml")   ' this works, xmldocument has
> > data and saves to the web server in c:temp
> > RequestPremium = o_xmlreturn ' this fails when it returns back to
> > calling program
>
> > my calling program is just a test windows vb.net app.  the calling
> > lines are
> > ws_webservice = New WebService.POCservice  ' web reference
> > ws_webservice.Credentials = New System.Net.NetworkCredential("user",
> > "pwd", "domain")
> > xml_return = ws_WIS_webservice.RequestPremium(xml_send)
>
> > error message in calling program is:
> > "system.invalidcastexception: specified cast is not valid"
>
> > can you return a xmldocument in a web service? I passed one and it
> > worked fine, just won't return it
> > any help would be appreciated.  thanks
>
> You say that the exception is in the calling code, yet you posted the code
> of the service. Did you look at the calling code (that is, at the proxy
> class)?
>
> If you look at your proxy class (Reference.vb usually), you'll see that the
> proxy method returns XmlNode, not XmlDocument.
> --
> John Saunders [MVP]- Hide quoted text -
>
> - Show quoted text -


thanks both of you.
Your right, I checked the web reference in my calling program in
reference.vb and the implementation was xmlnode even though I declared
it as xmldocument in my web service. I changed it and it worked.
thanks again
Date:Thu, 02 Aug 2007 07:03:42 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


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