Re: CXF @WebServiceProvider deployment issue

2007-12-20 Thread Nino Saturnino Martinez Vazquez Wael
My best guess are that its a spring error that tells you that it could 
not call the default constructor of the class backing the MessageRouter. 
In your case its the messagerouterservice..


Do this seem to give any hints?

regards

Barlotta, Michael [USA] wrote:

Hello, I am using CXF 2.0.3 and am deploying an appliation to JBoss
using Spring and packaged as a WAR.
 
On JBoss startup I get the following error:BeanCreationException: Error

creating bean with name 'MessageRouter': Invocation of init method
failed; nested exception is java.lang.NullPointerException
 
Any idea what is causing this?
 
Thanks!

Mike
 
//- Java Code Annotations
 
@WebServiceProvider(

serviceName=MessageRouterService,
portName=RoutePortType,
targetNamespace=http://x/;,
wsdlLocation=WEB-INF/wsdl/MessageRouter.wsdl
)
@ServiceMode(Service.Mode.PAYLOAD)
public class MessageRouterEndpoint implements ProviderSource{
 
 
public Source invoke(Source payload) {

...
}
}
 
//- Spring config

beans xmlns=http://www.springframework.org/schema/beans;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:jaxws=http://cxf.apache.org/jaxws;
xmlns:soap=http://cxf.apache.org/bindings/soap;
xsi:schemaLocation=
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd 
http://cxf.apache.org/bindings/soap

http://cxf.apache.org/schemas/configuration/soap.xsd;
 
import resource=classpath:META-INF/cxf/cxf.xml /

import resource=classpath:META-INF/cxf/cxf-extension-soap.xml /
import resource=classpath:META-INF/cxf/cxf-servlet.xml /
 
jaxws:endpoint 
id=MessageRouter 
implementor=#MessageRouterService 
address=/fxml/route /

...
 
//- Stack Trace 
 
2007-12-19 17:08:16,591 55859 ERROR [STDERR] (main:) Dec 19, 2007

5:08:16 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service {http://x/}MessageRouterService from WSDL:
WEB-INF/wsdl/MessageRouter.wsdl
2007-12-19 17:08:16,778 56046 ERROR
[org.springframework.web.context.ContextLoader] (main:) Context
initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'MessageRouter': Invocation of init method failed; nested
exception is java.lang.NullPointerException
Caused by: 
java.lang.NullPointerException

 at
org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilde
r.java:226)
 at
org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilde
r.java:150)
 at
org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:
117)
 at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildService
FromWSDL(ReflectionServiceFactoryBean.java:257)
 at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeSe
rviceModel(ReflectionServiceFactoryBean.java:331)
 at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(Refle
ctionServiceFactoryBean.java:151)
 at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsService
FactoryBean.java:93)
 at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(
AbstractWSDLBasedEndpointFactory.java:74)
 at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:
108)
 at
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBea
n.java:147)
 at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:288)
 at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:228)
 at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:179)
 at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:341)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at ...
 

  


--
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684



Re: JAXB Unmarshalling

2007-12-20 Thread Sergey Beryozkin
That's pretty interesting all right.

I would say that there might not be much point in dealing directly with 
JAXBContext and pretend
that your code is so light and free :-)

Cheers, Sergey

- Original Message - 
From: Liu, Jervis [EMAIL PROTECTED]
To: cxf-user@incubator.apache.org
Sent: Thursday, December 20, 2007 7:18 AM
Subject: RE: JAXB Unmarshalling


 
 -Original Message-
 From: Sergey Beryozkin [mailto:[EMAIL PROTECTED]
 Sent: 2007年12月19日 22:40
 To: cxf-user@incubator.apache.org
 Subject: Re: JAXB Unmarshalling
 
 By the way, can this approach (which uses JAXBContexts) work for you in
 CXF? :
 
 http://weblogs.java.net/blog/mhadley/archive/2006/03/restful_web_ser_1.
 html
 
 [Liu, Jervis] You don’t have to use JAX-WS Dispatch API in this case. Once 
 you grab the InputStream from HTTPClient (or other lightweight http client 
 stack), you can call JAXB to marshal the response to your Customer object. 
 There is no point to use a heavy stack like a JAX-WS runtime to do such a 
 simple task. Following code snippet should do the job: 
 
public Object getObjectFromInputStream (ClassObject type,  InputStream 
 is) {
try {
JAXBContext context = getJAXBContext(type);
Unmarshaller unmarshaller = context.createUnmarshaller();
return unmarshaller.unmarshal(is);
} catch (JAXBException e) {
e.printStackTrace(); 
}
 
return null;
}
 
private JAXBContext getJAXBContext(Class type) throws JAXBException {
synchronized (jaxbContexts) {
JAXBContext context = jaxbContexts.get(type);
if (context == null) {
context = JAXBContext.newInstance(type);
jaxbContexts.put(type, context);
}
return context;
}
}
 
static MapClass, JAXBContext jaxbContexts = new WeakHashMapClass, 
 JAXBContext();
 
 You'd still need a schema describing the data like Customer, etc...
 Cheers. Sergey
 
 
 
 - Original Message -
 From: Eric Le Goff [EMAIL PROTECTED]
 To: cxf-user@incubator.apache.org
 Sent: Tuesday, December 18, 2007 4:34 PM
 Subject: JAXB Unmarshalling
 
 
 I am going on playing with the restful_jaxrs sample demo
 
 
  In the Client.java there are these lines
 
  ...
  URL url = new
 URL(http://localhost:9000/customerservice/customers/123;);
 InputStream in = url.openStream();
 System.out.println(getStringFromInputStream(in));
  
 
 
  What if I did not want to display the XML content (ie the XML
  representation of customer whose Id is 123)
  But rather I would like to get the actual instance of Customer with id is 
  123
 
  Is there some Unmarshalling method to do that , something like
 
  ...
  URL url = new
 URL(http://localhost:9000/customerservice/customers/123;);
 InputStream in = url.openStream();
 
  // Hypothetic code
  Customer customer = (Customer) getObjectFromInputStream(in);
  ...
 
  How would I implement this
 
  Object getObjectFromInputStream(InputStream in)
 
  method ?
 
  I guess I would have to get a JaxbContext before I can get an
 Unmarshaller ?
 
 
  Thanks for your help
 
  Eric
 
 
 
 
  --
  Eric Le Goff
 
 
 IONA Technologies PLC (registered in Ireland)
 Registered Number: 171387
 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
 
 
 IONA Technologies PLC (registered in Ireland)
 Registered Number: 171387
 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland



IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


java2wsdl not working?

2007-12-20 Thread Nino Saturnino Martinez Vazquez Wael

Hi

In my tour de cxf, i've now come to the point where I have a test that 
checks that the wsdl scheme are registered, and another test that checks 
that its looking okay. Next step are to test if the endpoints are 
working. Since im using jaxws it seems that I need a wsdl for this, 
inorder to create a servicebean. So I decided to get one generated for 
me using the java2wsdl plugin for maven[1].


However my test are failing with an exception when trying to generate 
the servicebean:


org.apache.cxf.service.factory.ServiceConstructionException: Could not 
find definition for service 
{http://jayway.com/hello_world_soap_http}HelloWorld.
   at 
org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:114)
   at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:286)
   at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:379)
   at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:173)
   at 
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:98)

   at com.jayway.GreeterTest.testEndpoint(GreeterTest.java:46)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

   at java.lang.reflect.Method.invoke(Method.java:585)

its the last line here that generates the error:

   ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
   URL resource = getClass().getResource(HelloWorld.wsdl);
   assertNotNull(resource);
   bean.setWsdlURL(resource.toString());
   bean.setBus(bus);
   bean.setServiceClass(HelloWorldImpl.class);
   HelloWorldImpl helloWorld = new HelloWorldImpl();
   BeanInvoker invoker = new BeanInvoker(helloWorld);

--Service service = bean.create();

I dont understand how this is possible, since I've run java2wsdl... But 
as im new I could be doing something wrong..




To get the complete project go here, and take a look in greetertest.java 
in package com.jayway :

http://www.fileshost.com/en/file/22660/basic-zip.html


[1]=http://cwiki.apache.org/CXF20DOC/maven-integration-and-plugin.html



--
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684



RE: JAXB Unmarshalling

2007-12-20 Thread Liu, Jervis
Well, if you REALLY want, you can hide the calling of JAXB in an util, for 
example you can extend HTTP Client to make it aware of a JAXBContext and be 
able to accept and return a JAXB object, for example following code:

String inputFile = 
client.getClass().getResource(update_customer.txt).getFile();
File input = new File(inputFile);
PutMethod put = new 
PutMethod(http://localhost:9000/customerservice/customers;);
RequestEntity entity = new FileRequestEntity(input, text/xml; 
charset=ISO-8859-1);
put.setRequestEntity(entity);
HttpClient httpclient = new HttpClient();
int result = httpclient.executeMethod(put);
String response = put.getResponseBodyAsString()

Will become:

PutMethod put = new 
PutMethod(http://localhost:9000/customerservice/customers;);
Customer customer = new Customer();
RequestEntity entity = new JAXBRequestEntity(customer);
put.setRequestEntity(entity);
HttpClient httpclient = new JAXBHttpClient(jaxbcontext);
int result = httpclient.executeMethod(put);
Customer updatedCustomer = put.getResponseBodyAsJAXB()

Of course, you can also add some nice things such as handle checked exception 
in this HTTP Client extension, so that it becomes:
  try {
int result = httpclient.executeMethod(put);
Customer updatedCustomer = put.getResponseBodyAsJAXB()
   } catch (CustomerNotFoundException e) {
   } catch (WebServiceException e)  {
   }

Does this make sense?

Cheers,
Jervis
 -Original Message-
 From: Sergey Beryozkin [mailto:[EMAIL PROTECTED]
 Sent: 2007年12月20日 17:54
 To: cxf-user@incubator.apache.org
 Subject: Re: JAXB Unmarshalling
 
 That's pretty interesting all right.
 
 I would say that there might not be much point in dealing directly with
 JAXBContext and pretend
 that your code is so light and free :-)
 
 Cheers, Sergey
 
 - Original Message -
 From: Liu, Jervis [EMAIL PROTECTED]
 To: cxf-user@incubator.apache.org
 Sent: Thursday, December 20, 2007 7:18 AM
 Subject: RE: JAXB Unmarshalling
 
 
 
  -Original Message-
  From: Sergey Beryozkin [mailto:[EMAIL PROTECTED]
  Sent: 2007年12月19日 22:40
  To: cxf-user@incubator.apache.org
  Subject: Re: JAXB Unmarshalling
 
  By the way, can this approach (which uses JAXBContexts) work for you in
  CXF? :
 
 
 http://weblogs.java.net/blog/mhadley/archive/2006/03/restful_web_ser_1.
  html
 
  [Liu, Jervis] You don’t have to use JAX-WS Dispatch API in this case. Once
 you grab the InputStream from HTTPClient (or other lightweight http client
 stack), you can call JAXB to marshal the response to your Customer object.
 There is no point to use a heavy stack like a JAX-WS runtime to do such a
 simple task. Following code snippet should do the job:
 
 public Object getObjectFromInputStream (ClassObject type,
 InputStream is) {
 try {
 JAXBContext context = getJAXBContext(type);
 Unmarshaller unmarshaller = context.createUnmarshaller();
 return unmarshaller.unmarshal(is);
 } catch (JAXBException e) {
 e.printStackTrace();
 }
 
 return null;
 }
 
 private JAXBContext getJAXBContext(Class type) throws
 JAXBException {
 synchronized (jaxbContexts) {
 JAXBContext context = jaxbContexts.get(type);
 if (context == null) {
 context = JAXBContext.newInstance(type);
 jaxbContexts.put(type, context);
 }
 return context;
 }
 }
 
 static MapClass, JAXBContext jaxbContexts = new
 WeakHashMapClass, JAXBContext();
 
  You'd still need a schema describing the data like Customer, etc...
  Cheers. Sergey
 
 
 
  - Original Message -
  From: Eric Le Goff [EMAIL PROTECTED]
  To: cxf-user@incubator.apache.org
  Sent: Tuesday, December 18, 2007 4:34 PM
  Subject: JAXB Unmarshalling
 
 
  I am going on playing with the restful_jaxrs sample demo
  
  
   In the Client.java there are these lines
  
   ...
   URL url = new
  URL(http://localhost:9000/customerservice/customers/123;);
  InputStream in = url.openStream();
  System.out.println(getStringFromInputStream(in));
   
  
  
   What if I did not want to display the XML content (ie the XML
   representation of customer whose Id is 123)
   But rather I would like to get the actual instance of Customer with id is
 123
  
   Is there some Unmarshalling method to do that , something like
  
   ...
   URL url = new
  URL(http://localhost:9000/customerservice/customers/123;);
  InputStream in = url.openStream();
  
   // Hypothetic code
   Customer customer = (Customer) getObjectFromInputStream(in);
   ...
  
   How would I implement this
  
   Object getObjectFromInputStream(InputStream in)
  
   method ?
  
   I guess I would have to get a JaxbContext before I can get an
  Unmarshaller ?
  
  
   Thanks for your help
  
   Eric
  
 

Re: JAXB Unmarshalling

2007-12-20 Thread Eric Le Goff
Jervis,

Thanks for the tips which was exactly what I had been expecting

 [Liu, Jervis] You don't have to use JAX-WS Dispatch API in this case. Once 
 you grab the InputStream from HTTPClient (or other lightweight http client 
 stack), you can call JAXB to marshal the response to your Customer object. 
 There is no point to use a heavy stack like a JAX-WS runtime to do such a 
 simple task. Following code snippet should do the job:

 public Object getObjectFromInputStream (ClassObject type,  InputStream 
 is) {


BTW I had to replace with
public Object getObjectFromInputStream (Class? type,  InputStream is) {
so that I could call a getObjectFromInputStream(Customer.class, is)


Would not it be nice if this piece of code was part of CXF , because I
guess I am not the only one who needs this



-- 
Eric Le Goff


Re: JAXB Unmarshalling

2007-12-20 Thread Sergey Beryozkin
This is a nice refactoring effort and indeed the code looks simplier.

My point was not really to do with the fact that the code in your original 
proposal was a bit verbose.

IMHO it's kind of trying to catch 2 rabbits at the same time : attempt to write 
just a simple HTTP code and still expect the
runtime to nicely map the incoming data into classes like Customer. 
In the end one does not get the flexibilty the client code can get from 
technologies like XPath (as far as writing a robust cliend code is concerned). 
And one needs to write manually some utility code which will map the in XMl to 
*generated* types like Customer. What's the point ?

I'd either go for a pure XML approach or would use a description language to do 
all the client bootsrapping stuff for me.

Cheers, Sergey



 Well, if you REALLY want, you can hide the calling of JAXB in an util, for 
 example you can extend HTTP Client to make it aware of a JAXBContext and be 
 able to accept and return a JAXB object, for example following code:
 
String inputFile = 
 client.getClass().getResource(update_customer.txt).getFile();
File input = new File(inputFile);
PutMethod put = new 
 PutMethod(http://localhost:9000/customerservice/customers;);
RequestEntity entity = new FileRequestEntity(input, text/xml; 
 charset=ISO-8859-1);
put.setRequestEntity(entity);
HttpClient httpclient = new HttpClient();
int result = httpclient.executeMethod(put);
String response = put.getResponseBodyAsString()
 
 Will become:
 
PutMethod put = new 
 PutMethod(http://localhost:9000/customerservice/customers;);
Customer customer = new Customer();
RequestEntity entity = new JAXBRequestEntity(customer);
put.setRequestEntity(entity);
HttpClient httpclient = new JAXBHttpClient(jaxbcontext);
int result = httpclient.executeMethod(put);
Customer updatedCustomer = put.getResponseBodyAsJAXB()
 
 Of course, you can also add some nice things such as handle checked exception 
 in this HTTP Client extension, so that it becomes:
  try {
int result = httpclient.executeMethod(put);
Customer updatedCustomer = put.getResponseBodyAsJAXB()
   } catch (CustomerNotFoundException e) {
   } catch (WebServiceException e)  {
   }
 
 Does this make sense?
 
 Cheers,
 Jervis
 -Original Message-
 From: Sergey Beryozkin [mailto:[EMAIL PROTECTED]
 Sent: 2007年12月20日 17:54
 To: cxf-user@incubator.apache.org
 Subject: Re: JAXB Unmarshalling
 
 That's pretty interesting all right.
 
 I would say that there might not be much point in dealing directly with
 JAXBContext and pretend
 that your code is so light and free :-)
 
 Cheers, Sergey
 
 - Original Message -
 From: Liu, Jervis [EMAIL PROTECTED]
 To: cxf-user@incubator.apache.org
 Sent: Thursday, December 20, 2007 7:18 AM
 Subject: RE: JAXB Unmarshalling
 
 
 
  -Original Message-
  From: Sergey Beryozkin [mailto:[EMAIL PROTECTED]
  Sent: 2007年12月19日 22:40
  To: cxf-user@incubator.apache.org
  Subject: Re: JAXB Unmarshalling
 
  By the way, can this approach (which uses JAXBContexts) work for you in
  CXF? :
 
 
 http://weblogs.java.net/blog/mhadley/archive/2006/03/restful_web_ser_1.
  html
 
  [Liu, Jervis] You don’t have to use JAX-WS Dispatch API in this case. Once
 you grab the InputStream from HTTPClient (or other lightweight http client
 stack), you can call JAXB to marshal the response to your Customer object.
 There is no point to use a heavy stack like a JAX-WS runtime to do such a
 simple task. Following code snippet should do the job:
 
 public Object getObjectFromInputStream (ClassObject type,
 InputStream is) {
 try {
 JAXBContext context = getJAXBContext(type);
 Unmarshaller unmarshaller = context.createUnmarshaller();
 return unmarshaller.unmarshal(is);
 } catch (JAXBException e) {
 e.printStackTrace();
 }
 
 return null;
 }
 
 private JAXBContext getJAXBContext(Class type) throws
 JAXBException {
 synchronized (jaxbContexts) {
 JAXBContext context = jaxbContexts.get(type);
 if (context == null) {
 context = JAXBContext.newInstance(type);
 jaxbContexts.put(type, context);
 }
 return context;
 }
 }
 
 static MapClass, JAXBContext jaxbContexts = new
 WeakHashMapClass, JAXBContext();
 
  You'd still need a schema describing the data like Customer, etc...
  Cheers. Sergey
 
 
 
  - Original Message -
  From: Eric Le Goff [EMAIL PROTECTED]
  To: cxf-user@incubator.apache.org
  Sent: Tuesday, December 18, 2007 4:34 PM
  Subject: JAXB Unmarshalling
 
 
  I am going on playing with the restful_jaxrs sample demo
  
  
   In the Client.java there are these lines
  
   ...
   URL url = new
  URL(http://localhost:9000/customerservice/customers/123;);
  InputStream in 

Re: java2wsdl not working?

2007-12-20 Thread Nino Saturnino Martinez Vazquez Wael
it's my fault I pointed the java2wsdl to a interface and not the actual 
implementation.


Nino Saturnino Martinez Vazquez Wael wrote:

Hi

In my tour de cxf, i've now come to the point where I have a test that 
checks that the wsdl scheme are registered, and another test that 
checks that its looking okay. Next step are to test if the endpoints 
are working. Since im using jaxws it seems that I need a wsdl for 
this, inorder to create a servicebean. So I decided to get one 
generated for me using the java2wsdl plugin for maven[1].


However my test are failing with an exception when trying to generate 
the servicebean:


org.apache.cxf.service.factory.ServiceConstructionException: Could not 
find definition for service 
{http://jayway.com/hello_world_soap_http}HelloWorld.
   at 
org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:114) 

   at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:286) 

   at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:379) 

   at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:173) 

   at 
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:98) 


   at com.jayway.GreeterTest.testEndpoint(GreeterTest.java:46)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 

   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 


   at java.lang.reflect.Method.invoke(Method.java:585)

its the last line here that generates the error:

   ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
   URL resource = getClass().getResource(HelloWorld.wsdl);
   assertNotNull(resource);
   bean.setWsdlURL(resource.toString());
   bean.setBus(bus);
   bean.setServiceClass(HelloWorldImpl.class);
   HelloWorldImpl helloWorld = new HelloWorldImpl();
   BeanInvoker invoker = new BeanInvoker(helloWorld);

--Service service = bean.create();

I dont understand how this is possible, since I've run java2wsdl... 
But as im new I could be doing something wrong..




To get the complete project go here, and take a look in 
greetertest.java in package com.jayway :

http://www.fileshost.com/en/file/22660/basic-zip.html


[1]=http://cwiki.apache.org/CXF20DOC/maven-integration-and-plugin.html





--
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684



Re: JAXB Unmarshalling

2007-12-20 Thread Sergey Beryozkin
Here's a slightly different point. Look at a JAX-RS demo, at a CustomerService 
code [1]. 

This server code is a receiver when POST/PUT requests are issued to it. For ex, 
CustomerService.updateCustomer(Customer).

We don't expect the developers to write their own code to unmarshall it all 
there, be aware of JAXBContexts, etc, right ? If they want they just can go 
ahread and write their own code, no probs, or they can have CXF help them to do 
it with its JAX-RS infrastructure.

Same story for those receivers which initiate have GET responses to deal with. 
One either lets them write their own code if they feel that's what they want or 
help them, possibly with the help of description languages to hide all the 
things needed to get to the actual data like JAXBContext.

Cheers, Sergey


[1]svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/server/CustomerService.java?revision=605587view=markup


IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Working example with tests based on the maven archetype cxf-http-basic extended to soap though!

2007-12-20 Thread Nino Saturnino Martinez Vazquez Wael
Hi I've taken the liberty to write some tests to the archetype, and as 
the project im on now needed to use soap its targeted towards soap.


The tests I've done should be incorporated into the archetype so that it 
comes with tests (I could go and make the templates if wanted). Although 
the tests needs to be verified.


Heres the link to the project:

http://www.fileshost.com/en/file/22681/basic-zip.html

The tests are somewhat basic:

Testing bindings, testing wsdl schema, testing invokation of methods. Etc...

--
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684



RE: CXF adds JavaScript client-side processing

2007-12-20 Thread Benson Margulies
I also need to add some more to the example. I ran out of time before
adding the complex-object input case.




Re: sample failure: restfull_http_binding

2007-12-20 Thread YI (William) ZHU

Hi,

I have done some testing to the page test.html.

Two fixes: 
1) works with IE 6 and FireFox 2 now;
2) customers table is refreshed, not appended.

Please validate.

Cheers,
YI ZHU


http://www.nabble.com/file/p14437670/test.html test.html 


dkulp wrote:
 
 
 
 I think these are logged as:
 
 https://issues.apache.org/jira/browse/CXF-873
 https://issues.apache.org/jira/browse/CXF-889
 
 Patches are most welcome.  
 
 Dan
 
 
 On Friday 14 December 2007, YI (William) ZHU wrote:
 Hi,

 I found that there two issues in the CXF 2.0.2 sample
 restfull_http_binding:

 1) the test.html page to test the Jettison/CXF AJAX Demo is not
 working, I found that the javascript has problem.

 2) if I change the CustomerServiceImpl.java file to let the web
 service to return two customers, not the  original 1 customer. Then
 following links work fine:
http://localhost:8080/xml/customers
http://localhost:8080/xml/customers/123
http://localhost:8080/json/customers/123

 but this link http://localhost:8080/json/customers; return:

 {acme.Customers:{acme.customer:[{acme.id:789,acme.name:Will
iam Zhu},{acme.id:123,acme.name:Dan Diephouse}]}}

 I thought that's not correct, they should return two acme.customer
 items.

 Can someone check the implementation of JSON on CXF is OK?


 Thanks,
 YI ZHU
 
 
 
 -- 
 J. Daniel Kulp
 Principal Engineer, IONA
 [EMAIL PROTECTED]
 http://www.dankulp.com/blog
 
 

-- 
View this message in context: 
http://www.nabble.com/sample-failure%3A-restfull_http_binding-tp14339771p14437670.html
Sent from the cxf-user mailing list archive at Nabble.com.



RE: CXF @WebServiceProvider deployment issue

2007-12-20 Thread Barlotta, Michael [USA]
Adding portions of the WSDL in case it helps:

wsdl:definitions name=MessageRouter 
targetNamespace=http://x/; 
xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/;

xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/;

xmlns:xsd=http://www.w3c.org/2001/XMLSchema;
...
wsdl:portType name=RoutePortType
wsdl:operation name=RouteMessage
wsdl:input message=RouteRequest /
wsdl:output message=RouteResponse /
/wsdl:operation
/wsdl:portType
...
wsdl:service name=MessageRouterService
wsdl:port binding=MessageRouterServiceSoapBinding
name=MessageRouterServicePort
soap:address
location=http:///fxml/route/
/wsdl:port
/wsdl:service

 @WebServiceProvider(
 serviceName=MessageRouterService,    mapped to
wsdl:service name
 portName=RoutePortType,  mapped to
wsdl:portType name
 targetNamespace=http://x/;,   mapped to
wsdl:definitions targetNamespace
 wsdlLocation=WEB-INF/wsdl/MessageRouter.wsdl

Thanks,

Mike Barlotta
Associate
Booz | Allen | Hamilton

-Original Message-
From: Barlotta, Michael [USA] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 20, 2007 9:02 AM
To: cxf-user@incubator.apache.org
Subject: RE: CXF @WebServiceProvider deployment issue

Nino: thanks, but unfortunately no... I have the required default
constructor (by virute of not having any constructor).

I found this posting, and added the cxf:bus configuration but I still
get the same error (see config below).

http://www.nabble.com/java.lang.NullPointerException-to14201919.html

I have been able to deploy @WebService based endpoints without
configuring the bus so not sure what I am missing. I was hoping to get
the XML passed straight through so that I could use my Castor mapping 
Java POJOs that have already been created/tested. 

What am I missing?
Thanks,

 //- Spring config
 beans xmlns=http://www.springframework.org/schema/beans;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:jaxws=http://cxf.apache.org/jaxws;
 xmlns:soap=http://cxf.apache.org/bindings/soap;
  xmlns:cxf=http://cxf.apache.org/core;
 xsi:schemaLocation=
 http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans.xsd
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
 http://cxf.apache.org/bindings/soap
 http://cxf.apache.org/schemas/configuration/soap.xsd
  http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd;
  
 import resource=classpath:META-INF/cxf/cxf.xml / import 
 resource=classpath:META-INF/cxf/cxf-extension-soap.xml / import 
 resource=classpath:META-INF/cxf/cxf-servlet.xml /
  
cxf:bus
/cxf:bus 

 jaxws:endpoint
 id=MessageRouter 
 implementor=#MessageRouterService 
 address=/fxml/route /


Mike Barlotta
Associate
Booz | Allen | Hamilton

-Original Message-
From: Nino Saturnino Martinez Vazquez Wael
[mailto:[EMAIL PROTECTED]
Sent: Thursday, December 20, 2007 4:22 AM
To: cxf-user@incubator.apache.org
Subject: Re: CXF @WebServiceProvider deployment issue

My best guess are that its a spring error that tells you that it could
not call the default constructor of the class backing the MessageRouter.

In your case its the messagerouterservice..

Do this seem to give any hints?

regards

Barlotta, Michael [USA] wrote:
 Hello, I am using CXF 2.0.3 and am deploying an appliation to JBoss 
 using Spring and packaged as a WAR.
  
 On JBoss startup I get the following error:BeanCreationException: 
 Error creating bean with name 'MessageRouter': Invocation of init 
 method failed; nested exception is java.lang.NullPointerException
  
 Any idea what is causing this?
  
 Thanks!
 Mike
  
 //- Java Code Annotations
  
 @WebServiceProvider(
 serviceName=MessageRouterService,
 portName=RoutePortType,
 targetNamespace=http://x/;,
 wsdlLocation=WEB-INF/wsdl/MessageRouter.wsdl
 )
 @ServiceMode(Service.Mode.PAYLOAD)
 public class MessageRouterEndpoint implements ProviderSource{
  
  
 public Source invoke(Source payload) {
 ...
 }
 }
  
 //- Spring config
 beans xmlns=http://www.springframework.org/schema/beans;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:jaxws=http://cxf.apache.org/jaxws;
 xmlns:soap=http://cxf.apache.org/bindings/soap;
 xsi:schemaLocation=
 http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans.xsd
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
 http://cxf.apache.org/bindings/soap
 http://cxf.apache.org/schemas/configuration/soap.xsd;
  
 import resource=classpath:META-INF/cxf/cxf.xml / import 
 resource=classpath:META-INF/cxf/cxf-extension-soap.xml / import 
 

Re: Working example with tests based on the maven archetype cxf-http-basic extended to soap though!

2007-12-20 Thread Daniel Kulp

Nino,

Can you file an enhancement request in our JIRA and attach it there?  We 
cannot really accept patches/changes except for those that come through 
there with the Grant permissions for apache to redistribute check box 
checked.   It's a legal thing to protect Apache and to protect the users 
of Apache software.

Thanks!
Dan


On Thursday 20 December 2007, Nino Saturnino Martinez Vazquez Wael wrote:
 Hi I've taken the liberty to write some tests to the archetype, and as
 the project im on now needed to use soap its targeted towards soap.

 The tests I've done should be incorporated into the archetype so that
 it comes with tests (I could go and make the templates if wanted).
 Although the tests needs to be verified.

 Heres the link to the project:

 http://www.fileshost.com/en/file/22681/basic-zip.html

 The tests are somewhat basic:

 Testing bindings, testing wsdl schema, testing invokation of methods.
 Etc...



-- 
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog


Re: Snapshot release 2.1

2007-12-20 Thread Daniel Kulp
On Wednesday 19 December 2007, MyScreenName wrote:
 Any idea when 2.1 will be declared stable (not snapshot)?

Just out of curiosity, is there a particular feature/fix that you need 
from 2.1?

Most BUG FIXES are being back ported to the 2.0.x branch and we are 
planning a 2.0.4 patch release with all the bug fixes sometime in mid 
January.   Thus, if you need a bug fix (not a new feature), we could 
make sure it gets into that.


-- 
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog


Re: CXF @WebServiceProvider deployment issue

2007-12-20 Thread Daniel Kulp

I believe portName should map to the name of the port in the service.   
Not the portType name.

Dan


On Thursday 20 December 2007, Barlotta, Michael [USA] wrote:
  @WebServiceProvider(
  serviceName=MessageRouterService,    mapped to

 wsdl:service name

  portName=RoutePortType,  mapped
  to

 wsdl:portType name

  targetNamespace=http://x/,   mapped
  to

 wsdl:definitions targetNamespace

  wsdlLocation=WEB-INF/wsdl/MessageRouter.wsdl



-- 
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog


Adding ServiceConfigurations / ServiceFactories

2007-12-20 Thread Michael Kleinhenz
Hi,

I try to get used to the inner workings of cxf. I suppose it is possible
to add new ServiceFactories to cxf, but how would this be done?

If I create a new ServiceFactory by subclassing AbstractServiceFactory,
how do I add it to cxf?

Another thing: the documentation talks about customizing the behaviour
of ReflectionServiceFactoryBean by adding ServiceConfigurations. How do
I add these ServiceConfigurations to cxf in a servlet environment. The
example creates the server from scratch, but I understand that in a
servlet context, the Server instance is started (I think) from CXFServlet..?

I try to do this:

public class MyCustomServlet extends CXFServlet
{
@Override
public void init(ServletConfig servletConfig)
  throws ServletException
{
super.init(servletConfig);

Bus bus = getBus();
BusFactory.setDefaultBus(bus);

ReflectionServiceFactoryBean serviceFactory =
 new ReflectionServiceFactoryBean();
serviceFactory.getServiceConfigurations()
 .add(0, new AbstractServiceConfiguration()
{
.. my programmatically created service setup ..
});

... now, how to set my custom ServiceFactory to be used? ...

// standard JAX-WS service creation
Endpoint.publish(/OtherService, new OtherServiceImpl());
}
}

Thanks,
-- Michael

-- 
Dipl.-Technoinform Michael Kleinhenz

tarent
Gesellschaft für Softwareentwicklung und IT-Beratung mbH

Heilsbachstr. 24, 53123 Bonn  | Poststr. 4-5, 10178 Berlin
fon: +49(228) / 52675-0   | fon: +49(30) / 27594853
fax: +49(228) / 52675-25  | fax: +49(30) / 78709617

Geschäftsführer: Boris Esser, Elmar Geese, Thomas Müller-Ackermann
HRB AG Bonn 5168 - Ust-ID: DE122264941


'any' in a Javascript client

2007-12-20 Thread Benson Margulies
I'm interested in opinions about how the XML Schema 'any' construct
could be mapped to Javascript. Obvious possibilities include:

a) a string of XML
b) a DOM node
c) a function that returns a string of XML, since that could be a
closure over DOM or E4X or whatever someone likes.

Anyone have an opinion?




Jetty + spring, I am missing a point

2007-12-20 Thread Davide Gesino

I have always been using CXF deployed on tomcat.
Switching to Jetty embedded I have some problems trying to understand some
things.

When I first publish and Endpoint CXF such as:
Endpoint.publish(address, implementor);
CXF loads the cxf.xml file and the Bus and everything else are instantiated,
the jetty server is started and the endpoints get published.

I would like to create everything in a Spring fashion without using
(eventually) the Endpoint.publish, with Spring creating and publishign
magically the endpoints 4 me.
Creating an ApplicationContext explicitly in my code I see almost everthing
to be correctly instantiated, but the Jetty server seems not to be up and
running.
Should I have to start it explicitly?

In this case what should be the proper endpoint address in the cxf file??

4 example assuming:
Object implementor = new GreeterImpl();
String address = http://localhost:8080/SoapContext/SoapPort;;
Endpoint.create(Greeter.class);

what should I have to write in my cxf.xml, something like;

jaxws:endpoint id=creditEndpoint address
=http://localhost:9000/SoapContext/SoapPort;
implementor=org.apache.hello_world_soap_http.GreeterImpl 
/jaxws:endpoint ??

Where is my fault?




-- 
View this message in context: 
http://www.nabble.com/Jetty-%2B-spring%2C-I-am-missing-a-point-tp14440937p14440937.html
Sent from the cxf-user mailing list archive at Nabble.com.



RE: extending databinding

2007-12-20 Thread Mariano Kohan
hello Jervis,

i'm try to use cxf with a developed framework. This are 3 kind of
problem that i have:

1). when a web service return an application object, the generated
wsdl return more
fields than the necessary to transfer. how can i configure cxf  to
define the fields
 to transfer?

2). when a web service return a List (or a class that extends an implementation
of List) the generated wsdl not recognize a sequence of elements. Can
i change this?

3). I have a hierarchy of object that extend from a base class. I want
to define a web
service with a parameter whose type is the base class. Can I do this?
(the generated wsdl only define the base class and don't their subclasses).
Another problem is that I can only create instances
 of these objects using a builder.


These problems are using jaxb. I can't start using aegis because
throws exceptions
when try to handle differents objects (or components of them) provided by the
framework.


thanks,
Mariano


 Hi Mariano, what kind of data bindings are you looking for? Is it sth very 
 simple such as marshaling
 an Inputstream to a Source object (in this case, you want look into 
 SourceDataBinding.java)
 or sth a little bit more complex based on schemas, such as JAXB databinding 
 or Aegis databinding.
 In the later case, you may want to look into how Aegis data binding is 
 implemented. Benson
 has done a lot of work recently on Aegis binding. We also have a plan to 
 support more data
 bindings ,such as XMLBeans, JiBX, JaxMe etc, not sure if one of them is what 
 you are looking
 for. Anyway, we would be very happy to provide more helps if you can elaborate
 your requirement
 into more details.
  Thanks,
 Jervis


  
  -Original Message-
  From: Mariano Kohan [mailto:[EMAIL PROTECTED]
  Sent: 2007��12��19�� 2:21
  To: cxf-user@incubator.apache.org
  Subject: extending databinding
 
  hello,


  I want to use cxf to develop some web service, but I need to extend the
  databinding because the provided ones with cxf don't work with my
  application objects.

  Can i do it with cxf? How?

  I read the javadoc of
  org.apache.cxf.databinding.source.SourceDataBindingbut I don't
  understand well how to use it.
  Does it have a sample inside the distribution?
 
  thanks,
  Mariano


CXF and JSON

2007-12-20 Thread Vespa, Anthony J
I'm considering implementing (or re-implementing) a service from
REST/SOAP to JSON.  I'm wondering if someone has a workable example (the
docs I've found are a bit sparse) in terms of how to configure my
beans.xml and how to set up the SEI.

Thanks!


RE: CXF @WebServiceProvider deployment issue

2007-12-20 Thread Barlotta, Michael [USA]
Thanks Dan, I re-read the docs and you are right. Unfortunately that did not 
fix the problem.

I checked the code and the line that generates the NPE is 226 of 
WSDLServiceBuilder:
223 PortType bindingPt = binding.getPortType();
226 PortType pt = def.getPortType(bindingPt.getQName()); 

Turns out the bindingPt is null, any ideas or tips you can give as to why this 
is the case?

Mike Barlotta
Associate
Booz | Allen | Hamilton

-Original Message-
From: Daniel Kulp [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 20, 2007 11:45 AM
To: cxf-user@incubator.apache.org
Cc: Barlotta, Michael [USA]
Subject: Re: CXF @WebServiceProvider deployment issue


I believe portName should map to the name of the port in the service.   
Not the portType name.

Dan


On Thursday 20 December 2007, Barlotta, Michael [USA] wrote:
  @WebServiceProvider(
  serviceName=MessageRouterService,    mapped to

 wsdl:service name

  portName=RoutePortType,  mapped 
  to

 wsdl:portType name

  targetNamespace=http://x/,   mapped 
  to

 wsdl:definitions targetNamespace

  wsdlLocation=WEB-INF/wsdl/MessageRouter.wsdl



--
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog


Re: CXF @WebServiceProvider deployment issue

2007-12-20 Thread Daniel Kulp

All I can think of to try is to run the validator (in our bin directory) 
on the wsdl and see if it has any issues with it.   Maybe the binding 
node doesn't point to the correct portType or something.I don't 
really know without looking more at the wsdl.

Dan


On Thursday 20 December 2007, Barlotta, Michael [USA] wrote:
 Thanks Dan, I re-read the docs and you are right. Unfortunately that
 did not fix the problem.

 I checked the code and the line that generates the NPE is 226 of
 WSDLServiceBuilder: 223 PortType bindingPt = binding.getPortType();
 226 PortType pt = def.getPortType(bindingPt.getQName());

 Turns out the bindingPt is null, any ideas or tips you can give as to
 why this is the case?

 Mike Barlotta
 Associate
 Booz | Allen | Hamilton

 -Original Message-
 From: Daniel Kulp [mailto:[EMAIL PROTECTED]
 Sent: Thursday, December 20, 2007 11:45 AM
 To: cxf-user@incubator.apache.org
 Cc: Barlotta, Michael [USA]
 Subject: Re: CXF @WebServiceProvider deployment issue


 I believe portName should map to the name of the port in the service.
 Not the portType name.

 Dan

 On Thursday 20 December 2007, Barlotta, Michael [USA] wrote:
   @WebServiceProvider(
   serviceName=MessageRouterService,    mapped to
 
  wsdl:service name
 
   portName=RoutePortType,  mapped
   to
 
  wsdl:portType name
 
   targetNamespace=http://x/,   mapped
   to
 
  wsdl:definitions targetNamespace
 
   wsdlLocation=WEB-INF/wsdl/MessageRouter.wsdl

 --
 J. Daniel Kulp
 Principal Engineer, IONA
 [EMAIL PROTECTED]
 http://www.dankulp.com/blog



-- 
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog


Strange error with JAX-WS and JDK 1.5

2007-12-20 Thread Atif Khan
I have a simple Hello World application that is configured following:

HelloWorld.java Interface

@WebService
public interface HelloWorld
{
  String sayHello( @WebParam(name=text) String text );
}

HelloWorldImpl.java
@WebService(endpointInterface = test.jws.HelloWorld)
public class HelloWorldImpl
  implements HelloWorld

and the Spring configuration looks like:

  import resource=classpath:META-INF/cxf/cxf.xml /
  import resource=classpath:META-INF/cxf/cxf-extension-soap.xml /
  import resource=classpath:META-INF/cxf/cxf-servlet.xml /
  import resource=classpath:META-INF/cxf/cxf-extension-xml.xml /
  import resource=classpath:META-INF/cxf/cxf-extension-http-binding.xml
/
  jaxws:endpoint id=helloWorld implementor=test.jws.HelloWorldImpl
address=/HelloWorld /


I am bundling this as a WAR and running on Caucho Resin 3.1.3. When I start
the application server under JDK 1.6.0_02, it works fine and serves
requests. The problem occurs while starting the application server under JDK
1.5.0_06. I am getting the UnsupportedOperationException when Spring tries
to initialize the HelloWorldImpl bean. Here is the stack trace:

[17:39:45.436] Could not find the configuration file cxf.xml on the
classpath.
[17:40:23.107] org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'helloWorld': Instantiation of bean failed;
nested exception is java.lang.ExceptionInInitializerError
[17:40:23.107] Caused by: java.lang.ExceptionInInitializerError
[17:40:23.107] at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
[17:40:23.107] at sun.reflect.NativeConstructorAccessorImpl.newInstance(
NativeConstructorAccessorImpl.java:39)
[17:40:23.107] at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
DelegatingConstructorAccessorImpl.java:27)
[17:40:23.107] at java.lang.reflect.Constructor.newInstance(
Constructor.java:494)
[17:40:23.107] at org.springframework.beans.BeanUtils.instantiateClass(
BeanUtils.java:85)
[17:40:23.107] at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate
(SimpleInstantiationStrategy.java:87)
[17:40:23.107] at
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor
(ConstructorResolver.java:186)
[17:40:23.107] at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor
(AbstractAutowireCapableBeanFactory.java:795)
[17:40:23.107] at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance
(AbstractAutowireCapableBeanFactory.java:713)
[17:40:23.107] at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean
(AbstractAutowireCapableBeanFactory.java:386)
[17:40:23.107] at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(
AbstractBeanFactory.java:249)
[17:40:23.107] at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton
(DefaultSingletonBeanRegistry.java:155)
[17:40:23.107] at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
AbstractBeanFactory.java:246)
[17:40:23.107] at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
AbstractBeanFactory.java:160)
[17:40:23.107] at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons
(DefaultListableBeanFactory.java:291)
[17:40:23.107] at
org.springframework.context.support.AbstractApplicationContext.refresh(
AbstractApplicationContext.java:352)
[17:40:23.107] at
org.springframework.web.context.ContextLoader.createWebApplicationContext(
ContextLoader.java:245)
[17:40:23.107] at
org.springframework.web.context.ContextLoader.initWebApplicationContext(
ContextLoader.java:188)
[17:40:23.107] at
org.springframework.web.context.ContextLoaderListener.contextInitialized(
ContextLoaderListener.java:49)
[17:40:23.107] at com.caucho.server.webapp.WebApp.start(WebApp.java
:1793)
[17:40:23.107] at com.caucho.server.deploy.DeployController.startImpl(
DeployController.java:646)
[17:40:23.107] at
com.caucho.server.deploy.StartAutoRedeployAutoStrategy.startOnInit(
StartAutoRedeployAutoStrategy.java:72)
[17:40:23.107] at com.caucho.server.deploy.DeployController.startOnInit(
DeployController.java:528)
[17:40:23.107] at com.caucho.server.deploy.DeployContainer.start(
DeployContainer.java:163)
[17:40:23.107] at com.caucho.server.webapp.WebAppContainer.start(
WebAppContainer.java:675)
[17:40:23.107] at com.caucho.server.host.Host.start(Host.java:437)
[17:40:23.107] at com.caucho.server.deploy.DeployController.startImpl(
DeployController.java:646)
[17:40:23.107] at
com.caucho.server.deploy.StartAutoRedeployAutoStrategy.startOnInit(
StartAutoRedeployAutoStrategy.java:72)
[17:40:23.107] at com.caucho.server.deploy.DeployController.startOnInit(
DeployController.java:528)
[17:40:23.107] at 

Re: CXF and JSON

2007-12-20 Thread Willem Jiang

Hi ,
You can find the example in the CXF_KIT/samples/restful_http_binding

Willem.
Vespa, Anthony J wrote:

I'm considering implementing (or re-implementing) a service from
REST/SOAP to JSON.  I'm wondering if someone has a workable example (the
docs I've found are a bit sparse) in terms of how to configure my
beans.xml and how to set up the SEI.

Thanks!

  




Re: Strange error with JAX-WS and JDK 1.5

2007-12-20 Thread Willem Jiang

Hi ,

I think Resin 3.1.3 may ship a earlier version of jaxws-api.jar and CXF 
need to use the jaxws-api.2.0.jar.
As you know , JDK 1.60_02 ships with jaxws-api.2.0 jar , so Resin's 
jaxws-api jar will get no chance to be loaded.
But there is no any jaxws-api.jar in JDK 1.5.0_06, and the Resin's 
jaxws-api is loaded.


You just need to endorse the jaxws-api.jar or let the war's lib jars 
load first.


Here are some documents for you [1]

[1]http://cwiki.apache.org/CXF20DOC/appserverguide.html

Willem.

Atif Khan wrote:

I have a simple Hello World application that is configured following:

HelloWorld.java Interface

@WebService
public interface HelloWorld
{
  String sayHello( @WebParam(name=text) String text );
}

HelloWorldImpl.java
@WebService(endpointInterface = test.jws.HelloWorld)
public class HelloWorldImpl
  implements HelloWorld

and the Spring configuration looks like:

  import resource=classpath:META-INF/cxf/cxf.xml /
  import resource=classpath:META-INF/cxf/cxf-extension-soap.xml /
  import resource=classpath:META-INF/cxf/cxf-servlet.xml /
  import resource=classpath:META-INF/cxf/cxf-extension-xml.xml /
  import resource=classpath:META-INF/cxf/cxf-extension-http-binding.xml
/
  jaxws:endpoint id=helloWorld implementor=test.jws.HelloWorldImpl
address=/HelloWorld /


I am bundling this as a WAR and running on Caucho Resin 3.1.3. When I start
the application server under JDK 1.6.0_02, it works fine and serves
requests. The problem occurs while starting the application server under JDK
1.5.0_06. I am getting the UnsupportedOperationException when Spring tries
to initialize the HelloWorldImpl bean. Here is the stack trace:

[17:39:45.436] Could not find the configuration file cxf.xml on the
classpath.
[17:40:23.107] org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'helloWorld': Instantiation of bean failed;
nested exception is java.lang.ExceptionInInitializerError
[17:40:23.107] Caused by: java.lang.ExceptionInInitializerError
[17:40:23.107] at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
[17:40:23.107] at sun.reflect.NativeConstructorAccessorImpl.newInstance(
NativeConstructorAccessorImpl.java:39)
[17:40:23.107] at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
DelegatingConstructorAccessorImpl.java:27)
[17:40:23.107] at java.lang.reflect.Constructor.newInstance(
Constructor.java:494)
[17:40:23.107] at org.springframework.beans.BeanUtils.instantiateClass(
BeanUtils.java:85)
[17:40:23.107] at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate
(SimpleInstantiationStrategy.java:87)
[17:40:23.107] at
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor
(ConstructorResolver.java:186)
[17:40:23.107] at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor
(AbstractAutowireCapableBeanFactory.java:795)
[17:40:23.107] at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance
(AbstractAutowireCapableBeanFactory.java:713)
[17:40:23.107] at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean
(AbstractAutowireCapableBeanFactory.java:386)
[17:40:23.107] at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(
AbstractBeanFactory.java:249)
[17:40:23.107] at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton
(DefaultSingletonBeanRegistry.java:155)
[17:40:23.107] at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
AbstractBeanFactory.java:246)
[17:40:23.107] at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
AbstractBeanFactory.java:160)
[17:40:23.107] at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons
(DefaultListableBeanFactory.java:291)
[17:40:23.107] at
org.springframework.context.support.AbstractApplicationContext.refresh(
AbstractApplicationContext.java:352)
[17:40:23.107] at
org.springframework.web.context.ContextLoader.createWebApplicationContext(
ContextLoader.java:245)
[17:40:23.107] at
org.springframework.web.context.ContextLoader.initWebApplicationContext(
ContextLoader.java:188)
[17:40:23.107] at
org.springframework.web.context.ContextLoaderListener.contextInitialized(
ContextLoaderListener.java:49)
[17:40:23.107] at com.caucho.server.webapp.WebApp.start(WebApp.java
:1793)
[17:40:23.107] at com.caucho.server.deploy.DeployController.startImpl(
DeployController.java:646)
[17:40:23.107] at
com.caucho.server.deploy.StartAutoRedeployAutoStrategy.startOnInit(
StartAutoRedeployAutoStrategy.java:72)
[17:40:23.107] at com.caucho.server.deploy.DeployController.startOnInit(
DeployController.java:528)
[17:40:23.107] at com.caucho.server.deploy.DeployContainer.start(
DeployContainer.java:163)
[17:40:23.107] at 

Re: Strange error with JAX-WS and JDK 1.5

2007-12-20 Thread Atif Khan
Thanks. Putting jaxws-api.jar in jre/lib/ext did the trick. The problem I
have is that I can not put the jar file production environment in the jre
directory. Also, loading war libs first is out of question. Is there a way
to configure Resin to load the jar from a different directory before the app
server libs?

On Dec 20, 2007 6:14 PM, Willem Jiang [EMAIL PROTECTED] wrote:

 Hi ,

 I think Resin 3.1.3 may ship a earlier version of jaxws-api.jar and CXF
 need to use the jaxws-api.2.0.jar.
 As you know , JDK 1.60_02 ships with jaxws-api.2.0 jar , so Resin's
 jaxws-api jar will get no chance to be loaded.
 But there is no any jaxws-api.jar in JDK 1.5.0_06, and the Resin's
 jaxws-api is loaded.

 You just need to endorse the jaxws-api.jar or let the war's lib jars
 load first.

 Here are some documents for you [1]

 [1]http://cwiki.apache.org/CXF20DOC/appserverguide.html

 Willem.

 Atif Khan wrote:
  I have a simple Hello World application that is configured following:
 
  HelloWorld.java Interface
 
  @WebService
  public interface HelloWorld
  {
String sayHello( @WebParam(name=text) String text );
  }
 
  HelloWorldImpl.java
  @WebService(endpointInterface = test.jws.HelloWorld)
  public class HelloWorldImpl
implements HelloWorld
 
  and the Spring configuration looks like:
 
import resource=classpath:META-INF/cxf/cxf.xml /
import resource=classpath:META-INF/cxf/cxf-extension-soap.xml /
import resource=classpath:META-INF/cxf/cxf-servlet.xml /
import resource=classpath:META-INF/cxf/cxf-extension-xml.xml /
import resource=classpath:META-INF/cxf/cxf-
 extension-http-binding.xml
  /
jaxws:endpoint id=helloWorld implementor=test.jws.HelloWorldImpl
  address=/HelloWorld /
 
 
  I am bundling this as a WAR and running on Caucho Resin 3.1.3. When I
 start
  the application server under JDK 1.6.0_02, it works fine and serves
  requests. The problem occurs while starting the application server under
 JDK
  1.5.0_06. I am getting the UnsupportedOperationException when Spring
 tries
  to initialize the HelloWorldImpl bean. Here is the stack trace:
 
  [17:39:45.436] Could not find the configuration file cxf.xml on the
  classpath.
  [17:40:23.107] org.springframework.beans.factory.BeanCreationException:
  Error creating bean with name 'helloWorld': Instantiation of bean
 failed;
  nested exception is java.lang.ExceptionInInitializerError
  [17:40:23.107] Caused by: java.lang.ExceptionInInitializerError
  [17:40:23.107] at
  sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
  Method)
  [17:40:23.107] at
 sun.reflect.NativeConstructorAccessorImpl.newInstance(
  NativeConstructorAccessorImpl.java:39)
  [17:40:23.107] at
  sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
  DelegatingConstructorAccessorImpl.java:27)
  [17:40:23.107] at java.lang.reflect.Constructor.newInstance(
  Constructor.java:494)
  [17:40:23.107] at
 org.springframework.beans.BeanUtils.instantiateClass(
  BeanUtils.java:85)
  [17:40:23.107] at
 
 org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate
  (SimpleInstantiationStrategy.java:87)
  [17:40:23.107] at
 
 org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor
  (ConstructorResolver.java:186)
  [17:40:23.107] at
 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor
  (AbstractAutowireCapableBeanFactory.java:795)
  [17:40:23.107] at
 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance
  (AbstractAutowireCapableBeanFactory.java:713)
  [17:40:23.107] at
 
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean
  (AbstractAutowireCapableBeanFactory.java:386)
  [17:40:23.107] at
 
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(
  AbstractBeanFactory.java:249)
  [17:40:23.107] at
 
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton
  (DefaultSingletonBeanRegistry.java:155)
  [17:40:23.107] at
  org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
  AbstractBeanFactory.java:246)
  [17:40:23.107] at
  org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
  AbstractBeanFactory.java:160)
  [17:40:23.107] at
 
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons
  (DefaultListableBeanFactory.java:291)
  [17:40:23.107] at
  org.springframework.context.support.AbstractApplicationContext.refresh(
  AbstractApplicationContext.java:352)
  [17:40:23.107] at
 
 org.springframework.web.context.ContextLoader.createWebApplicationContext(
  ContextLoader.java:245)
  [17:40:23.107] at
  org.springframework.web.context.ContextLoader.initWebApplicationContext(
  ContextLoader.java:188)
  [17:40:23.107] at
  org.springframework.web.context.ContextLoaderListener.contextInitialized
 

Re: Strange error with JAX-WS and JDK 1.5

2007-12-20 Thread Willem Jiang
I have never used  Resin,  I just got some experience from some other 
web containers, they provide some kind of configuration to load your 
application JAR first.

May be you can ask help from Resin.

Willem.

Atif Khan wrote:

Thanks. Putting jaxws-api.jar in jre/lib/ext did the trick. The problem I
have is that I can not put the jar file production environment in the jre
directory. Also, loading war libs first is out of question. Is there a way
to configure Resin to load the jar from a different directory before the app
server libs?

On Dec 20, 2007 6:14 PM, Willem Jiang [EMAIL PROTECTED] wrote:

  

Hi ,

I think Resin 3.1.3 may ship a earlier version of jaxws-api.jar and CXF
need to use the jaxws-api.2.0.jar.
As you know , JDK 1.60_02 ships with jaxws-api.2.0 jar , so Resin's
jaxws-api jar will get no chance to be loaded.
But there is no any jaxws-api.jar in JDK 1.5.0_06, and the Resin's
jaxws-api is loaded.

You just need to endorse the jaxws-api.jar or let the war's lib jars
load first.

Here are some documents for you [1]

[1]http://cwiki.apache.org/CXF20DOC/appserverguide.html

Willem.

Atif Khan wrote:


I have a simple Hello World application that is configured following:

HelloWorld.java Interface

@WebService
public interface HelloWorld
{
  String sayHello( @WebParam(name=text) String text );
}

HelloWorldImpl.java
@WebService(endpointInterface = test.jws.HelloWorld)
public class HelloWorldImpl
  implements HelloWorld

and the Spring configuration looks like:

  import resource=classpath:META-INF/cxf/cxf.xml /
  import resource=classpath:META-INF/cxf/cxf-extension-soap.xml /
  import resource=classpath:META-INF/cxf/cxf-servlet.xml /
  import resource=classpath:META-INF/cxf/cxf-extension-xml.xml /
  import resource=classpath:META-INF/cxf/cxf-
  

extension-http-binding.xml


/
  jaxws:endpoint id=helloWorld implementor=test.jws.HelloWorldImpl
address=/HelloWorld /


I am bundling this as a WAR and running on Caucho Resin 3.1.3. When I
  

start


the application server under JDK 1.6.0_02, it works fine and serves
requests. The problem occurs while starting the application server under
  

JDK


1.5.0_06. I am getting the UnsupportedOperationException when Spring
  

tries


to initialize the HelloWorldImpl bean. Here is the stack trace:

[17:39:45.436] Could not find the configuration file cxf.xml on the
classpath.
[17:40:23.107] org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'helloWorld': Instantiation of bean
  

failed;


nested exception is java.lang.ExceptionInInitializerError
[17:40:23.107] Caused by: java.lang.ExceptionInInitializerError
[17:40:23.107] at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
[17:40:23.107] at
  

sun.reflect.NativeConstructorAccessorImpl.newInstance(


NativeConstructorAccessorImpl.java:39)
[17:40:23.107] at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
DelegatingConstructorAccessorImpl.java:27)
[17:40:23.107] at java.lang.reflect.Constructor.newInstance(
Constructor.java:494)
[17:40:23.107] at
  

org.springframework.beans.BeanUtils.instantiateClass(


BeanUtils.java:85)
[17:40:23.107] at

  

org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate


(SimpleInstantiationStrategy.java:87)
[17:40:23.107] at

  

org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor


(ConstructorResolver.java:186)
[17:40:23.107] at

  

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor


(AbstractAutowireCapableBeanFactory.java:795)
[17:40:23.107] at

  

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance


(AbstractAutowireCapableBeanFactory.java:713)
[17:40:23.107] at

  

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean


(AbstractAutowireCapableBeanFactory.java:386)
[17:40:23.107] at

  

org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(


AbstractBeanFactory.java:249)
[17:40:23.107] at

  

org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton


(DefaultSingletonBeanRegistry.java:155)
[17:40:23.107] at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
AbstractBeanFactory.java:246)
[17:40:23.107] at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
AbstractBeanFactory.java:160)
[17:40:23.107] at

  

org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons


(DefaultListableBeanFactory.java:291)
[17:40:23.107] at
org.springframework.context.support.AbstractApplicationContext.refresh(
AbstractApplicationContext.java:352)
[17:40:23.107] at

  


RE: CXF and JSON

2007-12-20 Thread Liu, Jervis
I would encourage you to try CXF JSR-311 (JAX-RS) implementation instead. It is 
standard based (CXF HTTP binding is not standard based), and the development 
activities around CXF JSR-311 are much more active. 

CXF JSR-311 (JAX-RS) demo: samples\restful_jaxrs
System test: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/

And they all work! :-)

Docs: http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html

Let me know if you run into any problems.

Cheers,
Jervis

 -Original Message-
 From: Willem Jiang [mailto:[EMAIL PROTECTED]
 Sent: 2007年12月21日 7:02
 To: cxf-user@incubator.apache.org
 Subject: Re: CXF and JSON
 
 Hi ,
 You can find the example in the CXF_KIT/samples/restful_http_binding
 
 Willem.
 Vespa, Anthony J wrote:
  I'm considering implementing (or re-implementing) a service from
  REST/SOAP to JSON.  I'm wondering if someone has a workable example
 (the
  docs I've found are a bit sparse) in terms of how to configure my
  beans.xml and how to set up the SEI.
 
  Thanks!
 
 


IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland