WebService CSF使用详解

    建立service:  

       1CxfService

@WebService

public interface CxfService {

    @WebMethod 

    public @WebResult List<TaskBean> getTasksByActor(

@WebParam(name="actor") String actor);

@WebMethod 

public void createAndStartProcessInstance(

@WebParam(name="processName") String processName,

@WebParam @XmlJavaTypeAdapter(MapAdapter.class)  Map<String,String> variables);

}

       2CxfServiceImpl                      

@WebService(endpointInterface = "com.CxfService")

public class CxfServiceImpl implements CxfService {

@Override

public void completeTask(String taskId) {

    JbpmHelper.taskService.completeTask(taskId);

}

    @Override

    public void createAndStartProcessInstance(String processName,

           Map<String, String> variables) {

       if(variables == null){

           JbpmHelper.executionService.startProcessInstanceByKey(processName);

       }else{

JbpmHelper.executionService.startProcessInstanceByKey(processName, variables);

       }

    }

}

 

web.xml:

    <context-param> 

        <param-name>contextConfigLocation</param-name>

        <param-value>

          classpath:/applicationContext.xml

        </param-value>

    </context-param>

<listener>

<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

    </listener>

    <servlet>

       <servlet-name>CXFServlet</servlet-name>

       <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>

       <load-on-startup>1</load-on-startup>

    </servlet>

    <servlet-mapping>

       <servlet-name>CXFServlet</servlet-name>

       <url-pattern>/service/*</url-pattern>

    </servlet-mapping>

    <filter>

spring的配置文件:applicationContext.xml

<beans

    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">

 

    <import resource="classpath*:META-INF/cxf/cxf.xml"/>

    <import resource="classpath*:META-INF/cxf/cxf-extension-soap.xml"/>

    <import resource="classpath*:META-INF/cxf/cxf-servlet.xml"/>

    <!-- 以下两种方式均可 -->

    <jaxws:endpoint id="cxfService" address="/CxfService"

       implementor="com.CxfServiceImpl"/>

<jaxws:server id="cxfService1" serviceClass="com.CxfService"

    address="/CxfService ">

        <jaxws:serviceBean> 

            <bean class="com.CxfServiceImpl"/> 

        </jaxws:serviceBean> 

    </jaxws:server> 

</beans>

    客户端调用:                                                                     

    JaxWsProxyFactoryBean jwfb = new JaxWsProxyFactoryBean();

    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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值