简体   繁体   English

SAAJ:TextNode中的XML。 行情没有逃脱

[英]SAAJ: XML in TextNode. Quotes not Escaped

together I ty to build a SOAP Request with SAAJ. 我一起使用SAAJ构建SOAP请求。 All works fine but now I have to send an other XMl Document inside the SOAP Body inside SOAP Element. 一切正常,但现在我必须在SOAP元素内的SOAP Body中发送另一个XMl文档。

I tried follwing code: 我尝试了以下代码:

SOAPElement file = service.addChildElement(new QName("nameOfTextNode"));
file.addTextNode(xmlString);

The Problem is most characters are correctly escaped (eg '<' -> &lt; ) but not single or double quotes. 问题是大多数字符都被正确转义(例如'<' - > &lt; )但不是单引号或双引号。 I can't use CDATA or let the quotes as they are, because i don't have control over the SOAP Service and they can't support CDATA or want to change anything. 我不能使用CDATA或按原样使用引号,因为我无法控制SOAP服务,并且它们不能支持CDATA或想要更改任何内容。

When I use anothe Library to escape the String first. 当我使用其他库首先逃避字符串。 It will be escaped twice in the SOAP Request. 它将在SOAP请求中转义两次。

Do aynone have an idea? aynone有想法吗? Please help. 请帮忙。

SAAJ doesn't escape single or double quotes in this case because it's not required. 在这种情况下,SAAJ不会逃避单引号或双引号,因为它不是必需的。 If the service requires that, then it doesn't conform to the XML specification and therefore isn't a SOAP service. 如果服务需要,那么它不符合XML规范,因此不是SOAP服务。 Since SAAJ implements SOAP, you won't be able to use it. 由于SAAJ实现了SOAP,您将无法使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM