Hi all,
i'm working on spring ws and i had this error
Code:No adapter for endpoint [com.hr.service.StubSupressionService@95da38]: Does your endpoint implement a supported interface like MessageHandler or PayloadEndpoint?
my servlet.xml
Code:<?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>
my xsd is :
my endpoint :Code:<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>
& the StubSupression ServiceCode: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; } }
Thanks for Help !!Code: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 ER00,ER0G,ER0H,ER11,ERDI WHERE CINUSE = 'CINUSE'"; conn.executeQuery(P); s[0]= new String("AAAA"); s[1]= new String("CCCC"); return s; } }


Reply With Quote