Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

xml - How to handle UTF-8 character encoding in http log in SOAPUI

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 [·, Y, ¨] 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 Yusa¨ ,n.a</StatusDesc>

Http Log:

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

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:???’_%??a???????????????a€1??a€??>??a€???a€??????a€???a?????>??a€????a????a€?>??a€|??a€????-???¨???£??????a€???????????a€???a€????????±>???’????±>??a€°???a??a€1????????????????/?????????a€1????????????/?????????a€1???¤???a???????????a€??????a?¢???????????/?????????a€1???¤???a?????????????????????????????????????

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It is possible to change encoding using below steps.

  • 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" - on windows

    export JAVA_OPTS=$JAVA_OPTS -Dfile.encoding="utf-8" - on linux

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...