赞
踩
- CREATE OR REPLACE PACKAGE cux_wz_connect_pkg AS
- /* $Header: $ */
- /*#
- * cux wz interface Use to test Connection
- * @rep:scope public
- * @rep:product cux
- * @rep:lifecycle active
- * @rep:displayname CUX WZ Soa Connect Interface
- * @rep:compatibility S
- * @rep:category BUSINESS_ENTITY CUX_SERVICE
- */
- /*#
- * Get Connection flag
- * @param p_value Post value
- * @param x_flag Respons
- * @rep:scope public
- * @rep:lifecycle active
- * @rep:displayname Get Connection flag
- * @rep:compatibility S
- */
- PROCEDURE get_connect_flag(p_value IN VARCHAR2, x_flag OUT VARCHAR2);
- END cux_wz_connect_pkg;
以上注释中的内容分别对应:
* @rep:category BUSINESS_ENTITY CUX_SERVICE
此处可以在公用块码中搜索lookup_type“BUSINESS_ENTITY”,将对应的信息维护进去,此处就会显示为自定义的meaning
cux wz interface Use to test Connection :
编译保存后,cux_wz_connect_pkg.spc另存为后缀名为pls的文件,或直接修改保存文件的后缀名为pls:cux_wz_connect_pkg.pls
- CREATE OR REPLACE PACKAGE BODY cux_wz_connect_pkg IS
- /*==================================================
- Copyright (C) Hand Enterprise Solutions Co.,Ltd.
- AllRights Reserved
- ==================================================*/
- /*==================================================
- Program Name:
- cux_wz_connect_pkg
- Description:
- 与分宜智能电厂WebService接口之心跳接口,此接口用来测试分宜智能电厂一体化平台的接口与EBS是否连通
- History:
- 1.00 2020-06-19 hao.feng Creation
- ==================================================*/
- /*==================================================
- Procedure/Function Name :
- get_connect_flag
- Description:
- 心跳接口主程序
- Argument:
- p_value :分宜智能电厂一体化平台传递值
- x_flag :将p_value返回去
- Return:
-
- History:
- 1.00 2020-06-19 hao.feng Creation
- ==================================================*/
- PROCEDURE get_connect_flag(p_value IN VARCHAR2, x_flag OUT VARCHAR2) IS
-
- BEGIN
- x_flag := p_value;
- EXCEPTION
- WHEN OTHERS THEN
- x_flag := NULL;
- END get_connect_flag;
- END cux_wz_connect_pkg;
编译保存后,cux_wz_connect_pkg.bdy另存为后缀名为plb的文件,或直接修改保存文件的后缀名为pls:cux_wz_connect_pkg.plb
先 cd $CUX_TOP/patch/115/sql
a.把文件.PLS文件上传到服务器,路径为:$CUX_TOP/patch/115/sql下。
b.使用工具登录应用服务器
c.执行以下命令生成.ildt文件.生成成功后检查是否有生成ildt文件。
$IAS_ORACLE_HOME/perl/bin/perl $FND_TOP/bin/irep_parser.pl -g -v -username=sysadmin cux:patch/115/sql:cux_wz_connect_pkg.pls:12.0.0=cux_wz_connect_pkg.pls
d.执行以下命令上传生成的.ildt文件。
FNDLOAD apps/appspassword 0 Y UPLOAD $FND_TOP/patch/115/import/wfirep.lct cux_wz_connect_pkg_pls.ildt
点击生成WSDL,然后选择身份验证类型(此处具体看情况选择,一般选择用户名变量)再点击部署。如下图,这样web service 接口我们就部署完毕。
创建授权,点击创建授权把接口授权给需要使用接口的用户ASADMIN
如上例,WSDL是:
http://xxx.xxx.cn:xxxx/webservices/SOAProvider/plsql/cux_wz_connect_pkg/?wsdl
将后面的"?wsdl"去掉,保留"/",重新打开:
http://xxx.xxx.cn:xxxx/webservices/SOAProvider/plsql/cux_wz_connect_pkg/
显示网页:
勾选WS-Security后面的Include In Header,编写信息如下:
点击XML源:
对于<ns1:SOAHeader>中的头4个子标签的信息:
Responsibility:
RespApplication:
后面两个写死即可<ns1:SecurityGroup>STANDARD</ns1:SecurityGroup>
<ns1:NLSLanguage>AMERICAN</ns1:NLSLanguage>
将以上内容copy出来就可以测试了
不管是是用SOAPUI测试或者是用上面打开的网页测试,或者用PLSQL测试都可以
- <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
- <soap:Header xmlns:ns1="http://xmlns.oracle.com/apps/cux/soaprovider/plsql/cux_wz_connect_pkg/">
- <ns1:SOAHeader>
- <ns1:Responsibility>SYSTEM_ADMINISTRATOR</ns1:Responsibility>
- <ns1:RespApplication>SYSADMIN</ns1:RespApplication>
- <ns1:SecurityGroup>STANDARD</ns1:SecurityGroup>
- <ns1:NLSLanguage>AMERICAN</ns1:NLSLanguage>
- <ns1:Org_Id>100</ns1:Org_Id>
- </ns1:SOAHeader>
- <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" soap:mustUnderstand="1"><wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:Username>Username</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">Password</wsse:Password></wsse:UsernameToken></wsse:Security></soap:Header>
- <soap:Body xmlns:ns2="http://xmlns.oracle.com/apps/cux/soaprovider/plsql/cux_wz_connect_pkg/get_connect_flag/">
- <ns2:InputParameters>
- <ns2:P_VALUE>test-connect</ns2:P_VALUE>
- </ns2:InputParameters>
- </soap:Body>
- </soap:Envelope>
PLSQL测试脚本:
- DECLARE
- p_wsdl_url VARCHAR2(100) := 'http://xxx.xxx.cn:xxxx/webservices/SOAProvider/plsql/cux_wz_connect_pkg/?wsdl';
- p_http_request CLOB;
- p_http_response CLOB;
- x_return_status VARCHAR2(100);
- x_return_message VARCHAR2(2000);
- http_req utl_http.req;
- http_resp utl_http.resp;
- l_pos NUMBER := 1;
- l_leng NUMBER := 0;
- TYPE rec_req IS RECORD(
- p_req VARCHAR2(4000));
- TYPE rec_req_array IS TABLE OF rec_req INDEX BY BINARY_INTEGER;
- l_res_line VARCHAR2(32767);
- l_req_array rec_req_array;
- l_end_flag VARCHAR2(1);
- BEGIN
- p_http_request := '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">'||
- '<soap:Header xmlns:ns1="http://xmlns.oracle.com/apps/cux/soaprovider/plsql/cux_wz_connect_pkg/">
- <ns1:SOAHeader>
- <ns1:Responsibility>SYSTEM_ADMINISTRATOR</ns1:Responsibility>
- <ns1:RespApplication>SYSADMIN</ns1:RespApplication>
- <ns1:SecurityGroup>STANDARD</ns1:SecurityGroup>
- <ns1:NLSLanguage>AMERICAN</ns1:NLSLanguage>
- <ns1:Org_Id>101</ns1:Org_Id>
- </ns1:SOAHeader>
- <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" soap:mustUnderstand="1"><wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:Username>Username</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">Password</wsse:Password></wsse:UsernameToken></wsse:Security></soap:Header>
- <soap:Body xmlns:ns2="http://xmlns.oracle.com/apps/cux/soaprovider/plsql/cux_wz_connect_pkg/get_connect_flag/">
- <ns2:InputParameters>
- <ns2:P_VALUE>test-connect</ns2:P_VALUE>
- </ns2:InputParameters>
- </soap:Body>
- </soap:Envelope>';--请求报文
- --初始化返回状态
- x_return_status := fnd_api.g_ret_sts_success;
- --取请求clob长度
- FOR i IN 1 .. ceil(dbms_lob.getlength(p_http_request) / 2400) LOOP
- l_req_array(i).p_req := dbms_lob.substr(p_http_request, 2400, l_pos);
-
- l_pos := l_pos + 2400;
- l_leng := l_leng + lengthb(l_req_array(i).p_req);
- END LOOP;
- --开始请求
- http_req := utl_http.begin_request(p_wsdl_url, 'POST', 'HTTP/1.1');
- --中文
- utl_http.set_header(http_req, 'Content-Type', 'text/xml; charset=utf-8');
- --请求xml长度
- utl_http.set_header(http_req, 'Content-Length', l_leng);
- utl_http.set_header(http_req, 'SOAPAction', '');
- FOR i IN 1 .. ceil(dbms_lob.getlength(p_http_request) / 2400) LOOP
- utl_http.write_text(http_req, l_req_array(i).p_req);
- END LOOP;
- --请求响应结果
- http_resp := utl_http.get_response(http_req);
- --返回状态
- dbms_output.put_line('http_resp.status_code:' || to_char(http_resp.status_code));
- IF nvl(http_resp.status_code, -1) <> 200 THEN
- x_return_status := fnd_api.g_ret_sts_error;
- END IF;
- dbms_lob.createtemporary(p_http_response, FALSE);
- BEGIN
- LOOP
- l_res_line := NULL;
- utl_http.read_text(http_resp, l_res_line, 800);
- --如果响应状态为失败,那么将响应数据输出
- IF x_return_status = fnd_api.g_ret_sts_error THEN
- dbms_output.put_line(l_res_line);
- END IF;
- dbms_lob.writeappend(p_http_response, length(l_res_line), l_res_line);
- END LOOP;
- EXCEPTION
- WHEN utl_http.end_of_body THEN
- l_end_flag := 'Y';
- utl_http.end_response(http_resp);
- END;
- dbms_output.put_line(p_http_response);--打印返回报文
- --结束响应
- IF nvl(l_end_flag, 'N') <> 'Y' THEN
- utl_http.end_response(http_resp);
- END IF;
- EXCEPTION
- WHEN OTHERS THEN
- x_return_status := fnd_api.g_ret_sts_error;
- x_return_message := 'http dbws error:' || SQLERRM;
- dbms_output.put_line(x_return_message);
- END;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。