我开发了一个Web服务并使用Axis进行部署.一切都运行得很好,但是当我使用包含不可打印字符的字符串(例如ETX,FS,..)来使用服务时,我遇到了问题.我有以下错误:
exception: java.lang.IllegalArgumentException: The char '0x1c' after '....' is not a valid XML character.
Run Code Online (Sandbox Code Playgroud)
请问有什么想法吗?
编辑:
我必须使用Web服务将帧发送到我的服务器.我的框架有一个严格的形式(包含一些不可打印的字符作为分隔符)
class Automate {void checkFrame(String frame){// checking the frame}}
Run Code Online (Sandbox Code Playgroud)
wsdl文件
<?xml version="1.0" encoding="UTF-8"?>
Run Code Online (Sandbox Code Playgroud)
<wsdl:part element="impl:checkFrameResponse" name="parameters"/>
Run Code Online (Sandbox Code Playgroud)
<wsdl:part element="impl:checkFrame" name="parameters"/>
Run Code Online (Sandbox Code Playgroud)
<wsdl:operation name="checkFrame">
<wsdl:input message="impl:checkFrameRequest" name="checkFrameRequest"/>
<wsdl:output message="impl:checkFrameResponse" name="checkFrameResponse"/>
</wsdl:operation>
Run Code Online (Sandbox Code Playgroud)
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="checkFrame">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="checkFrameRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="checkFrameResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
Run Code Online (Sandbox Code Playgroud)
<wsdl:port binding="impl:AutomateSoapBinding" name="Automate">
<wsdlsoap:address location="http://localhost:8080/Gateway/services/Automate"/>
</wsdl:port>
Run Code Online (Sandbox Code Playgroud)
不幸的是,这是 SOAP 的一个自然问题 - 它使用 XML 来表示文本,而这些字符无法用 XML 表示(即使对于实体也是如此)。
你能以某种方式转义不可打印的字符吗?不幸的是,您需要找到某种方法不将它们表示为直接文本。
| 归档时间: |
|
| 查看次数: |
10026 次 |
| 最近记录: |