cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nilupa Bandara <>
Subject [JiBX DataBinding] Question on handling Simple Types
Date Fri, 18 Jun 2010 00:58:36 GMT

Consider the following Java class which provides simple echoString service.

public interface EchoService {

    String echoString(String content);

I exposed it as a Web service using the following code.

EchoServiceImpl echoServiceImpl = new EchoServiceImpl();
ServerFactoryBean svrFactory = new ServerFactoryBean();
svrFactory.getServiceFactory().setDataBinding(new JiBXDataBinding());

It produces the correct output for the following input.

<soap:Envelope xmlns:soap="">
      <ns1:echoString xmlns:ns1="">

My question is the following.

When the CXF framework receives the message, it invokes the JiBXDataReader
to unmarshall  xml content which is "<ns1:arg0>Alice</ns1:arg0>".  However
it seems that I can't unmarshall it using
unmarshallingContext.unmarshallElement(..) method since UnmarhallingContext
can't be obtained for "<ns1:arg0>Alice</ns1:arg0>". That is because
"<ns1:arg0>Alice</ns1:arg0>" element doesn't corresponds to a Java classes
compiled with binding info. One work around would be to use
the JibxNullBindingFactory[2]  to imitate the IBindingFactory interface for
simple types.

So should we proceed with the above workaround /  Is there a better way of
doing it? Or should we completely ignore above case and support only the
exposure of Java beans compiled with binding information. (i.e. the
echoString method should be change to something like  Output
echoString(Input) where both Input, Output are Java beans compiled with
binding information. Input, Output act as wrapper classes for the string
content going to-and-from)

Any thoughts ?


[1] Updated JiBX DataBinding implementation code is available at :

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message