【发布时间】:2012-03-22 14:29:46
【问题描述】:
我已经使用 Netbeans 7.0 和 JAX-WS 实现了一个 Web 服务。
当 Soap UI 调用 Web 服务时,它会正常工作。当它被 SAP CRM 调用时,Web 服务实现接收空参数:在下面的示例中,userId 为空,而不是“foo”。 (userId 是 String 类型)
SOAP UI 发送的 SOAP 消息是:
<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:IciSystemInterface">
<soapenv:Header>
</soapenv:Header>
<soapenv:Body>
<urn:getWorkcenterCapability>
<userId>foo</userId>
</urn:getWorkcenterCapability>
</soapenv:Body>
</soapenv:Envelope>
SAP CRM 发送的 SOAP 消息是:
<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header>
<pre:user xmlns:pre="urn:IciSystemInterface" SOAP-ENV:mustUnderstand="0" xsi:type="xsd:string">IC_AGENT_SRV</pre:user>
<pre:language xmlns:pre="urn:IciSystemInterface" SOAP-ENV:mustUnderstand="0" xsi:type="xsd:string">EN</pre:language>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns0:getWorkcenterCapability xmlns:ns0="urn:IciSystemInterface">
<userId xmlns="urn:IciSystemInterface">foo</userId>
</ns0:getWorkcenterCapability>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
如果我从 userId 标记中删除 xmlns 属性,它可以工作(我进行了更改并通过使用 HTTP 客户端调用 Web 服务对其进行了测试):
<ns0:getWorkcenterCapability xmlns:ns0="urn:IciSystemInterface">
<userId>foo</userId>
</ns0:getWorkcenterCapability>
问题是我无法更改 SAP CRM 的调用方式。有没有办法让 JAX WS 忽略部分访问器元素的命名空间?
提前谢谢你。
【问题讨论】:
-
是否可以通过 Web 服务处理程序解决此问题?
-
可能是这样,但是我必须处理我的服务的每种方法的每条消息。有没有办法强制 JAX-WS 遵守 SOAP 1.1?
标签: java web-services jax-ws