You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Nanook <nm...@rievent.com> on 2008/02/08 16:05:39 UTC

CXFNonSpringServlet How-To?

Let me start by saying that I am somewhat new to the CXF library and to JAXWS
in general. I would like to deploy the service under Tomcat 5.5. and I have
been able to get one of the samples to work using the standard CXFServlet
configuration.  However, our application server environment does not include
Spring, nor do we care to include it at this time. I would really like to
trim out the spring libraries and bootstrapping from the CXF dependency
list. 

How can I get a web service to listen on a servlet transport without using
Spring? I have read earlier posts referring to the CXFNonSpringServlet, but
when I substitute this class in the web.xml for Tomcat, it does not work.
There is little in the way of an error message, other than: "Can't find the
the request for http://myhost/services/hello_world's Observer".

Thanks in advance!

--Nick
-- 
View this message in context: http://www.nabble.com/CXFNonSpringServlet-How-To--tp15356670p15356670.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXFNonSpringServlet How-To?

Posted by Zavizionov <al...@gmail.com>.
Hello list,

The new sample class location is
http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java

Regards,
Alexey.


willem.jiang wrote:
> 
> Hi Nick,
> 
> Since we use the spring to load the endpoint configuration in 
> CXFServlet, you have to do
> some work to load the endpoint information by yourself beyond the 
> CXFNonSpringServlet.
> Basically , you just need to use the bus which is loaded in the 
> CXFNonSpringServlet, and usethe Jaxws API
> or the ServerFactoryBean API to create the endpoint.
> 
> Here is an example[1] in the system test of the CXFNonSpringServlet.
> 
> [1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java
> 
> Willem.
> 
> Nanook wrote:
>> Let me start by saying that I am somewhat new to the CXF library and to
>> JAXWS
>> in general. I would like to deploy the service under Tomcat 5.5. and I
>> have
>> been able to get one of the samples to work using the standard CXFServlet
>> configuration.  However, our application server environment does not
>> include
>> Spring, nor do we care to include it at this time. I would really like to
>> trim out the spring libraries and bootstrapping from the CXF dependency
>> list. 
>>
>> How can I get a web service to listen on a servlet transport without
>> using
>> Spring? I have read earlier posts referring to the CXFNonSpringServlet,
>> but
>> when I substitute this class in the web.xml for Tomcat, it does not work.
>> There is little in the way of an error message, other than: "Can't find
>> the
>> the request for http://myhost/services/hello_world's Observer".
>>
>> Thanks in advance!
>>
>> --Nick
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/CXFNonSpringServlet-How-To--tp15356670p19608258.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXFNonSpringServlet How-To?

Posted by siuyab <ba...@es.aau.dk>.
Hi Dan,

First of all I also have to say that I am new to web service and CXF stuff.
I currently trying to add simple username token of ws-security on an already
developed code which is using CXFNonSpringServlet. 

In the override loadBus method, the endpoint is published in this way:
javax.xml.ws.Endpoint.publish("/query", service);

Then I followed the ws-security example as written in following website,
without configuring the Spring:
https://cwiki.apache.org/CXF20DOC/ws-security.html#WS-Security-addinterceptors

At the server side however, I didn't follow exactly the same think as shown
in the example because in the example Endpoint refers to
org.apache.cxf.endpoint.Endpoint, but in the code it refers to
javax.xml.ws.Endpoint. So, here is the slightly modified code:


EndpointImpl jaxwsEndpoint = (EndpointImpl)Endpoint.publish("/query",
service);
Endpoint cxfEndpoint = (Endpoint) jaxwsEndpoint.getServer().getEndpoint();
      
/** Adding Incoming Interceptors */
Map<String,Object> inProps= new HashMap<String,Object>();
      
WSS4JInInterceptor wssIn = new WSS4JInInterceptor(inProps);
((EndpointImpl) cxfEndpoint).getInInterceptors().add(wssIn);


I got the following error when client tries to execute the method in web
service:


Caused by: org.apache.cxf.binding.soap.SoapFault: MustUnderstand headers:
[{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security]
are not understood.
	at
org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:75)
	at
org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46)
	at
org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:35)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
	at
org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:99)
	at
org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
	at
org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:700)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2261)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2134)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1988)
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:639)
	at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:487)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
	... 30 more

Can somebody give some clue on how to solve this issue please? Perhaps this
is very basic or stupid question, but any help will be appreciated.

Regards,
Bayu
-- 
View this message in context: http://cxf.547215.n5.nabble.com/CXFNonSpringServlet-How-To-tp558936p3246508.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXFNonSpringServlet How-To?

Posted by Daniel Kulp <dk...@apache.org>.
On Monday 22 September 2008 10:49:03 am Glen Mazza wrote:
> But even if you use CXFNonSpringServlet doesn't CXF still require Spring?
> (The OP doesn't want to use Spring.) I'm unsure here, but I thought
> CXFNonSpringServlet means the *servlet* is not based on Spring, but CXF
> itself still needs it as a dependency.

No.  SOME stuff in CXF can be done without spring.   The basic JAX-WS cases 
can be done without the spring jars there at all.   We have an alternative 
code path to setup the bus without spring, but not everything is wired in 
that way.  (ws-security, ws-rm, ws-policy, etc... are amongst those)

Most of the advanced cases will require spring or doing a lot of low level API 
programming to get it configured.      Also, the new JMS transport Christian 
is working on will most likely require Spring.  

Dan


>
> Regards,
> Glen
>
> willem.jiang wrote:
> > Hi Nick,
> >
> > Since we use the spring to load the endpoint configuration in
> > CXFServlet, you have to do
> > some work to load the endpoint information by yourself beyond the
> > CXFNonSpringServlet.
> > Basically , you just need to use the bus which is loaded in the
> > CXFNonSpringServlet, and usethe Jaxws API
> > or the ServerFactoryBean API to create the endpoint.
> >
> > Here is an example[1] in the system test of the CXFNonSpringServlet.
> >
> > [1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test
> >/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java
> >
> > Willem.
> >
> > Nanook wrote:
> >> Let me start by saying that I am somewhat new to the CXF library and to
> >> JAXWS
> >> in general. I would like to deploy the service under Tomcat 5.5. and I
> >> have
> >> been able to get one of the samples to work using the standard
> >> CXFServlet configuration.  However, our application server environment
> >> does not include
> >> Spring, nor do we care to include it at this time. I would really like
> >> to trim out the spring libraries and bootstrapping from the CXF
> >> dependency list.
> >>
> >> How can I get a web service to listen on a servlet transport without
> >> using
> >> Spring? I have read earlier posts referring to the CXFNonSpringServlet,
> >> but
> >> when I substitute this class in the web.xml for Tomcat, it does not
> >> work. There is little in the way of an error message, other than: "Can't
> >> find the
> >> the request for http://myhost/services/hello_world's Observer".
> >>
> >> Thanks in advance!
> >>
> >> --Nick



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: CXFNonSpringServlet How-To?

Posted by Glen Mazza <gl...@gmail.com>.
But even if you use CXFNonSpringServlet doesn't CXF still require Spring? 
(The OP doesn't want to use Spring.) I'm unsure here, but I thought
CXFNonSpringServlet means the *servlet* is not based on Spring, but CXF
itself still needs it as a dependency.

Regards,
Glen


willem.jiang wrote:
> 
> Hi Nick,
> 
> Since we use the spring to load the endpoint configuration in 
> CXFServlet, you have to do
> some work to load the endpoint information by yourself beyond the 
> CXFNonSpringServlet.
> Basically , you just need to use the bus which is loaded in the 
> CXFNonSpringServlet, and usethe Jaxws API
> or the ServerFactoryBean API to create the endpoint.
> 
> Here is an example[1] in the system test of the CXFNonSpringServlet.
> 
> [1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java
> 
> Willem.
> 
> Nanook wrote:
>> Let me start by saying that I am somewhat new to the CXF library and to
>> JAXWS
>> in general. I would like to deploy the service under Tomcat 5.5. and I
>> have
>> been able to get one of the samples to work using the standard CXFServlet
>> configuration.  However, our application server environment does not
>> include
>> Spring, nor do we care to include it at this time. I would really like to
>> trim out the spring libraries and bootstrapping from the CXF dependency
>> list. 
>>
>> How can I get a web service to listen on a servlet transport without
>> using
>> Spring? I have read earlier posts referring to the CXFNonSpringServlet,
>> but
>> when I substitute this class in the web.xml for Tomcat, it does not work.
>> There is little in the way of an error message, other than: "Can't find
>> the
>> the request for http://myhost/services/hello_world's Observer".
>>
>> Thanks in advance!
>>
>> --Nick
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/CXFNonSpringServlet-How-To--tp15356670p19609516.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXFNonSpringServlet How-To?

Posted by Willem Jiang <wi...@gmail.com>.
Hi Nick,

Since we use the spring to load the endpoint configuration in 
CXFServlet, you have to do
some work to load the endpoint information by yourself beyond the 
CXFNonSpringServlet.
Basically , you just need to use the bus which is loaded in the 
CXFNonSpringServlet, and usethe Jaxws API
or the ServerFactoryBean API to create the endpoint.

Here is an example[1] in the system test of the CXFNonSpringServlet.

[1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java

Willem.

Nanook wrote:
> Let me start by saying that I am somewhat new to the CXF library and to JAXWS
> in general. I would like to deploy the service under Tomcat 5.5. and I have
> been able to get one of the samples to work using the standard CXFServlet
> configuration.  However, our application server environment does not include
> Spring, nor do we care to include it at this time. I would really like to
> trim out the spring libraries and bootstrapping from the CXF dependency
> list. 
>
> How can I get a web service to listen on a servlet transport without using
> Spring? I have read earlier posts referring to the CXFNonSpringServlet, but
> when I substitute this class in the web.xml for Tomcat, it does not work.
> There is little in the way of an error message, other than: "Can't find the
> the request for http://myhost/services/hello_world's Observer".
>
> Thanks in advance!
>
> --Nick
>   


Re: CXFNonSpringServlet How-To?

Posted by Nanook <nm...@rievent.com>.
We use the JBoss application server and the goal was to run our deployment
with the bare amount of external dependencies as possible. It would be
preferrable not to inject the Spring framework unless we were comitted to
using it for other purposes besides web services configuration. I did
explore the Metro Glassfish implementation and that seemed to be a suitable
alternative.

Thank you!



Glen Mazza wrote:
> 
> Incidentally, GlassFish Metro does not internally use Spring, so if having
> a Spring-free web service stack is very important you may wish to consider
> that tool.
> 
> It seems strange though to want to use CXF but not the Spring it
> incorporates.  Java code is java code--since Spring is Apache licensed, we
> could rename it Banana and directly incorporate it within the CXF source
> code--sure, CXF would then be Spring-free but what would be the
> difference?  Unless you're using Spring elsewhere under a different
> version (i.e., a conflicting JARs concern), I can't see why
> org.springframework.Widget is no good but org.cxf.glen.Widget (which could
> just be a copy and paste of the Spring framework version, just keeping the
> license intact) would be acceptable.  The Spring folks are certainly
> better coders than I am.
> 
> Glen
> 
> 
> Nanook wrote:
>> 
>> Let me start by saying that I am somewhat new to the CXF library and to
>> JAXWS in general. I would like to deploy the service under Tomcat 5.5.
>> and I have been able to get one of the samples to work using the standard
>> CXFServlet configuration.  However, our application server environment
>> does not include Spring, nor do we care to include it at this time. I
>> would really like to trim out the spring libraries and bootstrapping from
>> the CXF dependency list. 
>> 
>> How can I get a web service to listen on a servlet transport without
>> using Spring? I have read earlier posts referring to the
>> CXFNonSpringServlet, but when I substitute this class in the web.xml for
>> Tomcat, it does not work. There is little in the way of an error message,
>> other than: "Can't find the the request for
>> http://myhost/services/hello_world's Observer".
>> 
>> Thanks in advance!
>> 
>> --Nick
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/CXFNonSpringServlet-How-To--tp15356670p19612248.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXFNonSpringServlet How-To?

Posted by Glen Mazza <gl...@gmail.com>.
Incidentally, GlassFish Metro does not internally use Spring, so if having a
Spring-free web service stack is very important you may wish to consider
that tool.

It seems strange though to want to use CXF but not the Spring it
incorporates.  Java code is java code--since Spring is Apache licensed, we
could easily rename it Banana and directly incorporate it within the CXF
source code--sure, CXF would then be Spring-free but what would be the
difference?  Unless you're using Spring elsewhere under a different version
(i.e., a conflicting JARs concern), I can't see why
org.springframework.Widget is no good but org.cxf.glen.Widget (which could
be just as well a copy and paste of the Spring framework version, just
keeping the license intact) would be acceptable.  The Spring folks are
certainly better coders than I am.

Glen


Nanook wrote:
> 
> Let me start by saying that I am somewhat new to the CXF library and to
> JAXWS in general. I would like to deploy the service under Tomcat 5.5. and
> I have been able to get one of the samples to work using the standard
> CXFServlet configuration.  However, our application server environment
> does not include Spring, nor do we care to include it at this time. I
> would really like to trim out the spring libraries and bootstrapping from
> the CXF dependency list. 
> 
> How can I get a web service to listen on a servlet transport without using
> Spring? I have read earlier posts referring to the CXFNonSpringServlet,
> but when I substitute this class in the web.xml for Tomcat, it does not
> work. There is little in the way of an error message, other than: "Can't
> find the the request for http://myhost/services/hello_world's Observer".
> 
> Thanks in advance!
> 
> --Nick
> 

-- 
View this message in context: http://www.nabble.com/CXFNonSpringServlet-How-To--tp15356670p19611108.html
Sent from the cxf-user mailing list archive at Nabble.com.