【开发问题】java访问webservice接口,查看wsdl文件并且填写相关参数

怎么查看webservice的wsdl文件

webservice的url接口

http://10.127.4.xxxx:9001/Data.asmx

那么就在原有的url基础上加上?wsdl

http://10.127.4.xxxx:9001/Data.asmx?wsdl

在这里插入图片描述

为什么要查看wsdl文件

因为代码里面的参数内容就需要配合wsdl文件的里面的参数来填写

从wsdl文件里面我们能获取哪几个参数呢

nameSpaceUri 空间url

在这里插入图片描述

method 方法名称

在这里插入图片描述

SoapActionUri

在这里插入图片描述

代码

/**
     * @param webServiceURL  http://10.127.4.xxxx:9001/Data.asmx
     * @param nameSpaceUri http://sinopec.bts.gzsh/
     * @param jsonData jsonData
     * @param method GetData
     * @param soapActionUri http://sinopec.bts.gzsh/GetData
     * @return
     * @throws ServiceException
     * @throws MalformedURLException
     * @throws RemoteException
     */
    public String getwebservice(String webServiceURL,String nameSpaceUri,String jsonData,String method,String soapActionUri) throws ServiceException, MalformedURLException, RemoteException {
        String result= null;
        Service service = new Service();
        Call call = (Call)service.createCall();
        call.setTargetEndpointAddress(new URL(webServiceURL));
        call.setUseSOAPAction(true);
        call.setSOAPActionURI(soapActionUri);
        call.setOperationName(new QName(nameSpaceUri, method));
        call.addParameter("jsonData", XMLType.XSD_STRING, ParameterMode.IN);
        call.setReturnType(XMLType.XSD_STRING);
        result = call.invoke(new Object[] { jsonData}).toString();
        return result;
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值