Couple questions:
1) What version of CXF?
2) What deployment environment? Tomcat?
3) What's logged to the servers logs?
Looking at the code, if res = msgFac.createMessage(); throws an
exception, the return is null and nothing would get written out. It
might be best to wrapper the exceptions with a WebServiceException or
SOAPFaultException and throw that so the proper exception handling could
occur.
Another note:
Instead of creating all the logger beans and the Bus bean and configuring
all the interceptors and such, it's probably easier to just do:
<cxf:bus>
<cxf:features>
<cxf:logging/>
</cxf:features>
</cxf:bus>
ns:
xmlns:cxf="http://cxf.apache.org/core"
spring validation info:
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
Certainly less verbose. :-)
Dan
On Friday 11 April 2008, Cencio wrote:
> Hi all,
>
> I have a provider implementation for a service, then i want deploy
> with a specified wsdl and every msg should call the invoke() method
>
> I deploy it and my specified wsdl if correctly displayed, but every
> msg sent to the service is threat as OneWay (an empty 200ok is sent
> every time... )
>
> Here is the config:
>
> web.xml
>
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE web-app
> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> <context-param>
> <param-name>contextConfigLocation</param-name>
> <param-value>WEB-INF/beans.xml</param-value>
> </context-param>
>
> <listener>
> <listener-class>
> org.springframework.web.context.ContextLoaderListener
> </listener-class>
> </listener>
>
> <servlet>
> <servlet-name>CXFServlet</servlet-name>
> <display-name>CXF Servlet</display-name>
> <servlet-class>
> org.apache.cxf.transport.servlet.CXFServlet
> </servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>CXFServlet</servlet-name>
> <url-pattern>/*</url-pattern>
> </servlet-mapping>
> </web-app>
>
>
> beans.xml
>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:jaxws="http://cxf.apache.org/jaxws"
> 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">
>
> <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" />
> <bean id="logInbound"
> class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
> <bean id="logOutbound"
> class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>
> <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
> <property name="inInterceptors">
> <list>
> <ref bean="logInbound"/>
> </list>
> </property>
> <property name="outInterceptors">
> <list>
> <ref bean="logOutbound"/>
> </list>
> </property>
> <property name="outFaultInterceptors">
> <list>
> <ref bean="logOutbound"/>
> </list>
> </property>
> </bean>
> <jaxws:endpoint
> id="ese6ordine"
> serviceName="s:OrdineService"
> implementor="isi.esercitazione.java2wsdl.Server"
> address="/ordine"
> xmlns:s="http://www.rivenditore.org/Ordine"/>
>
> </beans>
>
>
>
>
>
>
> isi.esercitazione.java2wsdl.Server
>
> package isi.esercitazione.java2wsdl;
> import javax.xml.soap.MessageFactory;
>
> @ServiceMode(value=Mode.MESSAGE)
> @WebServiceProvider(serviceName = "OrdineService",
> portName = "OrdineInterfaceEndpoint",
> targetNamespace = "http://www.rivenditore.org/Ordine",
> wsdlLocation = "webapps/ese6/WEB-INF/ordini.wsdl")
>
> public class Server implements Provider<SOAPMessage>{
> public SOAPMessage invoke(SOAPMessage req){
>
> SOAPMessage res = null;
> try{
> MessageFactory msgFac = MessageFactory.newInstance();
> res = msgFac.createMessage();
> SOAPFactory soapFac = SOAPFactory.newInstance();
> SOAPBodyElement esito =
> res.getSOAPBody().addBodyElement(soapFac.createName("esito", "ele",
> "http://www.rivenditore.org/ordiniElements"));
> SOAPElement ok = esito.addChildElement("ok");
> SOAPElement id = ok.addChildElement("idOrdine");
> id.setTextContent("123456");
> SOAPElement totale = ok.addChildElement("totale");
> totale.setTextContent("123.45");
> totale.addAttribute(soapFac.createName("valuta"),
> "USD");
>
> }
> catch(SOAPException soapex){
> System.out.println("Errore SOAP: " + soapex);
> soapex.printStackTrace();
> }
> catch(Exception ex){
> System.out.println("Errore SOAP: " + ex);
> ex.printStackTrace();
> }
>
> return res;
> }
> }
>
>
>
>
>
>
>
> Any tip?
>
>
> Thx all,
> Lorenzo
--
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog