LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-01-2006, 10:01 AM   #1
megabot
Member
 
Registered: Aug 2005
Posts: 39

Rep: Reputation: 15
Sending Objects to a Webservice (Java)


I am trying to add Customer to a database (which is on the webservice side) by sending a Customer Object to the webservice. When the webservice receives the Customer Object it only has NULL values. So , none of the information (name, surname, address etc.) is filled in when the Webservice receives it.

Sending an integer to the Webservice works fine, receiving an array filled with Customer Objects from the Webservice works perfect. But sending a Customer object to the Webservice doesn't work properly.

I am really clueless right now how I am supposed to send an Object to a webservice. Is there anyone here who has experience with this kind of stuff. Help would be really appreciated. Thanks in advance.
 
Old 07-02-2006, 12:10 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Some web services might accept Java objects; most (AFAIK) don't. How would you communicate a Java object, for example, to a .Net web server?

Is this some particular web service I might know about (for example, Google)? Or is the web service in question one that you and your team have designed and implemented yourself? Or are you just curious?

Think of the web service itself as "an object", with various "method calls" that communicate with *your* object(s).

For whatever it's worth, this article might be of help:

http://www-128.ibm.com/developerwork...ry/ws-intwsdl/
http://www-128.ibm.com/developerwork...y/ws-intwsdl2/

Your .. PSM
 
Old 07-02-2006, 07:06 AM   #3
megabot
Member
 
Registered: Aug 2005
Posts: 39

Original Poster
Rep: Reputation: 15
It's a WebService written in Java, it is indeed designed by my team and we implemented it ourself yes. The WebService has a method called "addCustomer". The client will add a Customer using a GUI, when pressing the "Add Customer" button, the client will fill a Customer object with the given info from the GUI and this object will than be send to the WebService by using the client interface Classes generated from the WebService WSDL. The Customer Object is filled with data when at the client side, but when it is received on the server side all the values for a Customer (name, address etc.) are NULL.

Last edited by megabot; 07-02-2006 at 07:08 AM.
 
Old 07-02-2006, 02:24 PM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Again, please take a look at the links:
Deploying Web services with WSDL: Part 1
Deploying Web services with WSDL Part 2: SOAP

Please pay particular attention to the part about "Compound Data types" in Part 2. This might be your best bet.

And please consider that you should
Quote:
Think of the web service itself as "an object", with various "method calls" that communicate with *your* object(s).
What this means is that, even if you figure out how to pass an "object" (and I confess, I don't know how, or know if it's even possible or not), it's probably not a good idea. Because "objects" are (by definition) language- and platform- dependent, and introducing such dependencies defeats a large part of using web services in the first place!

IMHO .. PSM
 
Old 07-03-2006, 07:38 AM   #5
megabot
Member
 
Registered: Aug 2005
Posts: 39

Original Poster
Rep: Reputation: 15
I have already read that documentation, but thanks. About the objects, both my client and webservice are written in Java.

Thanks for the help.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving objects to file in java linuxmandrake Programming 2 04-10-2006 06:54 PM
java objects zaicheke Programming 3 03-23-2005 06:21 AM
sending Objects from Server to Client djgerbavore Programming 0 10-04-2004 12:09 PM
java arrays and objects titanium_geek Programming 13 03-07-2004 01:21 PM
Objects in Java? mikeshn Programming 0 06-11-2002 10:21 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration