Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

web services interoperabilty  RSS feed

 
iggy ziggy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

A web service can return any custom data type but is that a good idea? I am developing a web service in Java and wonder whether I should limit the return types to a String containing the structure I want to return as an XML or whether I can return instances of custom classes and how that would be handled. I guess custom classes are just serialized (or?) and if I do not have a java client on the other side I cannot instance the class so that's no good, but even if I do have a Java client I then need to have the class definition on the client side anyhow...

How does it actually work?

Thanks,

A.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi "iggy ziggy",
Welcome to the JavaRanch. There aren't many rules around here, however adherence to the JavaRanch Naming Policy is one of them. Please change your display name to one that complies with that policy. Your cooperation is appreciated.
 
Rizwan Mohammad
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello iggy ziggy(strange name!)
Please read Designing WebServices- SUN Blue prints 4th chapter XML Processing & 5 th chapter Client Design, where lot of scenarios are discussed talking about when to use xml and when to use custom objects..
It doesnt matter even if you have non-java client.. Their tools generate client classes in corresponding languages given the wsdl document..
You dont have to distribute java classes to clients.. From the wsdl doc, the tool can create the necessary input, output classes..
But there are other things that you have to consider in deciding to use xml or java classes for input & output. for e.g
1) Data Size - How much data is being communicated back and forth per request/transaction (1K, 1M, 10M)?
2) Data frequency - How often will the data be "queried", daily, weekly, each time a user clicks some button on a UI?
3) Data Type - Structured text based data, images, engineering files etc?
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by iggy ziggy:
A web service can return any custom data type but is that a good idea?

No it isn't. However that doesn't mean that you should limit yourself to only primitive types either. Have a look at these topics:

Web services != RPC
WSDL question
Axis or Axis2
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!