从PL/SQL调用web services实例

本文介绍了如何使用Oracle数据库的UTL_HTTP包调用Web Services,内容基于Oracle 11gr2,通过两种不同的调用方式进行演示。示例中,Web Services服务器端使用axis2(v1.5.4)简单实现。
摘要由CSDN通过智能技术生成

web services是目前比较流行的系统之间信息交互的一种方式,近段研究了下通过Oracle数据库utl_http包调用web services,以下为例子,基于Oracle 11gr2测试。

此两种方式基本相似,只是在写法、调用上有些出入。涉及的web services服务器端代码较简单,采用axis2(v1.5.4)实现,可直接利用axis官方提供的例子。

附:web services源码

方式一:

  procedure testWebServices is
    soap_request varchar2(30000);
    soap_respond varchar2(30000);
    http_req     utl_http.req;
    http_resp    utl_http.resp;
    l_ws_url varchar2(1000);
    l_ws_function varchar2(100);
    l_ws_soapaction varchar2(100);
  begin
    --不传递参数
    soap_request := '<?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://ws.apache.org/axis2">
    <soap:Body>
    </soap:Body>
    </soap:Envelope>';
    l_ws_url := 'http://IP:port/axis2/services/Version/';
    l_ws_soapaction := 'urn:getVersion';
    --传递参数
    soap_request := '<?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值