Re: SDO project plan accepted

2009-04-29 Thread Pradeep Fernando
Hi devs,

I ve just started my work on providing dynamic SDO databinding to the tool.
still in the initial phase. love to work together with gsoc cxf project as
it would save time of both of us.I went through the WSDL2Java code of CXF &
me & my mentor decided on using CXF tool over Axis2 one.

sorry for late response. I found this mail out in my CXF mailing list as
gmail have filtered it.

cheers.


Re: Need Help with JAX-WS and JAX-RS example

2009-04-29 Thread Eoghan Glynn
I'd suspect you've a mismatch between the version of
cxf-rt-frontend-jaxrs and the cxf-api jars.

The former depends on the Message.REQUEST_URI field, which is defined
in the latter.

This field was introduced on 2008-10-21, so you'll need a version of
the API jar from after this date (2.0.10/2.1.4/2.2 or later).
Preferably exactly the same version as you use for the JAX-RS stuff.

Cheers,
Eoghan

2009/4/29 cybercxf :
>
> When I run the RestClient.java, it is giving me error
>
> java.lang.NoSuchFieldError: REQUEST_URI
>
> Can someone help me, what should be the @Path. Is the code for using the
> same service class (HelloWorldImpl.java) for both JAX-WS, JAX-RS?
>
> Please see all the code below and let me know.
>
> thanks.
>
>
> Code
> 
>
>
> HelloWorld.java (Inteface)
> ===
>
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.WebParam.Mode;
>
> @WebService(name = "HelloWorld")
> public interface HelloWorld {
>void receive(@WebParam(name = "itemXML", mode = Mode.IN) String 
> itemXML);
> }
>
> HelloWorldImpl.java
> ==
>
> import javax.jws.WebMethod;
> import javax.jws.WebService;
> import javax.ws.rs.Consumes;
> import javax.ws.rs.POST;
> import javax.ws.rs.Path;
> import javax.ws.rs.PathParam;
>
> @Path("/HelloWorld")
> @WebService(endpointInterface = "org.openpipeline.services.HelloWorld",
> serviceName = "HelloWorld")
> @Consumes("application/xml")
> public class HelloWorldImpl implements HelloWorld{
>@WebMethod
>@POST
>@Path("/receive")
>public void receive(@PathParam("*/*")String itemXML) {
>System.out.println(itemXML);
>}
> }
>
> Server.java
> 
>
> import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
> import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
> import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
>
> public class Server {
>public static void main(String[] args){
>HelloWorldImpl implementor = new HelloWorldImpl();
>
>/*
> * Start JAX-WS service
> */
>JaxWsServerFactoryBean svrFactory = new 
> JaxWsServerFactoryBean();
>svrFactory.setServiceClass(HelloWorld.class);
>svrFactory.setAddress("http://localhost:9000/";);
>svrFactory.setServiceBean(implementor);
>svrFactory.create();
>
>/*
> * Start JAX-RS service
> */
>JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>sf.setResourceClasses(HelloWorldImpl.class);
>sf.setResourceProvider(HelloWorldImpl.class,
>new SingletonResourceProvider(new HelloWorldImpl()));
>sf.setAddress("http://localhost:9001/";);
>
>sf.create();
>
>}
> }
>
>
> RestClient.java
> 
>
> import org.apache.commons.httpclient.HttpClient;
> import org.apache.commons.httpclient.methods.PostMethod;
> import org.apache.commons.httpclient.methods.RequestEntity;
> import org.apache.commons.httpclient.methods.StringRequestEntity;
>
> public class RestClient {
>
>public static void main(String args[]) throws Exception {
>
>PostMethod post = new
> PostMethod("http://localhost:9001/HelloWorld/receive/";);
>post.addRequestHeader("Accept", "application/xml");
>RequestEntity entity = new StringRequestEntity("Hello 
> REST!",
> "application/xml", "ISO-8859-1");
>post.setRequestEntity(entity);
>HttpClient httpclient = new HttpClient();
>
>try {
>int result = httpclient.executeMethod(post);
>System.out.println("Response status code: " + result);
>System.out.println("Response body: ");
>} finally {
>// Release current connection to the connection pool 
> once you are
>// done
>post.releaseConnection();
>}
>
>System.out.println("\n");
>System.exit(0);
>}
> }
>
> Client.java
> 
>
> public class Client {
>public static void main(String[] args){
>JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>factory.getInInterceptors().add(new LoggingInInterceptor());
>factory.getOutInterceptors().add(new LoggingOutInterceptor());
>factory.setServiceClass(HelloWorld.class);
>
>factory.setAddress("http://localhost:9000/HelloWorld";);
>HelloWorld client = (HelloWorld) factory.create();
>Item item = new Item();
>item.importXML("Hello");
>client.receive(item.toString());
>}
> }
>
> --
> View this message in context: 
> http://www.nabble.com/Need-Help-with-JAX-WS-and-JAX-RS-example-tp23287998p23287998.html
> Sent 

Re: Need Help with JAX-WS and JAX-RS example

2009-04-29 Thread Eoghan Glynn
BTW to answer the other part of your question, it is possible use the
JAX-RS and JAX-WS annotations on the same implementation class.

See the BookStoreJaxrsJaxws[1] system test for an example.

Cheers,
Eoghan

[1] 
http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java

2009/4/29 Eoghan Glynn :
> I'd suspect you've a mismatch between the version of
> cxf-rt-frontend-jaxrs and the cxf-api jars.
>
> The former depends on the Message.REQUEST_URI field, which is defined
> in the latter.
>
> This field was introduced on 2008-10-21, so you'll need a version of
> the API jar from after this date (2.0.10/2.1.4/2.2 or later).
> Preferably exactly the same version as you use for the JAX-RS stuff.
>
> Cheers,
> Eoghan
>
> 2009/4/29 cybercxf :
>>
>> When I run the RestClient.java, it is giving me error
>>
>> java.lang.NoSuchFieldError: REQUEST_URI
>>
>> Can someone help me, what should be the @Path. Is the code for using the
>> same service class (HelloWorldImpl.java) for both JAX-WS, JAX-RS?
>>
>> Please see all the code below and let me know.
>>
>> thanks.
>>
>>
>> Code
>> 
>>
>>
>> HelloWorld.java (Inteface)
>> ===
>>
>> import javax.jws.WebParam;
>> import javax.jws.WebService;
>> import javax.jws.WebParam.Mode;
>>
>> @WebService(name = "HelloWorld")
>> public interface HelloWorld {
>>void receive(@WebParam(name = "itemXML", mode = Mode.IN) String 
>> itemXML);
>> }
>>
>> HelloWorldImpl.java
>> ==
>>
>> import javax.jws.WebMethod;
>> import javax.jws.WebService;
>> import javax.ws.rs.Consumes;
>> import javax.ws.rs.POST;
>> import javax.ws.rs.Path;
>> import javax.ws.rs.PathParam;
>>
>> @Path("/HelloWorld")
>> @WebService(endpointInterface = "org.openpipeline.services.HelloWorld",
>> serviceName = "HelloWorld")
>> @Consumes("application/xml")
>> public class HelloWorldImpl implements HelloWorld{
>>@WebMethod
>>@POST
>>@Path("/receive")
>>public void receive(@PathParam("*/*")String itemXML) {
>>System.out.println(itemXML);
>>}
>> }
>>
>> Server.java
>> 
>>
>> import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
>> import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
>> import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
>>
>> public class Server {
>>public static void main(String[] args){
>>HelloWorldImpl implementor = new HelloWorldImpl();
>>
>>/*
>> * Start JAX-WS service
>> */
>>JaxWsServerFactoryBean svrFactory = new 
>> JaxWsServerFactoryBean();
>>svrFactory.setServiceClass(HelloWorld.class);
>>svrFactory.setAddress("http://localhost:9000/";);
>>svrFactory.setServiceBean(implementor);
>>svrFactory.create();
>>
>>/*
>> * Start JAX-RS service
>> */
>>JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>>sf.setResourceClasses(HelloWorldImpl.class);
>>sf.setResourceProvider(HelloWorldImpl.class,
>>new SingletonResourceProvider(new HelloWorldImpl()));
>>sf.setAddress("http://localhost:9001/";);
>>
>>sf.create();
>>
>>}
>> }
>>
>>
>> RestClient.java
>> 
>>
>> import org.apache.commons.httpclient.HttpClient;
>> import org.apache.commons.httpclient.methods.PostMethod;
>> import org.apache.commons.httpclient.methods.RequestEntity;
>> import org.apache.commons.httpclient.methods.StringRequestEntity;
>>
>> public class RestClient {
>>
>>public static void main(String args[]) throws Exception {
>>
>>PostMethod post = new
>> PostMethod("http://localhost:9001/HelloWorld/receive/";);
>>post.addRequestHeader("Accept", "application/xml");
>>RequestEntity entity = new StringRequestEntity("Hello 
>> REST!",
>> "application/xml", "ISO-8859-1");
>>post.setRequestEntity(entity);
>>HttpClient httpclient = new HttpClient();
>>
>>try {
>>int result = httpclient.executeMethod(post);
>>System.out.println("Response status code: " + result);
>>System.out.println("Response body: ");
>>} finally {
>>// Release current connection to the connection pool 
>> once you are
>>// done
>>post.releaseConnection();
>>}
>>
>>System.out.println("\n");
>>System.exit(0);
>>}
>> }
>>
>> Client.java
>> 
>>
>> public class Client {
>>public static void main(String[] args){
>>JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>>factory.getInInterceptors().add(new LoggingInInterceptor());
>>factory.getOutInterceptors().add(

Re: Need Help with JAX-WS and JAX-RS example

2009-04-29 Thread cybercxf

I did but I am not sure if I am using right annotations of Restful services.
Can you verify that for me by taking a look at the code I had attached in 
my first post.

thanks.


Eoghan Glynn-4 wrote:
> 
> BTW to answer the other part of your question, it is possible use the
> JAX-RS and JAX-WS annotations on the same implementation class.
> 
> See the BookStoreJaxrsJaxws[1] system test for an example.
> 
> Cheers,
> Eoghan
> 
> [1]
> http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java
> 
> 2009/4/29 Eoghan Glynn :
>> I'd suspect you've a mismatch between the version of
>> cxf-rt-frontend-jaxrs and the cxf-api jars.
>>
>> The former depends on the Message.REQUEST_URI field, which is defined
>> in the latter.
>>
>> This field was introduced on 2008-10-21, so you'll need a version of
>> the API jar from after this date (2.0.10/2.1.4/2.2 or later).
>> Preferably exactly the same version as you use for the JAX-RS stuff.
>>
>> Cheers,
>> Eoghan
>>
>> 2009/4/29 cybercxf :
>>>
>>> When I run the RestClient.java, it is giving me error
>>>
>>> java.lang.NoSuchFieldError: REQUEST_URI
>>>
>>> Can someone help me, what should be the @Path. Is the code for using the
>>> same service class (HelloWorldImpl.java) for both JAX-WS, JAX-RS?
>>>
>>> Please see all the code below and let me know.
>>>
>>> thanks.
>>>
>>>
>>> Code
>>> 
>>>
>>>
>>> HelloWorld.java (Inteface)
>>> ===
>>>
>>> import javax.jws.WebParam;
>>> import javax.jws.WebService;
>>> import javax.jws.WebParam.Mode;
>>>
>>> @WebService(name = "HelloWorld")
>>> public interface HelloWorld {
>>>void receive(@WebParam(name = "itemXML", mode = Mode.IN) String
>>> itemXML);
>>> }
>>>
>>> HelloWorldImpl.java
>>> ==
>>>
>>> import javax.jws.WebMethod;
>>> import javax.jws.WebService;
>>> import javax.ws.rs.Consumes;
>>> import javax.ws.rs.POST;
>>> import javax.ws.rs.Path;
>>> import javax.ws.rs.PathParam;
>>>
>>> @Path("/HelloWorld")
>>> @WebService(endpointInterface = "org.openpipeline.services.HelloWorld",
>>> serviceName = "HelloWorld")
>>> @Consumes("application/xml")
>>> public class HelloWorldImpl implements HelloWorld{
>>>@WebMethod
>>>@POST
>>>@Path("/receive")
>>>public void receive(@PathParam("*/*")String itemXML) {
>>>System.out.println(itemXML);
>>>}
>>> }
>>>
>>> Server.java
>>> 
>>>
>>> import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
>>> import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
>>> import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
>>>
>>> public class Server {
>>>public static void main(String[] args){
>>>HelloWorldImpl implementor = new HelloWorldImpl();
>>>
>>>/*
>>> * Start JAX-WS service
>>> */
>>>JaxWsServerFactoryBean svrFactory = new
>>> JaxWsServerFactoryBean();
>>>svrFactory.setServiceClass(HelloWorld.class);
>>>svrFactory.setAddress("http://localhost:9000/";);
>>>svrFactory.setServiceBean(implementor);
>>>svrFactory.create();
>>>
>>>/*
>>> * Start JAX-RS service
>>> */
>>>JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>>>sf.setResourceClasses(HelloWorldImpl.class);
>>>sf.setResourceProvider(HelloWorldImpl.class,
>>>new SingletonResourceProvider(new HelloWorldImpl()));
>>>sf.setAddress("http://localhost:9001/";);
>>>
>>>sf.create();
>>>
>>>}
>>> }
>>>
>>>
>>> RestClient.java
>>> 
>>>
>>> import org.apache.commons.httpclient.HttpClient;
>>> import org.apache.commons.httpclient.methods.PostMethod;
>>> import org.apache.commons.httpclient.methods.RequestEntity;
>>> import org.apache.commons.httpclient.methods.StringRequestEntity;
>>>
>>> public class RestClient {
>>>
>>>public static void main(String args[]) throws Exception {
>>>
>>>PostMethod post = new
>>> PostMethod("http://localhost:9001/HelloWorld/receive/";);
>>>post.addRequestHeader("Accept", "application/xml");
>>>RequestEntity entity = new
>>> StringRequestEntity("Hello REST!",
>>> "application/xml", "ISO-8859-1");
>>>post.setRequestEntity(entity);
>>>HttpClient httpclient = new HttpClient();
>>>
>>>try {
>>>int result = httpclient.executeMethod(post);
>>>System.out.println("Response status code: " +
>>> result);
>>>System.out.println("Response body: ");
>>>} finally {
>>>// Release current connection to the connection
>>> pool once you are
>>>// done
>>>post.releaseConnection();
>>>}
>>>
>>>System.out.println("\n");
>>>  

Re: Need Help with JAX-WS and JAX-RS example

2009-04-29 Thread Eoghan Glynn
What sort of failure are you seeing?


2009/4/29 cybercxf :
>
> I did but I am not sure if I am using right annotations of Restful services.
> Can you verify that for me by taking a look at the code I had attached in
> my first post.
>
> thanks.