axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Callahan <>
Subject Re: axis 1.1 and jaxb
Date Wed, 11 Aug 2004 19:03:24 GMT

An alternative to creating a custom serializer is to use the
doc/literal style service and use one of the 4 method signatures that
Axis allows.  You can inspect the incoming XML to determine what kind
of message you have received.  From there, use the utilities provided
by the JAXB api to translate the XML message into JAXB objects, and
perform your business logic.  Then, create output objects using JAXB
and serialize them to XML--return that from your web service method. 
So your webservice "controller" class could have a method like this:

public Document doService(Document body) throws AxisFault {

  // inspect the document to see what "kind" of message you have received..
  // deserialize the message
  jc = JAXBContext.newInstance(<your namespace>);
  u = jc.createUnmarshaller();
  m = jc.createMarshaller();
  requestObj = u.unmarshal(body);

  // perform your domain logic on this object

  // serialize and return your response
  returnDoc = XMLUtils.newDocument();
  m.marshal(responseObj, returnDoc);

   return returnDoc;


Sounds like creating a custom serializer would be cleaner, however. 
Have you been able to debug this InvocationTarget problem?


On Wed, 11 Aug 2004 15:26:42 +0200, Wierenga, R. - SPLXE
<> wrote:
> Hi !
> I'm trying to use jaxb as the (de)serialization mechanism for the provision
> of a document/literal style webservice. Has anyone succeeded in implementing
> this? I'm curious to know which steps i need to take.
> Steps i took so far are:
> * created a wsdl file including the schema for my complextypes
> * used axis wsdl2java tool to generate the skeleton, implementation and
> beans sources
> * created a custom JAXB serializer based on Castor serializer example
> * modified wsdd to use the new JAXB serializer for each compleyType and
> element defined in the schema
> * deployed stuff using adminclient
> * tested results using WSAD 5.1 Webservice explorer
> Problems which i encountered:
> * A call to the webservice results in a Soap fault
> (java.lang.reflect.InvocationTargetException)
> * The wsdl file generated by Axis after deployment is invalid, it does not
> contain the complexType definitions which were defined in the original wsdl.
> How could this happen? When I leave out the type mappings in my deploy.wsdd
> and redeploy it produces a valid wsdl file...strange.
> Kinds regards,
> Robin Wierenga
> **********************************************************************
> For information, services and offers, please visit our web site:
This e-mail and any attachment may contain confidential and privileged material intended for
the addressee only. If you are not the addressee, you are notified that no part of the e-mail
or any attachment may be disclosed, copied or distributed, and that any other action related
to this e-mail or attachment is strictly prohibited, and may be unlawful. If you have received
this e-mail by error, please notify the sender immediately by return e-mail, and delete this
message. Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries and/or its employees
shall not be liable for the incorrect or incomplete transmission of this e-mail or any attachments,
nor responsible for any delay in receipt.
> **********************************************************************

View raw message