数据对接集合 java调用webservice接口

  1. java调用webservice接口
  <dependency>
            <groupId>org.apache.axis</groupId>
            <artifactId>axis</artifactId>
            <version>1.4</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/javax.xml.rpc/javax.xml.rpc-api -->
        <dependency>
            <groupId>javax.xml.rpc</groupId>
            <artifactId>javax.xml.rpc-api</artifactId>
            <version>1.1.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/commons-discovery/commons-discovery -->
        <dependency>
            <groupId>commons-discovery</groupId>
            <artifactId>commons-discovery</artifactId>
            <version>0.2</version>
        </dependency>
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

   @Test
    public void a13a() throws MalformedURLException, ServiceException, RemoteException {
        Call call=(Call)(new Service()).createCall();
        call.setTargetEndpointAddress(new URL("http://218.26.234.115:12666/services/interface?"));
        call.setOperationName(new QName("namespace","getSydwJson"));
        call.setTimeout(30000);
        String re=(String)call.invoke(new String[]{"drorg032"});
        System.out.println(re);

    }

java.lang.NoClassDefFoundError: org/apache/commons/discovery/tools/DiscoverSingleton
webService 报aultString: org.xml.sax.SAXException: Bad envelope tag: definitions

  1. http请求头加Authorization的Bearer Token
    Httpclient 请求带Authorization(授权)的REST API 返回JSON数据
在这里插入代码片
        <groupId>org.apache.axis2</groupId>

        <artifactId>axis2</artifactId>

        <version>1.7.4</version>

        <type>pom</type>

        <scope>compile</scope>

    </dependency>

    <dependency>

        <groupId>org.apache.axis2</groupId>

        <artifactId>axis2-adb</artifactId>

        <version>1.7.4</version>

        <type>jar</type>

        <scope>compile</scope>

    </dependency>

    <dependency>

        <groupId>org.apache.axis2</groupId>

        <artifactId>axis2-kernel</artifactId>

        <version>1.7.4</version>

        <type>jar</type>

        <scope>compile</scope>

    </dependency>

    <dependency>

        <groupId>org.apache.axis2</groupId>

        <artifactId>axis2-transport-http</artifactId>

        <version>1.7.4</version>

    </dependency>

    <dependency>

        <groupId>org.apache.axis2</groupId>

        <artifactId>axis2-transport-local</artifactId>

        <version>1.7.4</version>

    </dependency>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值