Web Service client exists in the workspace. Written a unit test to call Web Service using client code. Below error is thrown.
RuleImporterProcess is an interface but the error ask to implement method in it. [junit] Caused by: com.link.exception.SystemException: [exception of type javax.xml.ws.WebServiceException occured. error message is org.apache.cxf.service.factory.ServiceConstructionException: Service class .model.rulehome.service.wsclient.RuleImporterProcess does not implement the process method. [junit] at com.link.model.rulehome.service.RuleHomeServiceCaller.getWSClientInstance(RuleHomeServiceCaller.java:65) [junit] at com.link.model.rulehome.service.RuleHomeServiceCaller.getPredictabilityCost(RuleHomeServiceCaller.java:120) [junit] at com.link.model.metricsanalyzer.service.PredictabilityMetricsService.<clinit>(PredictabilityMetricsService.java:53) [junit] ... 28 more [junit] Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Service class com.link.model.rulehome.service.wsclient.RuleImporterProcess does not implement the process method. [junit] at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:334) [junit] at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:319) [junit] at javax.xml.ws.Service.getPort(Service.java:92) [junit] at com.link.model.rulehome.service.wsclient.client_ep.getRuleImporterProcess_pt(client_ep.java:80) [junit] at com.link.model.rulehome.service.RuleHomeServiceCaller.getWSClientInstance(RuleHomeServiceCaller.java:62) [junit] ... 30 more [junit] Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Service class com.link.model.rulehome.service.wsclient.RuleImporterProcess does not implement the process method. [junit] at org.apache.cxf.jaxws.JAXWSMethodDispatcher.bind(JAXWSMethodDispatcher.java:68) [junit] at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.bindOperation(JaxWsServiceFactoryBean.java:280) [junit] at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperation(JaxWsServiceFactoryBean.java:254) [junit] at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:652) [junit] at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperations(JaxWsServiceFactoryBean.java:289) [junit] at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:393) [junit] at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:506) [junit] at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:242) [junit] at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202) [junit] at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101) [junit] at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90) [junit] at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:155) [junit] at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:153) [junit] at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:465) [junit] at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:332) [junit] ... 34 more [junit] Caused by: java.lang.NoSuchMethodException: com.link.model.rulehome.service.wsclient.RuleImporterProcess.process(com.link.model.rulehome.service.wsclient.Process) [junit] at java.lang.Class.getMethod(Class.java:1605) [junit] at org.apache.cxf.jaxws.JAXWSMethodDispatcher.getImplementationMethod(JAXWSMethodDispatcher.java:88) [junit] at org.apache.cxf.jaxws.JAXWSMethodDispatcher.bind(JAXWSMethodDispatcher.java:55) [junit] ... 48 more Unit test Code is: package com.link.rulehome.service; import com.link.model.rulehome.service.wsclient.RuleImporterProcess; import com.link.model.rulehome.service.wsclient.Process; import com.link.model.rulehome.service.wsclient.RuleTemplate; import com.link.model.rulehome.service.wsclient.RulesResponseType; import java.net.URL; import java.util.Iterator; import java.util.List; import java.util.Properties; import javax.ejb.embeddable.EJBContainer; import javax.naming.Context; import javax.naming.InitialContext; import javax.xml.ws.Service; import javax.xml.namespace.QName; import junit.framework.TestCase; public class RuleImporterServiceTest extends TestCase { private InitialContext initialContext; protected void setUp() throws Exception { Properties properties = new Properties(); properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); properties.setProperty("openejb.embedded.remotable", "true"); EJBContainer.createEJBContainer(properties); } /** * Create a webservice client using wsdl url * * @throws Exception */ public void testCalculatorViaWsInterface() throws Exception { URL url = new URL("http://localhost:8001/SOA/RuleImporterService/client_ep?WSDL"); QName calcServiceQName = new QName("http://xmlns.oracle.com/RuleImporterService/RuleImporterProcess", "client_ep"); Service service = Service.create(url, calcServiceQName); assertNotNull(service); Iterator<QName> ite = service.getPorts();// .createCall(port); while(ite.hasNext()) { QName qn = ite.next(); System.out.println("WS QName : " + qn.getNamespaceURI()); } final RuleImporterProcess rp = service.getPort(RuleImporterProcess.class); Process payload = new Process(); payload.setRuleName("Commodity Line Assignment"); RulesResponseType res = rp.process(payload); RulesResponseType.Rules rule = res.getRules(); List<RuleTemplate> listRule = rule.getRule(); for (RuleTemplate rt : listRule) { System.out.println("Rule Name # " + rt.getRuleName()); } } } -- View this message in context: http://openejb.979440.n4.nabble.com/ServiceConstructionException-Web-Service-unit-testing-is-not-working-in-OpenEJB-4-0-tp4659899.html Sent from the OpenEJB Dev mailing list archive at Nabble.com.