IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Spring Java Discussion :

[Spring-WS] Problème d'accès au WS [Web Services]


Sujet :

Spring Java

  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    15
    Détails du profil
    Informations personnelles :
    Âge : 57
    Localisation : Belgique

    Informations forums :
    Inscription : Juin 2007
    Messages : 15
    Par défaut [Spring-WS] Problème d'accès au WS
    Mon problème est le suivant enfin mes problèmes(2)
    1:Lorsque je déploie mon service(war) sur le serveur tomcat, le répertoire correspondant est bien créé (ok). Lorsque je pointe avec mon navigateur sur le service, une erreur 405 est signalé par mon navigateur.

    2: J’ai essayé de générer automatiquement le WSDL avec votre exemple et avec l’exemple sur le tutoriel officiel, et j’obtient la même erreur :
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hrSearcher' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Cannot resolve reference to bean 'mySchema' while setting bean property 'schema'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySchema' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.io.Resource.getURI()Ljava/net/URI;
    je pense avoir épuisé toutes mes ressources

    d’avance

    pour info, voici la structure du projet déployé sur tomcat
    +---hrSearchService
    | +---META-INF
    | | \---maven
    | | \---net.memel
    | | \---hrSearchService
    | +---schema\hrSearch.xsd
    | \---WEB-INF\spring-ws-servlet.xml & web.xml
    | +---classes
    | | +---be
    | | | \---memel
    | | | +---model\Military.class
    | | | +---schema\hrSearch.xsd
    | | | \---spring
    | | | \---ws\HrService.class
    | | | \---endpoint\HrSearcherEndpoint.class
    | | \---schema
    | +---lib */J'ai ici toutes les libraires nécessaires/*
    | \---schema\hrSearch.xsd

    Voici aussi le fichier spring-ws-servlet.xml
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
     
     
    	<bean id="hrSearcherEndpoint" class="be.memel.spring.ws.endpoint.HrSearcherEndpoint">
    		<property name="hrService" ref="hrService"/>
    	</bean>
    	<bean id="hrService" class="be.memel.spring.ws.HrService">
    	</bean>
     
    	<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
    		<property name="mappings">
    			<props>
    				<prop key="{http://localhost:8080/hrSearchService/schema/hrSearch}MilitaryRequest">hrSearcherEndpoint</prop>
    			</props>
    		</property>
    		<property name="interceptors">
    			<list>
    				<bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
    			</list>
    		</property>
    	</bean>
     
    	<bean id="hrSearcher" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
    		<property name="schema" ref="mySchema" />
    		<property name="portTypeName" value="hrSearcher" />
    		<property name="locationUri" value="/hrSearchService/" />
    <!--	<property name="targetNameSpace" value="/hrSearchService/definitions" /> -->
    	</bean>
    	<bean id="mySchema" class="org.springframework.xml.xsd.SimpleXsdSchema">
    		<property name="xsd" value="/WEB-INF/schema/hrSearch.xsd" />
    	</bean>
    </beans>

  2. #2
    Rédacteur
    Avatar de Hikage
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    1 177
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2004
    Messages : 1 177
    Par défaut
    Peux tu nous dire quelle version de Spring WS et Spring utilise tu ?
    Hikage
    SCJP / SCWCD & SCWSJD Certified / Spring Framework Certified
    [Personal Web] [CV]

    F.A.Q Spring Framework - Participez !

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    15
    Détails du profil
    Informations personnelles :
    Âge : 57
    Localisation : Belgique

    Informations forums :
    Inscription : Juin 2007
    Messages : 15
    Par défaut Versions
    Spring ws 1.5.4
    Spring 2

  4. #4
    Rédacteur
    Avatar de Hikage
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    1 177
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2004
    Messages : 1 177
    Par défaut
    Il semblerait que pour utiliser Spring WS 1.5, il soit nécessaire d'utiliser Spring 2.5.

    As-tu la possibilité d'essayer ?
    Hikage
    SCJP / SCWCD & SCWSJD Certified / Spring Framework Certified
    [Personal Web] [CV]

    F.A.Q Spring Framework - Participez !

  5. #5
    Membre averti
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    15
    Détails du profil
    Informations personnelles :
    Âge : 57
    Localisation : Belgique

    Informations forums :
    Inscription : Juin 2007
    Messages : 15
    Par défaut Version
    Je teste cela demain et je te dis ce qu'il en est

  6. #6
    Membre averti
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    15
    Détails du profil
    Informations personnelles :
    Âge : 57
    Localisation : Belgique

    Informations forums :
    Inscription : Juin 2007
    Messages : 15
    Par défaut Vérification des versions
    J'ai mis la version 2.5 de spring et 1.5 de spring_WS mais toujours la même erreur


    ça fait 3 jours que et pas moyen, je ne comprends pas mes erreur, je commence à

  7. #7
    Rédacteur
    Avatar de Hikage
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    1 177
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2004
    Messages : 1 177
    Par défaut
    Est-tu sur de ne pas avoir deux version de Spring en meme temps ?

    Car si je regarde la javadoc de Spring, et en particulier Resources :

    version 2.0
    pas de getURI();

    version 2.5
    Presence de getURI();


    Y a t-il moyen d'avoir la liste complète des dépendances ( jar ) de ton projet ?
    Hikage
    SCJP / SCWCD & SCWSJD Certified / Spring Framework Certified
    [Personal Web] [CV]

    F.A.Q Spring Framework - Participez !

  8. #8
    Membre averti
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    15
    Détails du profil
    Informations personnelles :
    Âge : 57
    Localisation : Belgique

    Informations forums :
    Inscription : Juin 2007
    Messages : 15
    Par défaut
    Voici la liste de mes .jar
    02/12/2008 15:08 4.467 aopalliance-1.0.jar
    02/12/2008 15:08 52.915 commons-logging-1.1.jar
    30/10/2008 21:40 313.898 dom4j-1.6.1.jar
    02/12/2008 15:10 2.450.757 icu4j-2.6.1.jar
    02/12/2008 15:08 226.529 jaxen-1.1.jar
    30/10/2008 21:40 153.253 jdom-1.0.jar
    14/11/2007 01:16 153.115 jdom.jar
    02/12/2008 15:08 358.085 log4j-1.2.12.jar
    02/12/2008 15:08 390.070 spring-beans-2.0.7.jar
    02/12/2008 15:08 160.406 spring-context-2.0.7.jar
    02/12/2008 15:08 182.534 spring-core-2.0.7.jar
    02/12/2008 15:08 53.216 spring-oxm-1.0.2.jar
    23/10/2008 10:28 68.164 spring-oxm-1.5.4.jar
    23/10/2008 10:29 15.132 spring-oxm-tiger-1.5.4.jar
    29/02/2008 23:41 3.073.081 spring-sources.jar
    02/12/2008 15:08 151.767 spring-web-2.0.7.jar
    02/12/2008 15:08 284.532 spring-webmvc-2.0.7.jar
    23/10/2008 10:29 728.933 spring-ws-1.5.4-sources.jar
    23/10/2008 10:29 760.521 spring-ws-1.5.4.jar
    02/12/2008 15:08 297.265 spring-ws-core-1.0.2.jar
    23/10/2008 10:29 421.077 spring-ws-core-1.5.4.jar
    23/10/2008 10:29 22.475 spring-ws-core-tiger-1.5.4.jar
    23/10/2008 10:29 110.125 spring-ws-security-1.5.4.jar
    23/10/2008 10:29 60.761 spring-ws-support-1.5.4.jar
    02/12/2008 15:08 67.889 spring-xml-1.0.2.jar
    23/10/2008 10:29 90.481 spring-xml-1.5.4.jar
    29/02/2008 23:41 2.884.922 spring.jar
    23/10/2008 10:29 393.259 standard.jar
    02/12/2008 15:08 26.514 stax-api-1.0.1.jar
    02/12/2008 15:08 148.522 wsdl4j-1.6.1.jar
    02/12/2008 15:09 3.149.655 xalan-2.6.0.jar
    02/12/2008 15:09 1.010.675 xercesImpl-2.6.2.jar
    02/12/2008 15:08 194.205 xml-apis-1.3.02.jar
    02/12/2008 15:09 124.724 xmlParserAPIs-2.6.2.jar
    02/12/2008 15:09 108.874 xom-1.0.jar

    J'ai bien vérifié et c'est la version 2.5 de Spring alors ???

    j'ai ouvert le Resource dans mon spring.jar et je remarque la méthode .getURI() à n'y rien comprendre

  9. #9
    Rédacteur
    Avatar de Hikage
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    1 177
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2004
    Messages : 1 177
    Par défaut
    Citation Envoyé par tontonmemel Voir le message
    Voici la liste de mes .jar
    02/12/2008 15:08 4.467 aopalliance-1.0.jar
    02/12/2008 15:08 52.915 commons-logging-1.1.jar
    30/10/2008 21:40 313.898 dom4j-1.6.1.jar
    02/12/2008 15:10 2.450.757 icu4j-2.6.1.jar
    02/12/2008 15:08 226.529 jaxen-1.1.jar
    30/10/2008 21:40 153.253 jdom-1.0.jar
    14/11/2007 01:16 153.115 jdom.jar
    02/12/2008 15:08 358.085 log4j-1.2.12.jar
    02/12/2008 15:08 390.070 spring-beans-2.0.7.jar
    02/12/2008 15:08 160.406 spring-context-2.0.7.jar
    02/12/2008 15:08 182.534 spring-core-2.0.7.jar
    02/12/2008 15:08 53.216 spring-oxm-1.0.2.jar
    23/10/2008 10:28 68.164 spring-oxm-1.5.4.jar
    23/10/2008 10:29 15.132 spring-oxm-tiger-1.5.4.jar
    29/02/2008 23:41 3.073.081 spring-sources.jar
    02/12/2008 15:08 151.767 spring-web-2.0.7.jar
    02/12/2008 15:08 284.532 spring-webmvc-2.0.7.jar
    23/10/2008 10:29 728.933 spring-ws-1.5.4-sources.jar
    23/10/2008 10:29 760.521 spring-ws-1.5.4.jar
    02/12/2008 15:08 297.265 spring-ws-core-1.0.2.jar
    23/10/2008 10:29 421.077 spring-ws-core-1.5.4.jar
    23/10/2008 10:29 22.475 spring-ws-core-tiger-1.5.4.jar
    23/10/2008 10:29 110.125 spring-ws-security-1.5.4.jar
    23/10/2008 10:29 60.761 spring-ws-support-1.5.4.jar
    02/12/2008 15:08 67.889 spring-xml-1.0.2.jar
    23/10/2008 10:29 90.481 spring-xml-1.5.4.jar
    29/02/2008 23:41 2.884.922 spring.jar
    23/10/2008 10:29 393.259 standard.jar
    02/12/2008 15:08 26.514 stax-api-1.0.1.jar
    02/12/2008 15:08 148.522 wsdl4j-1.6.1.jar
    02/12/2008 15:09 3.149.655 xalan-2.6.0.jar
    02/12/2008 15:09 1.010.675 xercesImpl-2.6.2.jar
    02/12/2008 15:08 194.205 xml-apis-1.3.02.jar
    02/12/2008 15:09 124.724 xmlParserAPIs-2.6.2.jar
    02/12/2008 15:09 108.874 xom-1.0.jar

    J'ai bien vérifié et c'est la version 2.5 de Spring alors ???

    Je doute :-)
    Vérifie que tu as bien modifie la dependance ( via Eclipse si tu utilise eclipse pour le build, ou dans le pom.xml si tu utilise maven ), fait un clean complet, et regénére le war au complet.

    Cela dit tu semble avoir deux version de Spring WS aussi :

    02/12/2008 15:08 297.265 spring-ws-core-1.0.2.jar
    23/10/2008 10:29 421.077 spring-ws-core-1.5.4.jar
    Hikage
    SCJP / SCWCD & SCWSJD Certified / Spring Framework Certified
    [Personal Web] [CV]

    F.A.Q Spring Framework - Participez !

  10. #10
    Membre averti
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    15
    Détails du profil
    Informations personnelles :
    Âge : 57
    Localisation : Belgique

    Informations forums :
    Inscription : Juin 2007
    Messages : 15
    Par défaut
    Je m'incline bien pas : mélange des dépendances dans maven, mais encore un problème, je ne trouve pas le jar que je dois importé car il me fait java.lang.NoClassDefFoundError: javax/xml/stream/XMLStreamException
    appelé à partir du
    <bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">

    Merci

  11. #11
    Rédacteur
    Avatar de Hikage
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    1 177
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2004
    Messages : 1 177
    Par défaut
    Ca, c'est Stax.

    Ajoute une implémentation ( woodstock de codehaus ) par exemple
    Hikage
    SCJP / SCWCD & SCWSJD Certified / Spring Framework Certified
    [Personal Web] [CV]

    F.A.Q Spring Framework - Participez !

  12. #12
    Membre averti
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    15
    Détails du profil
    Informations personnelles :
    Âge : 57
    Localisation : Belgique

    Informations forums :
    Inscription : Juin 2007
    Messages : 15
    Par défaut Après stax c'est SOAP
    Voici une nouvelle exception qui m'arrive
    java.lang.NoClassDefFoundError: javax/xml/soap/SOAPException
    J'ai touvé cette classe dans un jar (saaj-api.jar.zip), mais si je le met, il manque d'autres classes propres à saaj alors ???.
    J'ai ajouté le soap.jar mais pas de conséquence évidemment. En ce qui concerne stax, je l'ai mis dans les dépendances du pom.xml
    mais je deviens taré car j'aimerai terminer ce projet durant le week-end

  13. #13
    Rédacteur
    Avatar de Hikage
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    1 177
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2004
    Messages : 1 177
    Par défaut
    Tiens, voici le pom de mon module spring WS pour le projet Tudu List :

    http://tudu.svn.sourceforge.net/view...ml?view=markup


    A mon avis, ajoute :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     <dependency>
                <groupId>com.sun.xml.messaging.saaj</groupId>
                <artifactId>saaj-impl</artifactId>
                <version>1.3</version>
            </dependency>
    Hikage
    SCJP / SCWCD & SCWSJD Certified / Spring Framework Certified
    [Personal Web] [CV]

    F.A.Q Spring Framework - Participez !

  14. #14
    Membre averti
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    15
    Détails du profil
    Informations personnelles :
    Âge : 57
    Localisation : Belgique

    Informations forums :
    Inscription : Juin 2007
    Messages : 15
    Par défaut From Scratch
    Je ne m'en sortais plus , avec ces dépendances, j'ai donc refait le projet from scratch sans maven, ni ant.
    Je n'ai plus d'erreur dans Tomcat, mais il me dit :
    Etat HTTP 405 -

    type Rapport d'état

    message

    description La méthode HTTP spécifiée n'est pas autorisée pour la ressource demandée ().
    Apache Tomcat/5.5.26


    ******************************************

    voici la liste des librairies utilisées :

    aopalliance-1.0.jar
    axis-ant.jar
    axis-schema.jar
    axis.jar
    commons-discovery-0.2.jar
    commons-logging-1.0.4.jar
    commons-logging-1.1.1.jar
    dom4j-1.6.1.jar
    icu4j-2.6.1.jar
    jaxen-1.1.jar
    jaxrpc.jar
    jdom-1.0.jar
    log4j-1.2.8.jar
    saaj.jar
    soap.jar
    spring-aop-2.5.5.jar
    spring-beans-2.5.5.jar
    spring-context-2.5.5.jar
    spring-context-support-2.5.5.jar
    spring-core-2.5.5.jar
    spring-oxm-1.5.4.jar
    spring-oxm-tiger-1.5.4.jar
    spring-sources.jar
    spring-web-2.5.5.jar
    spring-webmvc-2.5.5.jar
    spring-ws-1.5.4-sources.jar
    spring-ws-1.5.4.jar
    spring-ws-core-1.5.4.jar
    spring-ws-core-tiger-1.5.4.jar
    spring-ws-security-1.5.4.jar
    spring-ws-support-1.5.4.jar
    spring-xml-1.5.4.jar
    spring.jar
    standard.jar
    stax-1.2.0.jar
    stax-api-1.0.1.jar
    wsdl4j-1.5.1.jar
    wsdl4j-1.6.1.jar
    xalan-2.6.0.jar
    xercesImpl-2.6.2.jar
    xml-apis-1.3.02.jar
    xmlParserAPIs-2.6.2.jar
    xom-1.0.jar


    *************************************
    voici une copie de mon web.xml
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
             version="2.4">
     
        <display-name>From Scratch creating SpringWS Project By RMN</display-name>
     
        <servlet>
            <servlet-name>spring-ws</servlet-name>
            <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
        </servlet>
     
        <servlet-mapping>
            <servlet-name>spring-ws</servlet-name>
            <url-pattern>/*</url-pattern>
        </servlet-mapping>
     
    </web-app>

    ************************************
    une copie de spring-ws-servlet.xml
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
     
     
    	<bean id="hrSearcherEndpoint" class="be.memel.spring.ws.endpoint.HrSearcherEndpoint">
    		<property name="hrService" ref="hrService"/>
    	</bean>
    	<bean id="hrService" class="be.memel.spring.ws.HrService">
    	</bean>
     
    	<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
    		<property name="mappings">
    			<props>
    				<prop key="{http://localhost:8080/HRSEARCHER01/schema/hrSearch}MilitaryRequest">hrSearcherEndpoint</prop>
    			</props>
    		</property>
    		<property name="interceptors">
    			<list>
    				<bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
    			</list>
    		</property>
    	</bean>
    </beans>

    ***************************************
    voici le message que me donne TOMCAT

    - Initializing Spring FrameworkServlet 'spring-ws'
    - FrameworkServlet 'spring-ws': initialization started
    - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1bbd583: display name [WebApplicationContext for namespace 'spring-ws-servlet']; startup date [Wed Dec 17 16:52:39 CET 2008]; root of context hierarchy
    - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-ws-servlet.xml]
    - Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@1bbd583]: org.springframework.beans.factory.support.DefaultListableBeanFactory@153f141
    - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@153f141: defining beans [hrSearcherEndpoint,hrService,org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping#0]; root of factory hierarchy
    - Creating SAAJ 1.2 MessageFactory
    - FrameworkServlet 'spring-ws': initialization completed in 4076 ms



    ****************************************
    Voici une copie de mon EndPoint
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    package be.memel.spring.ws.endpoint;
     
     
    import org.jdom.Element;
    import org.jdom.Namespace;
    import org.jdom.xpath.XPath;
    import org.springframework.ws.server.endpoint.AbstractJDomPayloadEndpoint;
     
    import be.memel.model.Military;
    import be.memel.spring.ws.HrService;
     
    public class HrSearcherEndpoint extends AbstractJDomPayloadEndpoint {
     
    	private HrService hrSearcher;
     
    	public void setHrService(HrService hrSearcher)
    	{
    		this.hrSearcher = hrSearcher;
    	}
     
    	protected Element invokeInternal(Element request) throws Exception {
    		Namespace namespace = Namespace.getNamespace("militarySearcher",
    			"http://localhost:8080/HRSEARCHER01/schema/hrSearch");
    		// Création des requête XPath pour récupérer les informations
    		XPath matriculationExpression =
    			XPath.newInstance("//militarySearcher:MilitaryRequest/militarySearcher:matriculation");
    		matriculationExpression.addNamespace(namespace);
     
    // Récupération des informations à partir de la requête
    		String matriculation = matriculationExpression.valueOf(request);
     
    // Appel au service pour la traduction
    		Military mil = hrSearcher.getMilitary(matriculation);
    // Création de la réponse
    		Element root = new Element("MilitaryResponse", namespace);
    		Element mat = new Element("matriculation", namespace);
    		mat.setText(mil.getMatriculation());
    		Element name  = new Element("name", namespace);
    		name.setText(mil.getName());
    		Element fname = new Element("firstname", namespace);
    		fname.setText(mil.getFirstname());
    		Element birthdate = new Element("birthdate", namespace);
    		birthdate.setText(mil.getBirthdate());
    		Element rank = new Element("rank", namespace);
    		rank.setText(mil.getRank());
    		Element orgNumber = new Element("orgNumber", namespace);
    		orgNumber.setText(mil.getOrgNumber());
    		Element language = new Element("language", namespace);
    		language.setText(mil.getLanguage());
    		Element sex = new Element("sec", namespace);
    		sex.setText(mil.getSex());
    		Element affecdate = new Element("affectdate", namespace);
    		affecdate.setText(mil.getAffectDate());
    		Element corps = new Element("corps", namespace);
    		corps.setText(mil.getCorps());
    		root.addContent(matriculation);
    		root.addContent(name);
    		root.addContent(fname);
    		root.addContent(birthdate);
    		root.addContent(rank);
    		root.addContent(orgNumber);
    		root.addContent(language);
    		root.addContent(sex);
    		root.addContent(affecdate);
    		root.addContent(corps);
    		return root;
    	}
    }
    Et voici une copie de mon Service

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    package be.memel.spring.ws;
     
    import java.io.Serializable;
     
    import be.memel.model.Military;
     
    public class HrService implements Serializable{
     
    	private Military mil = new Military();
     
    	/**
             *
             */
    	private static final long serialVersionUID = 1L;
     
    	public Military getMilitary(String matriculation) {
    		mil.setMatriculation(matriculation);
    		mil.setName("romano");
    		mil.setFirstname("carmelo");
    		mil.setBirthdate("13/03/1968");
    		mil.setAffectDate("01/09/1987");
    		mil.setCorps("FT");
    		mil.setLanguage("F");
    		mil.setOrgNumber("CCFmnSp Dept CIS");
    		mil.setRank("Adjt");
    		mil.setSex("M");
    		return mil;
    	}
     
    }
    Je suis totalement perdu, je ne sais pas vers quoi me tourner,

    Merci de ton aide

  15. #15
    Membre averti
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    15
    Détails du profil
    Informations personnelles :
    Âge : 57
    Localisation : Belgique

    Informations forums :
    Inscription : Juin 2007
    Messages : 15
    Par défaut Encore un petit problème
    Enfin j'ai trouvé mon erreur, il faut faire un message SOAP correct pour appelé le service (ou un formulaire en méthode post permet d'accéder au service).

    Encore un petit problème quand même , je n'arrive pas à créer mon WSDL malgré ce code dans le fichier spring-ws-servlet.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    <bean id="hrSearcher" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
    		<property name="schema" ref="mySchema" />
    		<property name="portTypeName" value="hrsearcher" />
    		<property name="locationUri" value="/ws/" />
    	</bean>
    	<bean id="mySchema" class="org.springframework.xml.xsd.SimpleXsdSchema">
    		<property name="xsd" value="http://localhost:8080/hrsearcher/schema/hrSearch.xsd" />
    	</bean>
    Il ne m'indique pas d'erreurs, mais pas de wsdl

  16. #16
    Membre averti
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    48
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Avril 2009
    Messages : 48
    Par défaut
    Slt;
    je sais que ça fait longtemps que vous avez posté votre discussion mais j'ai le meme problème que vous, j'arrive pas à générer mon wsdl.
    est ce que vous pouvez me dire comment vous vous en etes sortis, je suis vraiment pressé pour mon projet et ça n'avance vraiment pas!!

    ps: vous avez utilisé maven?? ya pa un moyen de faire un webservice srping ws mais sans maven???

  17. #17
    Membre expérimenté Avatar de aymen83
    Inscrit en
    Décembre 2007
    Messages
    271
    Détails du profil
    Informations forums :
    Inscription : Décembre 2007
    Messages : 271
    Par défaut
    Citation Envoyé par tontonmemel Voir le message
    Enfin j'ai trouvé mon erreur, il faut faire un message SOAP correct pour appelé le service (ou un formulaire en méthode post permet d'accéder au service).

    Encore un petit problème quand même , je n'arrive pas à créer mon WSDL malgré ce code dans le fichier spring-ws-servlet.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    <bean id="hrSearcher" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
    		<property name="schema" ref="mySchema" />
    		<property name="portTypeName" value="hrsearcher" />
    		<property name="locationUri" value="/ws/" />
    	</bean>
    	<bean id="mySchema" class="org.springframework.xml.xsd.SimpleXsdSchema">
    		<property name="xsd" value="http://localhost:8080/hrsearcher/schema/hrSearch.xsd" />
    	</bean>
    Il ne m'indique pas d'erreurs, mais pas de wsdl
    remplace ceci
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    class="org.springframework.xml.xsd.SimpleXsdSchema">
    		<property name="xsd" value="http://localhost:8080/hrsearcher/schema/hrSearch.xsd" />
    	</bean>
    par cela
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    class="org.springframework.xml.xsd.SimpleXsdSchema">
    		<property name="xsd" value="(le chemin vers le xsd probablement WEB-INF)hrSearch.xsd" />
    	</bean>
    ton location uri doit contenir l'url exacte que tu tape pour acceder au service.

  18. #18
    Membre averti
    Inscrit en
    Décembre 2008
    Messages
    21
    Détails du profil
    Informations forums :
    Inscription : Décembre 2008
    Messages : 21
    Par défaut
    salut
    Enfin j'ai trouvé mon erreur, il faut faire un message SOAP correct pour appelé le service (ou un formulaire en méthode post permet d'accéder au service).
    alor paux -tu me dire comment t'as régler ce problème, car je me bloque sur ca et je n'arrive pas à m'en sortir

    merci

  19. #19
    Membre averti
    Inscrit en
    Décembre 2008
    Messages
    21
    Détails du profil
    Informations forums :
    Inscription : Décembre 2008
    Messages : 21
    Par défaut
    salut
    mon problème de introuvable [404] a été résolu
    maintenant je suis devant une autre exception
    21 mai 2009 14:16:52 com.sun.xml.internal.messaging.saaj.soap.MessageImpl identifyContentType
    GRAVE: SAAJ0537: Invalid Content-Type. Could be an error message instead of a SOAP message
    Exception in thread "main" org.springframework.ws.soap.SoapMessageCreationException: Could not create message from InputStream: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
    Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
    at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.identifyContentType(Unknown Source)
    at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.<init>(Unknown Source)
    at com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl.<init>(Unknown Source)
    at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.createMessage(Unknown Source)
    at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:163)
    at org.springframework.ws.transport.AbstractWebServiceConnection.receive(AbstractWebServiceConnection.java:53)
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:409)
    at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:358)
    at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:304)
    at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:289)
    at test.Test.main(Test.java:50)
    PS: mon service web fonctionne et ce problème apparait que lorsque j'utulise un client pour consommer ce service web


    voici ma class main
    package test;


    import java.io.StringReader;

    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.stream.StreamSource;
    import org.springframework.ws.client.core.WebServiceTemplate;


    public class Test {

    private static final String MSG ="<request>"+
    " <CINUSE>19031982</CINUSE>"+
    "<EMAILUS>a</EMAILUS>"+
    "<NOMUSE>a</NOMUSE>"+
    "<PRENOM>a</PRENOM>"+
    "<datnai>03/03/2003</datnai>"+
    "<PAYNAI>a</PAYNAI>"+
    "<SEXENP>a</SEXENP>"+
    "<AGEAPA>a</AGEAPA>"+
    "<NATENP>a</NATENP>"+
    "<QUALIT>a</QUALIT>"+
    "<PERMIS>a</PERMIS>"+
    "<TYPPER>a</TYPPER>"+
    "<PASSWD>a</PASSWD>"+
    "<CENINT>a</CENINT>"+
    "<DATDEP>03/03/2003</DATDEP>"+
    "<POSRES>a</POSRES>"+
    "<SITFAM>a</SITFAM>"+
    "<GOUVER>a</GOUVER>"+
    "</request>";




    public static void main (String[] args){

    final WebServiceTemplate webServiceTemplate = new WebServiceTemplate();

    // String resultStr = RESU.toString();
    StreamSource source = new StreamSource(new StringReader(MSG));

    StreamResult result = new StreamResult(System.out);


    System.out.println("the result is " +result);
    webServiceTemplate.sendSourceAndReceiveToResult("http://localhost:8080/spring-wsTest/insertionService/",source, result);

    }
    }



    //http:localhost:8080/spring-wsTest/spring-ws/InsertionService
    c claire que mon service insére dans une base de donnée

    merci d'avance

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [ADO] [MSACCESS] Problème d'accès à une table nommée OF
    Par FredRaid dans le forum Bases de données
    Réponses: 3
    Dernier message: 15/02/2005, 17h22
  2. Problème d'accès à une DB
    Par Mvu dans le forum ASP
    Réponses: 4
    Dernier message: 04/01/2005, 11h36
  3. [TOMCAT] JSP problème d'accès aux méthodes d'une classes
    Par gunnm dans le forum Tomcat et TomEE
    Réponses: 3
    Dernier message: 22/05/2004, 14h02
  4. problème d'acces concurentiel à un fichier
    Par Theoden dans le forum MFC
    Réponses: 2
    Dernier message: 04/03/2004, 09h49

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo