肥皂中的${some}
我有以下代码:
@WebMethod
public String replaceEnvironment(String someVar) {
return someVar;
}
当我尝试发送包含 ${something}
子序列的字符串的消息时,我的字符串在解编后被截断: ${something}
substring消失了。这种行为的原因是什么?我需要具有与在 replaceEnvironment
方法中发送的相同的字符串。
PS 我在项目中没有使用 Velocity
或 Freemaker
等库。
SOAP 示例。
请求:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.test.net/">
<soapenv:Header/>
<soapenv:Body>
<ws:replaceEnvironment>
<!--Optional:-->
<arg0>test ${test} test</arg0>
</ws:replaceEnvironment>
</soapenv:Body>
</soapenv:Envelope>
回复:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:replaceEnvironmentResponse xmlns:ns2="http://ws.test.net/">
<return>test test</return>
</ns2:replaceEnvironmentResponse>
</S:Body>
</S:Envelope>
谢谢。
I have the following code:
@WebMethod
public String replaceEnvironment(String someVar) {
return someVar;
}
When i'm trying to send a message with string containing ${something}
subsequence, my string is truncated after unmashalling: ${something}
substring is dissappeared. What is the reason of this behaviour? I need to have the same string as i send in replaceEnvironment
method.
P.S. I don't use libs like Velocity
or Freemaker
in my project.
SOAP examples.
Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.test.net/">
<soapenv:Header/>
<soapenv:Body>
<ws:replaceEnvironment>
<!--Optional:-->
<arg0>test ${test} test</arg0>
</ws:replaceEnvironment>
</soapenv:Body>
</soapenv:Envelope>
Response:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:replaceEnvironmentResponse xmlns:ns2="http://ws.test.net/">
<return>test test</return>
</ns2:replaceEnvironmentResponse>
</S:Body>
</S:Envelope>
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否有机会使用soapUI进行测试调用?
这为请求中的 ${xxx} 序列赋予了特殊含义,将它们替换为等效的soapUI属性的值。
如果是这种情况,也许你可以使用“ 6;” (不带空格或引号)在您的请求中而不是美元,然后查看soapUI是否会忽略您的序列并将其发送到您的后端代码。
华泰
Are you by any chance making the test call with soapUI?
That gives special meaning to ${xxx} sequences in the request, replacing them with the value of the equivalent soapUI property.
If this is the case, maybe you could use "& # 3 6 ;" (without spaces or quotes) in your request instead of the dollar, and see if soapUI then ignores your sequence and sends it through to your backend code.
HTH