一建立service:
1)CxfService:
@WebService
publicinterfaceCxfService {
@WebMethod
public@WebResultList getTasksByActor(
@WebParam(name="actor") String actor);
@WebMethod
publicvoidcreateAndStartProcessInstance(
@WebParam(name="processName") String processName,
@WebParam@XmlJavaTypeAdapter(MapAdapter.class) Map variables);
}
2)CxfServiceImpl:
@WebService(endpointInterface ="com.CxfService")
publicclassCxfServiceImplimplementsCxfService {
@Override
publicvoidcompleteTask(String taskId) {
JbpmHelper.taskService.completeTask(taskId);
}
@Override
publicvoidcreateAndStartProcessInstance(String processName,
Map variables) {
if(variables ==null){
JbpmHelper.executionService.startProcessInstanceByKey(processName);
}else{
JbpmHelper.executionService.startProcessInstanceByKey(processName, variables);
}
}
}
二web.xml:
contextConfigLocation
classpath:/applicationContext.xml
org.springframework.web.context.ContextLoaderListener
CXFServlet
org.apache.cxf.transport.servlet.CXFServlet
1
CXFServlet
/service/*
三spring的配置文件:applicationContext.xml
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
default-autowire="byName"
default-lazy-init="true">
implementor="com.CxfServiceImpl"/>
address="/CxfService ">
四客户端调用:
JaxWsProxyFactoryBean jwfb =newJaxWsProxyFactoryBean();
jwfb.setServiceClass(CxfService.class);
jwfb.setAddress("http://132.94.135.15:8080/service/CxfService");
CxfService client = (CxfService) jwfb.create();
调用方法:
client.createAndStartProcessInstance("question",varMap);
List list =client.getTasksByActor("custom");
-------------------------------------------------------------------
JDK:jdk1.6.0_13(jdk1.6.0_4版本以下可能用)
Jar包:(不十分准确,可能有些包并不需要)
commons-dbcp-1.2.2.jar
commons-logging-1.1.1.jar
commons-pool-1.5.4.jar
cxf-2.2.6.jar
geronimo-activation_1.1_spec-1.0.2.jar
geronimo-annotation_1.0_spec-1.1.1.jar
geronimo-javamail_1.4_spec-1.6.jar
geronimo-ws-metadata_2.0_spec-1.1.2.jar
ibatis-2.3.4.726.jar(不需要)
jaxb-api-2.1.jar
jaxb-impl-2.1.13.jar
jaxws-api.jar
log4j-1.2.15.jar
neethi-2.0.4.jar
ojdbc14.jar
spring.jar
spring-beans-2.5.6.jar
spring-context-2.5.6.jar
spring-core-2.5.6.jar
spring-web-2.5.6.jar
stax-api-1.0.1.jar
wsdl4j-1.6.2.jar
wstx-asl-3.2.0.jar
xercesImpl.jar
xercesSamples.jar
xml-apis.jar
xmlParserAPIs.jar
xml-resolver-1.2.jar
XmlSchema-1.4.5.jar