File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes web service that takes a JAXB class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "web service that takes a JAXB class" Watch "web service that takes a JAXB class" New topic

web service that takes a JAXB class

Robyn Haas

Joined: Feb 28, 2002
Posts: 6
Forgive this question, but I'm very new to web services!

I've got an application that takes a xml document in a request parameter attribute of a HTTP post. This xml document validates to custom xsd I created and I currently use JAXB to unmarshall the xml so I can pull the data out and insert it into my database.

What I'd like to do instead is create a web service that receives the xml document in a soap message. Do I create a method that takes my JAXB generated class in the method signature and create the web service off of that method? How exactly do I create a web service that takes in custom xml? I also will want some authenticating data along with the xml like a username and password. Can someone point me in the right direction?

Robyn Haas<br />Sun Certified Programmer for the Java� 2 Platform
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
For authentication you can use either HTTP authentication or WS-Security (in the shape of WSS4J), links to both of which you'll find in the FAQ in my signature.

As to sending an XML document, you may want to look into the different WSDL styles, some of which allow you to send an XML document over SOAP as it is; there's a link to an introductory article in the FAQ as well.
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
did you look at the Message Style Web Service support from AXIS ?

RR Kumaran
SCJP 1.4
Robyn Haas

Joined: Feb 28, 2002
Posts: 6
Thanks, that helps! I also found this article last night that might get me going in the right direction: The article talks about integrating Castor and Axis and I'm hoping that I can use JAXB instead of the Castor. I'll also look into WSS4J.
I agree. Here's the link:
subject: web service that takes a JAXB class
It's not a secret anymore!