zoukankan      html  css  js  c++  java
  • 在maven项目中 配置代理对象远程调用crm

    1 maven项目中配置代理对象远程调用crm

    1.1 在项目的pom.xml中引入CXF的依赖

    <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-frontend-jaxws</artifactId>
                <version>3.0.1</version>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-transports-http</artifactId>
                <version>3.0.1</version>
            </dependency>

    1.2 使用wsimport命令解析wsdl文件生成本地代码,只需要接口文件和实体类

    命令为:wsimport -s . -p com.javaweb.crm http://ip:port/service/service?wsdl

    其中-p表示命名一个文件包名

    1.3 在spring配置文件中注册crm客户端代理对象

    需要导入约束:

    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xmlns:jaxws="http://cxf.apache.org/jaxws"
        xmlns:soap="http://cxf.apache.org/bindings/soap"
        xsi:schemaLocation="http://www.springframework.org/schema/beans 
                            http://www.springframework.org/schema/beans/spring-beans.xsd
                            http://www.springframework.org/schema/context
                            http://www.springframework.org/schema/context/spring-context.xsd
                            http://www.springframework.org/schema/aop
                            http://www.springframework.org/schema/aop/spring-aop.xsd
                            http://www.springframework.org/schema/tx 
                            http://www.springframework.org/schema/tx/spring-tx.xsd
                            http://cxf.apache.org/bindings/soap 
                            http://cxf.apache.org/schemas/configuration/soap.xsd
                            http://cxf.apache.org/jaxws 
                            http://cxf.apache.org/schemas/jaxws.xsd">
    <!-- 注册crm客户端代理对象 -->
        <jaxws:client id="crmClient" serviceClass="com.javaweb.crm.ICustomerService" address="http://ip:prot/crm_javaweb/service/service" />

    1.4 通过注解方式将代理对象注入action

  • 相关阅读:
    JSON.parse()和JSON.stringify()(转载)
    Bootstrap 栅格系统(转载)
    基于Java的WebSocket推送【转载】
    VirtualBox中的虚拟机要如何设置,才能够上网
    String类和StringBuffer类的区别
    split命令参数及用法详解
    linux du小练习
    内部类(innerclasses)、匿名对象
    构造器、方法的重载、方法的重写
    继承、封装、多态、抽象、接口
  • 原文地址:https://www.cnblogs.com/FanJava/p/9288403.html
Copyright © 2011-2022 走看看