加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何用纯文本方式(XML)+HTTP协议调用Workday的web service?

发布时间:2020-12-16 06:18:51 所属栏目:百科 来源:网络整理
导读:我们知道,Workday系统本身很复杂,其发布的web服务(web service)也很多,而且其中的Web 服务(web service)中定义的Schema也很复杂。如果用AXIS或者XFire生成存根代码调用其相应模块的web service,比如Human Resource模块,也可以,但是生成的存根代码

我们知道,Workday系统本身很复杂,其发布的web服务(web service)也很多,而且其中的Web 服务(web service)中定义的Schema也很复杂。如果用AXIS或者XFire生成存根代码调用其相应模块的web service,比如Human Resource模块,也可以,但是生成的存根代码比较复杂,而且Workday的web服务本身也在不断的升级过程中,在升级的过程中,其Schema的信息也在不断变化和调整过程中,那么有没有一种以不变应万变的方式,答案是肯定的。那就是通过,用纯文本方式(XML)+HTTP协议调用Workday的web service。下面咱们就以调用员工查找的操作方法为例子(Employee Find), 看其存文本的代码例子如何编写?其总共分成两部分:

(1) web service的权限认证

其中假设其用户名名为:test @test

密码为:xxxxxxx

则其消息头部分为:

< env:Header >
                < wsse:Security xmlns:soapenv = "http://schemas.xmlsoap.org/soap/envelope/"
                        xmlns:wsse = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                        soapenv:mustUnderstand = "1" >
                        < wsse:UsernameToken >
                                < wsse:Username >test @test </ wsse:Username >
                                < wsse:Password Type = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText" > Password:  xxxxxxx </ wsse:Password >
                        </ wsse:UsernameToken >
                </ wsse:Security >
        </ env:Header >
<? xml version = "1.0" encoding = "UTF-8" ?>
< env:Envelope xmlns:env = "http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd = "http://www.w3.org/2001/XMLSchema" >
    < env:Header >
        < wsse:Security
            xmlns:soapenv = "http://schemas.xmlsoap.org/soap/envelope/"
            xmlns:wsse = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
            soapenv:mustUnderstand = "1" >
            < wsse:UsernameToken >
                < wsse:Username > test @test </ wsse:Username >
                < wsse:Password
                    Type = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText" > xxxxxxx </ wsse:Password >
            </ wsse:UsernameToken >
        </ wsse:Security >
    </ env:Header >

(2)web service的消息体部分,调用Employee_Find操作
  < env:Body >
    < wd:Employee_Find xmlns:wd = "urn:com.workday/bsvc" wd:version = "v22.1" >
    </ wd:Employee_Find >
  </ env:Body >
(3)找任何一个HTTP第三方发送工具(或者自己写一个HTTP发送程序),把上面(1)和(2)的信息,作为HTTP的消息体,发送出去,即可得到查询结果。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读