前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >使用axis2访问webservice(webserivice基于.net平台实现)

使用axis2访问webservice(webserivice基于.net平台实现)

作者头像
Jerremy
发布2022-05-09 14:59:11
3620
发布2022-05-09 14:59:11
举报
文章被收录于专栏:Puppeteer学习Puppeteer学习

webservice url=http://10.90.11.240:8081/ExceptionWebService.asmx?WSDL;

下载axis2组件,解压,进入bin目录,通过命令wsdl2java -uri http://10.90.11.240:8081/ExceptionWebService.asmx?WSDL -p com.zsp.proxy -s -o source

-uri 后面运行的是 你的wsdl地址, -p 是文件生成的包名 -o source生成的文件目录,在bin目录下。

把生成的代理类,拷贝到你的工程目录中,导入对应的包即可访问:

例如

代码语言:javascript
复制
POST /ExceptionWebService.asmx HTTP/1.1
Host: 10.90.11.240
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/ApproveException"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ApproveException xmlns="http://tempuri.org/">
      <eventName>string</eventName>
      <description>string</description>
      <occurTime>string</occurTime>
      <livingPlace>string</livingPlace>
      <eventLevel>一般 or 急件 or 紧急 or 特急</eventLevel>
      <bussinessCategory>运销 or 管道 or 设备 or HSE or 经营 or 管理 or 工程 or 科技 or 信息 or 党群 or 其它</bussinessCategory>
      <reporterId>string</reporterId>
      <contact>string</contact>
      <systemId>string</systemId>
      <businessPK>string</businessPK>
      <remark>string</remark>
      <isRelease>boolean</isRelease>
      <measures>string</measures>
    </ApproveException>
  </soap:Body>
</soap:Envelope>

访问时:

代码语言:javascript
复制
public class Test2 {

    public static void main(String[] args) throws RemoteException {
        // TODO Auto-generated method stub
        ExceptionServiceStub proxy = new ExceptionServiceStub();

        ExceptionServiceStub.ApproveException exp = new ExceptionServiceStub.ApproveException();
        exp.setContact("374378");
        exp.setDescription("描述");
        exp.setEventName("测试异常");
        exp.setIsRelease(true);
        exp.setLivingPlace("发生地点");
        exp.setMeasures("47477474");
        exp.setOccurTime("2019-09-09");
        exp.setSystemId("xj_001");
        exp.setRemark("备注");
        exp.setEventLevel(EmergencyDegree.一般);
        exp.setBussinessCategory(BusinessCategory.HSE);
        exp.setBusinessPK("bpk");
        exp.setReporterId("xxxx");
        ApproveExceptionResponse res = proxy.approveException(exp);
        System.out.println(res.getApproveExceptionResult());
    }

}

使用内部类的方式设置参数,很方便,这种方式和C#通过VS生成代理的操作方式基本一致。

客户端需要导入的包如下:

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2015-10-12,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档