暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle 从SoapUI获得的响应,但不能通过使用UTL_HTTP的PLSQL获得

askTom 2017-07-21
495

问题描述

嗨,

需要你的建议和帮助。

Problem Description
我们需要调用web服务以在税务机关网站上上传数据。

我们已经提供了一个WSDL url,其中包含有关我们需要调用的web服务的数据。我们已经在SoapUI工具中上传了WSDL,并且在将请求提交到特定的端点URL并在编辑器中提供XML字符串时,我们将获得预期的响应。

但是,当使用UTL_HTTP从PLSQL尝试相同的响应时,我们没有收到任何响应 (空响应)。

为了使用UTL_HTTP.set_header设置标头属性,我们指的是SoapUI编辑器中的Raw选项卡和可用的WSDL。以下是我们目前在PLSQL代码中执行此操作的方式。

PLSQL
 
UTL_HTTP.SET_WALLET('*******************************************************',
                      'password');
 
l_http_request := UTL_HTTP.begin_request(url => 'https://www.url.xx/wlpl/XXII-PQRS/mn/sh/XxiPqrsVEF1SOAP',
                                                                       method => 'POST',
                                                                       http_version => 'HTTP/1.1');
 
--   UTL_HTTP.SET_HEADER(l_http_request, 'Accept-Encoding', 'gzip,deflate');
 
UTL_HTTP.set_header(l_http_request, 'Content-Type', 'text/xml;charset=UTF-8');
 
UTL_HTTP.set_header(l_http_request, 'SOAPAction', '""');
 
UTL_HTTP.set_header(l_http_request, 'Content-Length', LENGTH(l_string_request));
 
UTL_HTTP.SET_HEADER(l_http_request, 'Host', 'www.url.xx');
 
UTL_HTTP.set_header(l_http_request, 'Connection', 'Keep-Alive');
 
UTL_HTTP.set_header(l_http_request, 'User-Agent', 'Apache-HttpClient/4.1.1 (java 1.5)');
复制


SoapUI Raw Tab
邮政https://www.url.xx/wlpl/XXII-PQRS/mn/sh/XxiPqrsVEF1SOAPHTTP/1.1
接受编码: gzip,放气
内容类型: 文本/xml; 字符集 = UTF-8
肥皂: “”
内容-长度: 7841
主持人: www.url.xx
连接: 保持活力
用户代理: Apache-HttpClient/4.1.1 (java 1.5)


请注意,SOAPAction标头没有任何值 (单引号内只有双引号),因为在SoapUI工具的RAW选项卡以及WSDL内容中也是如此。下面还提供了WSDL文件中有关带有肥皂的零件的摘录,供您参考。

WSDL




















你能帮我吗?

谢谢和问候,
德巴姆丽塔

专家解答

我只看到你设置标题。

你实际上没有发布任何东西?

您需要编写数据 (然后寻找响应)-下面的一些示例代码

declare
  l_request utl_http.req;
  l_response utl_http.resp;
  l_target varchar2(4000) := 'http://myurl.com';
  l_data varchar2(4000); 
  l_post_data varchar2(4000) := 'mydata';
 
begin
  l_request := utl_http.begin_request(l_target, 'POST',' HTTP/1.1');
  utl_http.set_header(l_request, 'user-agent', 'mozilla/4.0'); 
  utl_http.set_header(l_request, 'content-type', 'application/json'); 
  utl_http.set_header(l_request, 'Content-Length', length(content));
  
 
  -- do the post
  utl_http.write_text(l_request, l_post_data);
  l_response := utl_http.get_response(l_request);

  -- get the response back
  begin
    loop
      utl_http.read_line(l_response, l_data);
      dbms_output.put_line(l_data);
    end loop;
    utl_http.end_response(l_response);
  exception
    when utl_http.end_of_body 
    then
      utl_http.end_response(l_response);
  end;
end;


复制


「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论