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.

web service issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
esource - 01 Aug 2007 21:38 GMT
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
Peter Bromberg [C# MVP] - 01 Aug 2007 21:52 GMT
If I recall correctly, it will be happier returning an XmlNodeList or
XmlDocumentFragment. Try that.
Peter
Signature

Recursion: see Recursion
site:  http://www.eggheadcafe.com
unBlog:  http://petesbloggerama.blogspot.com
bogMetaFinder:    http://www.blogmetafinder.com

> hi all
> I created a web service with one web method:
[quoted text clipped - 24 lines]
> worked fine, just won't return it
> any help would be appreciated.  thanks
John Saunders [MVP] - 01 Aug 2007 23:34 GMT
> hi all
> I created a web service with one web method:
[quoted text clipped - 24 lines]
> 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.
Signature

John Saunders [MVP]

esource - 02 Aug 2007 15:03 GMT
On Aug 1, 5:34 pm, "John Saunders [MVP]" <john.saunders at
trizetto.com> wrote:

> > hi all
> > I created a web service with one web method:
[quoted text clipped - 35 lines]
>
> - 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

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.