« Return to Thread: [CXF] deployment problems

[CXF] deployment problems

by Cencio :: Rate this Message:

Reply to Author | View in Thread

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

 « Return to Thread: [CXF] deployment problems