Unity Logo

XMLBeans Integration

Creating a service


  1. Create your Schema
  2. Create your XMLBeans
  3. Create your Service
  4. Register your service

Assuming that you know how to do steps 1 and 2, lets pick up at step 3. Create your service class:

Notice that we used the "Document" Types, not the "GetWeatherByZipCode" class. After you've created your service class you simply need to register it:

XFire will now expose your service as the "WeatherService" and will generate WSDL for you automatically!

XMLBeans with JSR 181

You may use your XMLBeans service with JSR 181 annotations. You need to set up a special service factory to create your service though:

Then you can create your service:

Problems with XMLBeans (XMLBeans Namespace Hack)

Due to some bugs in how XMLBeans handles StAX streams you may need to enable the "xmlbeans namespace hack". This just tells xfire to use the XMLBeans DOM to write to the outgoing xml stream instead of using the XMLBeans XMLStreamReader. You will need to enable this when:

1. You are using RPC/Literal services

2. Any of your operations contain parameters that are <complexType>s instead of <element>s in your schema.

To enable the fix simply do:

© 2003-2008 Codehaus