Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 9th, 2004, 06:34 AM
Registered User
 
Join Date: Apr 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Please help me with web methods

I've been days searching about this. I'm writing a web service that uses a class that is in a DLL. In some web methods it has to receive and return custom objects. The problem is that in the application, when I try to call the web method and pass the custom object it doesn't compile because the web service created it's own custom object and it can't be casted.

I tried to use the object created by the web service, but I get exceptions (Null reference errors).

What should I do? I understand that this issue has to be quite common.



Reply With Quote
  #2 (permalink)  
Old April 9th, 2004, 03:54 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I have created several web service methods that use some custom objects. When I reference the web service, I get object "stubs" much in the same whay you get function stubs in the reference map code. I haven't had any problems casting or using those mapped objects in my web methods.

What kind of problems are you getting when you try to cast the objects? What kinds of objects are you building? What types of data members are in the objects?

Peter
-------------------------
Work smarter, not harder
Reply With Quote
  #3 (permalink)  
Old April 10th, 2004, 09:45 AM
Registered User
 
Join Date: Apr 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Firstly I was trying with a class thas has some numeric attributes and an ArrayList. Then, I tried with a basic one with string fields, but always get the same error when compiling.

If I modify the Reference.cs file, then I can compile, but I get NullReferenceException error.

In the next try, I just pass the strings so the web service builds the object, but when I try to store it (using a HashTable) it isn't stored. Did you tried storing objects in a web service?

Reply With Quote
  #4 (permalink)  
Old April 10th, 2004, 11:10 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I'm sure what you mean by "storing objects in a web service".

Here's one of my web methods:

<WebMethod(Description:="Authenticates a ReminderService user.", MessageName:="LoadUserByLogin")> _
Public Function getUser(ByVal sUsername As String, ByVal sPassword As String) As userReturnArgs
    Return getUser(Nothing, sUsername, sPassword)
End Function

As you can see, the web service returns a custom data type. userReturnArgs is actually a class that contains another class. I have had no problems with doing this. I also have web methods that accept custom data types (my classes) as arguments and I have not had problems with this either.

Post some of the relevant code and maybe we can see what is wrong.

Peter
-------------------------
Work smarter, not harder
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Static methods spinjob BOOK: Professional C++ 7 March 12th, 2009 02:16 PM
two methods different results hahaha568 BOOK: Beginning SQL 0 February 10th, 2008 09:47 AM
METHODS magagulad Java GUI 3 May 15th, 2007 12:53 PM
Dispose() methods bpevangelista BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 2 May 12th, 2007 11:15 PM
Treeview Methods goldwinger C# 2005 0 December 29th, 2005 10:00 AM



All times are GMT -4. The time now is 06:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.