如何在SOAPUI的http日志中处理UTF-8字符编码 [英] How to handle UTF-8 character encoding in http log in SOAPUI

查看:104
本文介绍了如何在SOAPUI的http日志中处理UTF-8字符编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Web服务(cobol代码)生成xml,在该服务中,我们正在执行XML GENERATE以从字帖生成xml.现在,此生成的XML由特殊字符组成,例如[·,Ý,¨],它们在SOAP响应中正确显示.但是,当在http日志中查看相同的消息时,字符将转换为十六进制,如下所示: SOAP响应:

We are generating xml using a web service(cobol code) in which we are doing an XML GENERATE to generate xml from a copybook. Now this generated XML consists of special characters like [·, Ý, ¨] which show correctly in SOAP response. But when the same message is viewed in http logs, the characters get converted to HEX like below : SOAP Response:

<StatusDesc>capital one bank Ýusa¨ ,n.a</StatusDesc>

Http日志:

<StatusDesc>capital one bank [0xc3][0x9d]usa[0xc2][0xa8] ,n.a</StatusDesc>

现在要处理此问题,我们尝试使用WITH ENCODING 1208子句来完成XML GENERATE的工作,以支持UTF-8编码.反过来,这会生成不可读格式的XML,并且SOAP响应中没有可读的XML.因此,不确定我们是否错过了这里的内容,或者这不是我们应该如何处理http日志中的十六进制字符.

Now to handle this we tried to do an XML GENERATE using the WITH ENCODING 1208 clause to support the UTF-8 encoding. This in turn generated the XML in unreadable format, and nothing was readable in SOAP response. So not sure if we are missing out on anything here or is this not how we should be handling the HEX characters in http log.

?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:mes="http://MessageView/"                                                                                                                                        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body>mes:ÃŒ_%€ÎÃÂÊËÑ?>‚‘‚€ÃÂ>Ä?ÀÑ>łíè㘂ž ÄÄÈñ>Ã?ñ>Éê˞ìëÈ/ÈÃÂ˞ëÈ/ÈÃÂËä?ÀÞ‘™ÂÂëÈ/ÈÃÂËä?ÀÞëÃÂÊÎÃÂÊëÃ

问题是,有一种方法可以处理这些字符,以便将http日志中的十六进制字符转换为它们的正确显示.应该在Cobol Web服务中完成此操作还是我们需要某种转换来处理z/os之外的http日志.

The question is that is there a way to handle these characters so that the hex characters in the http log get converted to their proper display. Should this be done in Cobol web service or do we need some kind of conversion to handle the http logs outside z/os.

推荐答案

可以使用以下步骤更改编码.

It is possible to change encoding using below steps.

  • 转到SOAPUI_HOME/bin.
  • 打开soapui.bat (or.sh),具体取决于您的平台.
  • 您应该可以找到JAVA_OPTS,然后可以在该行的下面添加新行

  • Go to SOAPUI_HOME/bin.
  • Open soapui.bat (or.sh), depending on your platform.
  • You should be able find JAVA_OPTS, then you can add there below line in a new line

set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding="utf-8"-在Windows上

set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding="utf-8" - on windows

export JAVA_OPTS=$JAVA_OPTS -Dfile.encoding="utf-8"-在Linux上

保存文件,使用soapui.bat( or .sh)实用程序启动SoapUI.

Save the file, start SoapUI using soapui.bat( or .sh) utility.

这篇关于如何在SOAPUI的http日志中处理UTF-8字符编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆