Oracle调用WebService utl_http.write参数包含中文调用异常

T0virus 2016-01-12 05:07:52
req_msg := N'<?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>
<ManualSend_07 xmlns="http://tempuri.org/">
<strMailCode>' || c_MailCode || '</strMailCode>
<strRecipients>' || c_MailTo || '</strRecipients>
<strCopyRecipients>' || c_CC || '</strCopyRecipients>
<strSubject>' || c_Subject || '</strSubject>
<strBody>' || c_Content || '</strBody>
</ManualSend_07>
</soap:Body>
</soap:Envelope>';

--2、设定要发送的服务地址
http_req := utl_http.begin_request(URL, 'POST', 'HTTP/1.1');

--3、设定要发送的服务地址
utl_http.set_header(http_req, 'Content-Type', 'text/xml; charset=utf-8');
utl_http.set_header(http_req, 'Content-Length', length(req_msg));
utl_http.set_header(http_req, 'SOAPAction', 'http://tempuri.org/ManualSend_07');

--4、放入要传送之字符串格式
utl_http.write_text(http_req, req_msg);

--5、接收Web Service回传之讯息
http_resp := utl_http.get_response(http_req);

--6、完成设定后,就可以透过Oracle内的Http_Req发送了
utl_http.read_text(http_resp, resp_msg);
utl_http.end_response(http_resp);



当参数c_Content为纯英文时,程序执行到utl_http.write_text(http_req, req_msg);会发出邮件
当参数c_Content包含中文时,程序执行到utl_http.write_text(http_req, req_msg);不会发出邮件

请大神指教是哪里的问题?
...全文
2003 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
虹波 2018-04-19
  • 打赏
  • 举报
回复
Content-Length要求说明字节长度,所以要用 utl_http.set_header(http_req, 'Content-Length', lengthb(req_msg));
zhaoxiaojunch 2016-08-22
  • 打赏
  • 举报
回复
关注!我也遇到这个问题,不知怎么处理。
yy2651611 2016-07-11
  • 打赏
  • 举报
回复
我也遇到了这个问题 你最后是怎么解决中文发送失败的问题的?

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧