No adapter for endpoint sprnig ws
Bonjour je travaille sur spring ws et j'ai le problème suivant:
Code:
1 2 3 4 5 6 7 8 9
| <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring xml:lang="en">No adapter for endpoint [com.hr.service.StubSupressionService@ded0f0]: Does your endpoint implement a supported interface like MessageHandler or PayloadEndpoint?</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope> |
voici mo .xsd
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:supression="http://com.hr.ws/schema/supression"
targetNamespace="http://com.hr.ws/schema/supression" elementFormDefault="qualified">
<xs:element name="SupressionUserRequest" type="supression:SupressionUserRequestType"/>
<xs:element name="SupressionUserResponse" type="supression:SupressionUserResponseType"/>
<xs:complexType name="SupressionUserRequestType">
<xs:sequence>
<xs:element name="CIN" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupressionUserResponseType">
<xs:sequence>
<xs:element name="auteur" type="xs:string"/>
<xs:element name="texte" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema> |
mon servlet.xml
Code:
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
| <?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="insertionEndpoint" class="com.hr.ws.InsertionEndpoint">
<constructor-arg ref="hrService"/>
</bean>
<bean id="hrService" class="com.hr.service.StubinsertionService"/>
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
<property name="mappings">
<props>
<prop key="{http://com.hr.ws/schema/insertion}InsertionRequest">insertionEndpoint</prop>
</props>
</property>
<property name="interceptors">
<list>
<bean
class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"></bean>
</list>
</property>
</bean>-->
<bean id="supressionEndpoint" class="com.hr.service.StubSupressionService"/>
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
<property name="mappings">
<props>
<prop key="{http://com.hr.ws/schema/supression}SupressionUserRequest">supressionEndpoint</prop>
</props>
</property>
<property name="interceptors">
<list>
<bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"></bean>
</list>
</property>
</bean>
<bean id="supression" class="org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition">
<property name="builder">
<bean class="org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder">
<property name="schema" value="/WEB-INF/supression.xsd"/>
<property name="portTypeName" value="Supression"/>
<property name="locationUri" value="http://localhost:8080/spring-wsTest/supressionService/"/>
</bean>
</property>
</bean>
</beans> |
mon endpoint :
Code:
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
| package com.hr.ws;
import org.jdom.Element;
import org.jdom.Namespace;
import org.jdom.xpath.XPath;
import org.springframework.ws.server.endpoint.AbstractJDomPayloadEndpoint;
import com.hr.service.SupressionService;
public class SupressionEndpoint extends AbstractJDomPayloadEndpoint{
SupressionService supressionService;
public SupressionEndpoint(SupressionService supressionService){
this.supressionService = supressionService;
}
protected Element invokeInternal(Element request) throws Exception {
Namespace namespace = Namespace.getNamespace("supression", "http://com.hr.ws/schema/supression");
// Création des requête XPath pour récupérer les informations
XPath CINExpression=XPath.newInstance("//supression:SupressionRequest/supression:CIN");
CINExpression.addNamespace(namespace);
// Récupération des informations à partir de la requête
String CIN = CINExpression.valueOf(request);
// Appel au service pour la traduction
String[] res = supressionService.supprimerUser(CIN);
// Création de la réponse*/
Element root = new Element("SupressionResponse", namespace);
Element auteur = new Element("auteur", namespace);
auteur.setText(res[0]);
Element texteTraduit = new Element("texte", namespace);
texteTraduit.setText(res[1]);
root.addContent(auteur);
root.addContent(texteTraduit);
supressionService.supprimerUser(CIN);
return root; |
et mon StubSupressionService
Code:
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
| package com.hr.service;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class StubSupressionService implements SupressionService {
private static final Log logger = LogFactory.getLog(StubSupressionService.class);
public String[] supprimerUser(String CINUSE){
String s[]= new String[2];
ConnectionDriver conn=new ConnectionDriver();
String P = null;
P ="DELETE FROM tablename WHERE CINUSE = 'CINUSE'";
conn.executeQuery(P);
s[0]= new String("AAAA");
s[1]= new String("CCCC");
return s;
}
} |
Merci!