You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Preuss, Jacqueline - ENCOWAY" <Pr...@encoway.de> on 2008/10/01 09:02:43 UTC

AW: Problem with CXF configuration

Hi!

Yes, it is on windows. I turned off the firewall, but the error still
occurs.

So, did I initialize something wrong? My server (tomcat) is on my local
machine, running on port 8080. The web application (which is located in
my tomcat folder) can be accessed via the Internet Explorer, which is
the client then, isn't it? In the web.xml the CXFServlet and a context
configuration  is defined. For my web application (client) I init the
web service in Java code as posted below. This procedure is okay?

I have now added some Interceptors for my client like this:

factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());

In the catalina.log I got the following messages:

01.10.2008 08:30:21
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service
{http://www.encoway.de/cxf/ws/Replication}MyWebService from WSDL:
http://localhost:8080/myContext/cxf/ws/Replication?wsdl
01.10.2008 08:30:21 org.apache.cxf.transport.http.HTTPConduit prepare
INFO: AutoRedirect is turned on.
01.10.2008 08:30:21
org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose
INFO: Outbound Message
---------------------------
Encoding: UTF-8
Headers: {SOAPAction=[""], Accept=[*]}
Messages: 
Payload: <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:g
etActiveRevisionWithServiceAndNamespace
xmlns:ns2="http://www.encoway.de/cxf/ws/Replication"><serviceIdent>anID<
/serviceIdent></ns2:getActiveRevisionWithServiceAndNamespace></soap:Body
></soap:Envelope>
--------------------------------------
01.10.2008 08:30:21 org.apache.cxf.interceptor.LoggingInInterceptor
logging
INFO: Inbound Message
----------------------------
Encoding: UTF-8
Headers: {content-type=[text/xml;charset=UTF-8], Date=[Wed, 01 Oct 2008
06:30:21 GMT], Content-Length=[310], SOAPAction=[""],
Server=[Apache-Coyote/1.1]}
Messages: 
Message:

Payload: <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:g
etActiveRevisionWithServiceAndNamespaceResponse
xmlns:ns2="http://www.encoway.de/cxf/ws/Replication"><return>ressource_j
acqui_04</return></ns2:getActiveRevisionWithServiceAndNamespaceResponse>
</soap:Body></soap:Envelope>
--------------------------------------
01.10.2008 08:30:21
org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose
INFO: Outbound Message
---------------------------
Encoding: UTF-8
Headers: {SOAPAction=[""], Accept=[*]}
Messages: 
Payload: <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:g
etActiveRevisionWithServiceAndNamespace
xmlns:ns2="http://www.encoway.de/cxf/ws/Replication"><serviceIdent>anID<
/serviceIdent></ns2:getActiveRevisionWithServiceAndNamespace></soap:Body
></soap:Envelope>
--------------------------------------
01.10.2008 08:30:21 org.apache.cxf.interceptor.LoggingInInterceptor
logging
INFO: Inbound Message
----------------------------
Encoding: UTF-8
Headers: {content-type=[text/xml;charset=UTF-8], Date=[Wed, 01 Oct 2008
06:30:21 GMT], Content-Length=[310], SOAPAction=[""],
Server=[Apache-Coyote/1.1]}
Messages: 
Message:

Payload: 
--------------------------------------
01.10.2008 08:30:21 org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
	at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMes
sage(ReadHeadersInterceptor.java:183)
	at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMes
sage(ReadHeadersInterceptor.java:54)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
hain.java:221)
	...

What confused me is that there a two Inbound and two Outbound messages.
The first outbound messages will return the right result.

Regards,
Jacqueline.

> Is this on windows?   If so, do you have some sort of personal
firewall
> or something enabled?   If so, can you try disabling it?    I've seen
> this with kaspersky firewall thing.
> 
> Dan
> 
> 
> On Tuesday 30 September 2008, Preuss, Jacqueline - ENCOWAY wrote:
> > Hi all!
> >
> >
> >
> > I have a problem with my CXF configuration and I'm searching for a
> > solution for that. I hope you can help me.
> >
> >
> >
> > I have a Tomcat server where I registered the CXF Servlet like this:
> >
> >     <listener>
> >
> >         <listener-class>
> >
> >             org.springframework.web.context.ContextLoaderListener
> >
> >         </listener-class>
> >
> >     </listener>
> >
> >
> >
> >     <context-param>
> >
> >         <param-name>contextConfigLocation</param-name>
> >
> >         <param-value>WEB-INF/cxf.xml</param-value>
> >
> >     </context-param>
> >
> >
> >
> >     <servlet>
> >
> >         <servlet-name>CXFServlet</servlet-name>
> >
> >
> >
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-cl
> >as s>
> >
> >     </servlet>
> >
> >
> >
> >     <servlet-mapping>
> >
> >         <servlet-name>CXFServlet</servlet-name>
> >
> >         <url-pattern>/cxf/*</url-pattern>
> >
> >     </servlet-mapping>
> >
> >
> >
> > The spring configuration file "cxf.xml" contains this:
> >
> > <bean id="replService" class=" com.test.webservice.MyWebService"/>
> >
> > <!-- Service endpoint -->
> >
> > <jaxws:endpoint id="dmfReplCXF"
> > implementorClass="com.test.webservice.MyWebService"
> > implementor="#replService" address="/ws/Replication">
> >
> >    </jaxws:endpoint>
> >
> >
> >
> > When I start the server I can get the available services via
> > http://localhost:8080/myContext/cxf and the wsdl via
> > http://localhost:8080/myContext/cxf/ws/Replication?wsdl
> >
> > I think that's okay, isn't it?
> >
> >
> >
> > When I now open my web application and try to access the web service
I
> > get this "javax.xml.stream.XMLStreamException: ParseError at
> > [row,col]:[1,1]
> >
> > Message: Premature end of file..." In the Tomcat logs I got this:
> >
> > 30.09.2008 11:44:54
> > org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback
> > onClose
> >
> > INFO: Outbound Message
> >
> > ---------------------------
> >
> > Encoding: UTF-8
> >
> > Headers: {SOAPAction=[""], Accept=[*]}
> >
> > Messages:
> >
> > Payload: <soap:Envelope
> >
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2
> >:g etActiveRevisionWithServiceAndNamespace
> >
xmlns:ns2="http://www.test.de/cxf/ws/Replication"><serviceIdent>anID</
> >se
> >
> rviceIdent></ns2:getActiveRevisionWithServiceAndNamespace></soap:Body>
> ></ soap:Envelope>
> >
> > --------------------------------------
> >
> > 30.09.2008 11:44:54 org.apache.cxf.interceptor.LoggingInInterceptor
> > logging
> >
> > INFO: Inbound Message
> >
> > ----------------------------
> >
> > Encoding: UTF-8
> >
> > Headers: {content-type=[text/xml;charset=UTF-8], Date=[Tue, 30 Sep
> > 2008 09:44:54 GMT], Content-Length=[310], SOAPAction=[""],
> > Server=[Apache-Coyote/1.1]}
> >
> > Messages:
> >
> > Message:
> >
> >
> >
> > Payload:
> >
> > --------------------------------------
> >
> > 30.09.2008 11:44:54 org.apache.cxf.phase.PhaseInterceptorChain
> > doIntercept
> >
> > INFO: Interceptor has thrown exception, unwinding now
> >
> > org.apache.cxf.binding.soap.SoapFault: Error reading
> > XMLStreamReader....
> >
> >
> >
> > The Payload is empty. I think that's a mistake but what went wrong?
> >
> >
> >
> > The webservice from my web application is called via Java code. For
> > initialization of the service I use this code:
> >
> >
> >
> >       JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> >
> >       factory.setServiceClass(IMyWebService.class);
> >
> >       final URL url = new URL(protocol, host, port, context);
> >
> >
> >
> >       factory.setAddress(url.toString());
> >
> >
> >
> >       if (userName != null && password != null &&
!userName.isEmpty()
> > && !password.isEmpty())
> >
> >       {
> >
> >             factory.setUsername(userName);
> >
> >             factory.setPassword(password);
> >
> >       }
> >
> >
> >
> >       cxfService = (IMyWebService) factory.create();
> >
> >
> >
> >       // ProxyServer?
> >
> >       if (proxyServer != null && !proxyServer.isEmpty() &&
> > proxyServerPort > 0)
> >
> >       {
> >
> >         Client client = ClientProxy.getClient(cxfService);
> >
> >         HTTPConduit http = (HTTPConduit) client.getConduit();
> >
> >
> >
> >         HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
> >
> >
> >
> >         httpClientPolicy.setConnectionTimeout(36000);
> >
> >         httpClientPolicy.setAllowChunking(false);
> >
> >         httpClientPolicy.setProxyServer(proxyServer);
> >
> >         httpClientPolicy.setProxyServerPort(proxyServerPort);
> >
> >         http.setClient(httpClientPolicy);
> >
> >       }
> >
> >
> >
> > Can you give me some tips? Do I misunderstand something...?
> >
> >
> >
> > Regards,
> >
> > Jacqueline.
> 
> 
> 
> --
> J. Daniel Kulp
> Principal Engineer, IONA
> dkulp@apache.org
> http://www.dankulp.com/blog

AW: Problem with CXF configuration

Posted by "Preuss, Jacqueline - ENCOWAY" <Pr...@encoway.de>.
Hi again!

One thing I found out:

When I access my web service via a java class (with main method) from Eclipse (not from my web application in IE), everything works fine. The logging messages only appear once. I didn't get the exception.

Do you have an idea?

Regards,
Jacqueline.

> -----Ursprüngliche Nachricht-----
> Von: Preuss, Jacqueline - ENCOWAY [mailto:Preuss@encoway.de]
> Gesendet: Mittwoch, 1. Oktober 2008 09:03
> An: users@cxf.apache.org
> Cc: Daniel Kulp
> Betreff: AW: Problem with CXF configuration
> 
> 
> Hi!
> 
> Yes, it is on windows. I turned off the firewall, but the error still
> occurs.
> 
> So, did I initialize something wrong? My server (tomcat) is on my local
> machine, running on port 8080. The web application (which is located in
> my tomcat folder) can be accessed via the Internet Explorer, which is
> the client then, isn't it? In the web.xml the CXFServlet and a context
> configuration  is defined. For my web application (client) I init the
> web service in Java code as posted below. This procedure is okay?
> 
> I have now added some Interceptors for my client like this:
> 
> factory.getInInterceptors().add(new LoggingInInterceptor());
> factory.getOutInterceptors().add(new LoggingOutInterceptor());
> 
> In the catalina.log I got the following messages:
> 
> 01.10.2008 08:30:21
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromWSDL
> INFO: Creating Service
> {http://www.encoway.de/cxf/ws/Replication}MyWebService from WSDL:
> http://localhost:8080/myContext/cxf/ws/Replication?wsdl
> 01.10.2008 08:30:21 org.apache.cxf.transport.http.HTTPConduit prepare
> INFO: AutoRedirect is turned on.
> 01.10.2008 08:30:21
> org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose
> INFO: Outbound Message
> ---------------------------
> Encoding: UTF-8
> Headers: {SOAPAction=[""], Accept=[*]}
> Messages:
> Payload: <soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:
> g
> etActiveRevisionWithServiceAndNamespace
> xmlns:ns2="http://www.encoway.de/cxf/ws/Replication"><serviceIdent>anID
> <
> /serviceIdent></ns2:getActiveRevisionWithServiceAndNamespace></soap:Bod
> y
> ></soap:Envelope>
> --------------------------------------
> 01.10.2008 08:30:21 org.apache.cxf.interceptor.LoggingInInterceptor
> logging
> INFO: Inbound Message
> ----------------------------
> Encoding: UTF-8
> Headers: {content-type=[text/xml;charset=UTF-8], Date=[Wed, 01 Oct 2008
> 06:30:21 GMT], Content-Length=[310], SOAPAction=[""],
> Server=[Apache-Coyote/1.1]}
> Messages:
> Message:
> 
> Payload: <soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:
> g
> etActiveRevisionWithServiceAndNamespaceResponse
> xmlns:ns2="http://www.encoway.de/cxf/ws/Replication"><return>ressource_j
> acqui_04</return></ns2:getActiveRevisionWithServiceAndNamespaceRespons
> e>
> </soap:Body></soap:Envelope>
> --------------------------------------
> 01.10.2008 08:30:21
> org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose
> INFO: Outbound Message
> ---------------------------
> Encoding: UTF-8
> Headers: {SOAPAction=[""], Accept=[*]}
> Messages:
> Payload: <soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:
> g
> etActiveRevisionWithServiceAndNamespace
> xmlns:ns2="http://www.encoway.de/cxf/ws/Replication"><serviceIdent>anID
> <
> /serviceIdent></ns2:getActiveRevisionWithServiceAndNamespace></soap:Bod
> y
> ></soap:Envelope>
> --------------------------------------
> 01.10.2008 08:30:21 org.apache.cxf.interceptor.LoggingInInterceptor
> logging
> INFO: Inbound Message
> ----------------------------
> Encoding: UTF-8
> Headers: {content-type=[text/xml;charset=UTF-8], Date=[Wed, 01 Oct 2008
> 06:30:21 GMT], Content-Length=[310], SOAPAction=[""],
> Server=[Apache-Coyote/1.1]}
> Messages:
> Message:
> 
> Payload:
> --------------------------------------
> 01.10.2008 08:30:21 org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
> 	at
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMes
> sage(ReadHeadersInterceptor.java:183)
> 	at
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMes
> sage(ReadHeadersInterceptor.java:54)
> 	at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> hain.java:221)
> 	...
> 
> What confused me is that there a two Inbound and two Outbound messages.
> The first outbound messages will return the right result.
> 
> Regards,
> Jacqueline.
> 
> > Is this on windows?   If so, do you have some sort of personal
> firewall
> > or something enabled?   If so, can you try disabling it?    I've seen
> > this with kaspersky firewall thing.
> >
> > Dan
> >
> >
> > On Tuesday 30 September 2008, Preuss, Jacqueline - ENCOWAY wrote:
> > > Hi all!
> > >
> > >
> > >
> > > I have a problem with my CXF configuration and I'm searching for a
> > > solution for that. I hope you can help me.
> > >
> > >
> > >
> > > I have a Tomcat server where I registered the CXF Servlet like this:
> > >
> > >     <listener>
> > >
> > >         <listener-class>
> > >
> > >             org.springframework.web.context.ContextLoaderListener
> > >
> > >         </listener-class>
> > >
> > >     </listener>
> > >
> > >
> > >
> > >     <context-param>
> > >
> > >         <param-name>contextConfigLocation</param-name>
> > >
> > >         <param-value>WEB-INF/cxf.xml</param-value>
> > >
> > >     </context-param>
> > >
> > >
> > >
> > >     <servlet>
> > >
> > >         <servlet-name>CXFServlet</servlet-name>
> > >
> > >
> > >
> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-cl
> > >as s>
> > >
> > >     </servlet>
> > >
> > >
> > >
> > >     <servlet-mapping>
> > >
> > >         <servlet-name>CXFServlet</servlet-name>
> > >
> > >         <url-pattern>/cxf/*</url-pattern>
> > >
> > >     </servlet-mapping>
> > >
> > >
> > >
> > > The spring configuration file "cxf.xml" contains this:
> > >
> > > <bean id="replService" class=" com.test.webservice.MyWebService"/>
> > >
> > > <!-- Service endpoint -->
> > >
> > > <jaxws:endpoint id="dmfReplCXF"
> > > implementorClass="com.test.webservice.MyWebService"
> > > implementor="#replService" address="/ws/Replication">
> > >
> > >    </jaxws:endpoint>
> > >
> > >
> > >
> > > When I start the server I can get the available services via
> > > http://localhost:8080/myContext/cxf and the wsdl via
> > > http://localhost:8080/myContext/cxf/ws/Replication?wsdl
> > >
> > > I think that's okay, isn't it?
> > >
> > >
> > >
> > > When I now open my web application and try to access the web service
> I
> > > get this "javax.xml.stream.XMLStreamException: ParseError at
> > > [row,col]:[1,1]
> > >
> > > Message: Premature end of file..." In the Tomcat logs I got this:
> > >
> > > 30.09.2008 11:44:54
> > > org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback
> > > onClose
> > >
> > > INFO: Outbound Message
> > >
> > > ---------------------------
> > >
> > > Encoding: UTF-8
> > >
> > > Headers: {SOAPAction=[""], Accept=[*]}
> > >
> > > Messages:
> > >
> > > Payload: <soap:Envelope
> > >
> >
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2
> > >:g etActiveRevisionWithServiceAndNamespace
> > >
> xmlns:ns2="http://www.test.de/cxf/ws/Replication"><serviceIdent>anID</
> > >se
> > >
> >
> rviceIdent></ns2:getActiveRevisionWithServiceAndNamespace></soap:Body>
> > ></ soap:Envelope>
> > >
> > > --------------------------------------
> > >
> > > 30.09.2008 11:44:54 org.apache.cxf.interceptor.LoggingInInterceptor
> > > logging
> > >
> > > INFO: Inbound Message
> > >
> > > ----------------------------
> > >
> > > Encoding: UTF-8
> > >
> > > Headers: {content-type=[text/xml;charset=UTF-8], Date=[Tue, 30 Sep
> > > 2008 09:44:54 GMT], Content-Length=[310], SOAPAction=[""],
> > > Server=[Apache-Coyote/1.1]}
> > >
> > > Messages:
> > >
> > > Message:
> > >
> > >
> > >
> > > Payload:
> > >
> > > --------------------------------------
> > >
> > > 30.09.2008 11:44:54 org.apache.cxf.phase.PhaseInterceptorChain
> > > doIntercept
> > >
> > > INFO: Interceptor has thrown exception, unwinding now
> > >
> > > org.apache.cxf.binding.soap.SoapFault: Error reading
> > > XMLStreamReader....
> > >
> > >
> > >
> > > The Payload is empty. I think that's a mistake but what went wrong?
> > >
> > >
> > >
> > > The webservice from my web application is called via Java code. For
> > > initialization of the service I use this code:
> > >
> > >
> > >
> > >       JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> > >
> > >       factory.setServiceClass(IMyWebService.class);
> > >
> > >       final URL url = new URL(protocol, host, port, context);
> > >
> > >
> > >
> > >       factory.setAddress(url.toString());
> > >
> > >
> > >
> > >       if (userName != null && password != null &&
> !userName.isEmpty()
> > > && !password.isEmpty())
> > >
> > >       {
> > >
> > >             factory.setUsername(userName);
> > >
> > >             factory.setPassword(password);
> > >
> > >       }
> > >
> > >
> > >
> > >       cxfService = (IMyWebService) factory.create();
> > >
> > >
> > >
> > >       // ProxyServer?
> > >
> > >       if (proxyServer != null && !proxyServer.isEmpty() &&
> > > proxyServerPort > 0)
> > >
> > >       {
> > >
> > >         Client client = ClientProxy.getClient(cxfService);
> > >
> > >         HTTPConduit http = (HTTPConduit) client.getConduit();
> > >
> > >
> > >
> > >         HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
> > >
> > >
> > >
> > >         httpClientPolicy.setConnectionTimeout(36000);
> > >
> > >         httpClientPolicy.setAllowChunking(false);
> > >
> > >         httpClientPolicy.setProxyServer(proxyServer);
> > >
> > >         httpClientPolicy.setProxyServerPort(proxyServerPort);
> > >
> > >         http.setClient(httpClientPolicy);
> > >
> > >       }
> > >
> > >
> > >
> > > Can you give me some tips? Do I misunderstand something...?
> > >
> > >
> > >
> > > Regards,
> > >
> > > Jacqueline.
> >
> >
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer, IONA
> > dkulp@apache.org
> > http://www.dankulp.com/blog