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-clas
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.