Déploiement CXF sur Tomcat: erreur 404

Résolu/Fermé
c3same Messages postés 3 Date d'inscription mardi 17 décembre 2013 Statut Membre Dernière intervention 17 décembre 2013 - 17 déc. 2013 à 07:47
c3same Messages postés 3 Date d'inscription mardi 17 décembre 2013 Statut Membre Dernière intervention 17 décembre 2013 - 17 déc. 2013 à 08:13
Bonjour,

je débute en java et j'essaies de suivre ce tutoriel :
http://www.jroller.com/gmazza/entry/web_service_tutorial

J'ai donc crée trois projets avec maven comme indiqué dans le tuto (un projet client, un projet service et un projet war). Je démarre tomcat avec la commande startup.bat (sous windows 7).
Ensuite je déploie le service web avec maven :
mvn clean install tomcat7:deploy

Dans le manager de tomcat (http://localhost:8080/manager/html) je trouve bien mon application mais lorsque je clique dessus (http://localhost:8080/doubleit/) j'obtiens une belle erreur 404 :)

Quand je regarde les logs il n'y a pas d'erreur remontée pendant la compilation ou pendant le déploiement. Avez vous une idée de ce qui ne va pas ?

Ma config :

- OS : Windows 7 (amd64)
- Maven : 3.1.1
- JDK : 1.6.0_38
- Tomcat : 7.0.34

Le WSDL utilisé :


<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="DoubleIt"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:di="http://www.example.org/schema/DoubleIt"
xmlns:tns="http://www.example.org/contract/DoubleIt"
targetNamespace="http://www.example.org/contract/DoubleIt">
<wsdl:types>
<xsd:schema targetNamespace="http://www.example.org/schema/DoubleIt">
<xsd:element name="DoubleIt">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="numberToDouble" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="DoubleItResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="doubledNumber" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="DoubleItRequest">
<wsdl:part element="di:DoubleIt" name="parameters" />
</wsdl:message>
<wsdl:message name="DoubleItResponse">
<wsdl:part element="di:DoubleItResponse" name="parameters" />
</wsdl:message>
<wsdl:portType name="DoubleItPortType">
<wsdl:operation name="DoubleIt">
<wsdl:input message="tns:DoubleItRequest" />
<wsdl:output message="tns:DoubleItResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="DoubleItBinding" type="tns:DoubleItPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http/" />
<wsdl:operation name="DoubleIt">
<soap:operation soapAction=""/>
<wsdl:input><soap:body use="literal"/></wsdl:input>
<wsdl:output><soap:body use="literal"/></wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="DoubleItService">
<wsdl:port name="DoubleItPort" binding="tns:DoubleItBinding">
<!-- Default address for Tomcat deployment (CXF/Metro) -->
<soap:address
location="http://localhost:8080/doubleit/services/doubleit"/>
<!-- Default address for Karaf deployment (CXF only) -->
<!--soap:address
location="http://localhost:8181/cxf/doubleit"/-->
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Le web.xml :


<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="DoubleIt"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:di="http://www.example.org/schema/DoubleIt"
xmlns:tns="http://www.example.org/contract/DoubleIt"
targetNamespace="http://www.example.org/contract/DoubleIt">
<wsdl:types>
<xsd:schema targetNamespace="http://www.example.org/schema/DoubleIt">
<xsd:element name="DoubleIt">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="numberToDouble" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="DoubleItResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="doubledNumber" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="DoubleItRequest">
<wsdl:part element="di:DoubleIt" name="parameters" />
</wsdl:message>
<wsdl:message name="DoubleItResponse">
<wsdl:part element="di:DoubleItResponse" name="parameters" />
</wsdl:message>
<wsdl:portType name="DoubleItPortType">
<wsdl:operation name="DoubleIt">
<wsdl:input message="tns:DoubleItRequest" />
<wsdl:output message="tns:DoubleItResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="DoubleItBinding" type="tns:DoubleItPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http/" />
<wsdl:operation name="DoubleIt">
<soap:operation soapAction=""/>
<wsdl:input><soap:body use="literal"/></wsdl:input>
<wsdl:output><soap:body use="literal"/></wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="DoubleItService">
<wsdl:port name="DoubleItPort" binding="tns:DoubleItBinding">
<!-- Default address for Tomcat deployment (CXF/Metro) -->
<soap:address
location="http://localhost:8080/doubleit/services/doubleit"/>
<!-- Default address for Karaf deployment (CXF only) -->
<!--soap:address
location="http://localhost:8181/cxf/doubleit"/-->
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Et en bonus le cxf-servlet.xml :

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/schemas/jaxws.xsd"
xsi:schemaLocation="
http://www.springframework.org/schema/beans/
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/schemas/jaxws.xsd">

<!-- Import statement optional but often required if you're declaring
other CXF beans in this file such as CXF's JMX MBeans -->
<import resource="classpath:META-INF/cxf/cxf.xml"/>

<jaxws:endpoint
id="doubleit"
implementor="service.DoubleItPortTypeImpl"
wsdlLocation="WEB-INF/wsdl/DoubleIt.wsdl"
address="/doubleit">
</jaxws:endpoint>
</beans>

Merci pour vos réponses

2 réponses

KX Messages postés 16734 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 24 avril 2024 3 015
17 déc. 2013 à 07:57
Tu as une 404 sur http://localhost:8080/doubleit/ mais d'après le wsdl tu devrais avoir plutôt http://localhost:8080/doubleit/services/doubleit en entrée et http://localhost:8181/cxf/doubleit en sortie.
0
c3same Messages postés 3 Date d'inscription mardi 17 décembre 2013 Statut Membre Dernière intervention 17 décembre 2013
17 déc. 2013 à 08:01
http://localhost:8080/doubleit/services/doubleit me donne une erreur 404 également.
La deuxième url est commentée (copié/collé du tutoriel) :
<!--soap:address location="http://localhost:8181/cxf/doubleit"/-->
0
c3same Messages postés 3 Date d'inscription mardi 17 décembre 2013 Statut Membre Dernière intervention 17 décembre 2013
17 déc. 2013 à 08:13
Je viens de me rendre compte de ma bêtise.... J'ai copié coller le contenu du wsdl dans le web.xml.... J'ai remis le bon contenu dans ce fichier et tout est rentré dans l'ordre. Je peux désormais naviguer sur :

http://localhost:8080/doubleit/services/doubleit?wsdl

( et non sur http://localhost:8080/doubleit comme je le fesais au début qui me donne toujours une erreur 404 mais c'est normal d'après le wsdl...)
0