Skip to main content

(Un-)marshalling all contents of an element and it's children to String

2 replies [Last post]
kittyhawk
Offline
Joined: 2005-05-06
Points: 0

Hi,

I'm trying to impIement an JAX-WS web service with JAXB data binding and I've got XML documents like this:

1123
bbb
1234

Since the payload-section is going to be very large and the business logic of the web service is going to pass it along to the service consumer, it only needs to bind the meta data to JavaBeans and to load/store the whole payload section in a String (or to get a Stream handle for wrapping it into a DataHandler).

I've tried several approaches and did a lot of research without any success until now.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Clive Brettingham-Moore

If it is in the document as XML then there is no way to avoid XML level
parsing.
JAXB does allow you to pick it up at that level and parse the basic XML
however you like using a DOM Handler
see http://forums.java.net/jive/thread.jspa?messageID=258243#258282

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
For additional commands, e-mail: users-help@metro.dev.java.net

Glen Mazza

That shouldn't be a problem with MTOM--bind your metadata to JAXB elements
and the payload to MTOM--just return a DataHandler for it.

For example, in my MTOM example here:
http://www.jroller.com/gmazza/date/20071102#NWSstep5, for the
getWeatherForecastResponse element, you should be able to add extra strings
and integers, etc. for the metadata (which would get subsequently
marshalled/unmarshalled to Java and XML) but save the DataHandler for the
payload.

HTH,
Glen

metro wrote:
>
> Hi,
>
> I'm trying to impIement an JAX-WS web service with JAXB data binding and
> I've got XML documents like this:
>
>
> 1123
>
bbb > 1234
>

>
> Since the payload-section is going to be very large and the business logic
> of the web service is going to pass it along to the service consumer, it
> only needs to bind the meta data to JavaBeans and to load/store the whole
> payload section in a String (or to get a Stream handle for wrapping it
> into a DataHandler).
>
> I've tried several approaches and did a lot of research without any
> success until now.
> [Message sent by forum member 'kittyhawk' (kittyhawk)]
>
> http://forums.java.net/jive/thread.jspa?messageID=284608
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
> For additional commands, e-mail: users-help@metro.dev.java.net
>
>
>

--
View this message in context: http://www.nabble.com/%28Un-%29marshalling-all-contents-of-an-element-an...
Sent from the Metro - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
For additional commands, e-mail: users-help@metro.dev.java.net