Standalone JAX-WS with spring configuration

214 views
Skip to first unread message

minami

unread,
Jun 29, 2012, 1:51:44 AM6/29/12
to jsonweb...@googlegroups.com
Hi.

I'm trying to configure your codec to use with standalone apache cxf/apache camel/jax-ws application configured with spring.

So I've the following endpoint definition:

  <bean id="helloworldService" class="demo.contractlast.HelloWorldImpl" />
  <cxf-jaxws:endpoint
          xmlns="http://cxf.apache.org/jaxws"
          xmlns:hw="http://contractlast.demo/"
          id="HelloService"
          address="camel://direct:HelloService"
          serviceName="hw:HelloServiceService"
          endpointName="hw:HelloServiceEndpoint"
          implementor="#helloworldService">
    <cxf-jaxws:binding>
      <cxf-soap:soapBinding mtomEnabled="true" version="1.2"/>
    </cxf-jaxws:binding>
    <cxf-jaxws:features>
      <!-- Enables logging of SOAP messages. -->
      <cxf:logging xmlns="http://cxf.apache.org/core"/>
    </cxf-jaxws:features>
  </cxf-jaxws:endpoint>

And the following camel route

    <route>
      <from uri="jetty:http://localhost:9998/app/contractlast"/>
       <to uri="direct:HelloService"/>
    </route>

And service looks like so:

@WebService(endpointInterface = "demo.contractlast.HelloWorld",
            serviceName = "HelloWorld")
public class HelloWorldImpl implements HelloWorld { ... }

This service is accessible via SOAP over HTTP. So, I want to expose it also via JSON-RPC, but I stuck onto it. I don't understand how to do it in standalone application.

I've read this http://jax-ws-commons.java.net/json/ and I've tried to add
@BindingType(JSONBindingID.JSON_BINDING) annotation for HelloWorldImpl class
but it doesn't make any sense (with jsonwebservice and org.jvnet.jax-ws-commons, I've got the same error

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'HelloService': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Could not resolve a binding for https://jax-ws-commons.dev.java.net/json/

So, could anybody give me a hint if it's possible to use json codec in standalone application and give me some how-to instruction?
 

Sundar Murthi

unread,
Jun 29, 2012, 3:06:30 AM6/29/12
to jsonweb...@googlegroups.com

CFX is NOT default sun(oracle) jax-ws. cfx has it's own jax-ws implementation.  To use json-codec you must need to use metro.



If your new user to jax-ws, I recommend you to start using metro.

minami

unread,
Jun 29, 2012, 4:47:16 AM6/29/12
to jsonweb...@googlegroups.com
To use json-codec you must need to use metro.
So it's impossible to use your codec in standalone application1 outside of servlet container?
It's very sad. Just by the way: what are you think, is it even possible to implement json codec for CFX?

Sundar Murthi

unread,
Jun 29, 2012, 5:04:26 AM6/29/12
to jsonweb...@googlegroups.com
We have made attempt to implement it for  CFX.  But most CFX jax-ws internal variables are not accessible, to use generic based json generation with in codec.  So time to implement for cfx estimated higher.

If you must want to use json with cfx,  there are other json library available with cfx.   You may use it.  

The reason for attempt made to implement for cfx by not using existing library is,

1) There is problem with generating attribute and array with single object in it.  
2) Second most problem I had, cfx-json was using jettison json,  to generate json with jettson library need to convert all objects in to jettison object format.  It's quite slow.   Specially when it come to reporting or big user object,  To generate 2kb of json data we had difference of  10 times slow in cfx-json.
3) And the last but not least, it was bit handy to get start..


Hope it helps.

minami

unread,
Jun 29, 2012, 5:24:02 AM6/29/12
to jsonweb...@googlegroups.com


On Friday, June 29, 2012 4:04:26 PM UTC+7, jsonwebservice wrote:
We have made attempt to implement it for  CFX.  But most CFX jax-ws internal variables are not accessible, to use generic based json generation with in codec.  So time to implement for cfx estimated higher.
I'll try to post to cxf-dev mailing list
 
2) Second most problem I had, cfx-json was using jettison json,  to generate json with jettson library need to convert all objects in to jettison object format.  It's quite slow.   Specially when it come to reporting or big user object,  To generate 2kb of json data we had difference of  10 times slow in cfx-json.
For now I'm using jackson under cfx with jax-rs to implement rest api. It's quite simple:
  <cxf-jaxrs:server id="helloworldRestService" address="camel://direct:HelloWorldREST">
    <cxf-jaxrs:serviceBeans>
      <ref bean="helloworldService" />
    </cxf-jaxrs:serviceBeans>
    <cxf-jaxrs:providers>
      <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
    </cxf-jaxrs:providers>
So maybe it's possible to avoid jettison?

3) And the last but not least, it was bit handy to get start..
 
Hope it helps.
Somehow. Thanks.
 

Also another question: is it possible to run oracle's jax-ws implementation (with your codec) outside of servlet container?

Sundar Murthi

unread,
Jun 29, 2012, 5:32:55 AM6/29/12
to jsonweb...@googlegroups.com
Yes.  If you managed to run jax-ws outside servlet container, then you can.  Codec just has dependency of metro i.e oracle jax-ws.
Reply all
Reply to author
Forward
0 new messages