Oracle 的 jDeveloper 在调用外部 Web 服务时似乎忽略了 WSDL 中的声明?
在调用外部 Web 服务时,Oracle 的 jDeveloper 似乎忽略了 WSDL 中的忽略声明,我不确定为什么......?
我们正在尝试使用使用此 WSDL 找到的第三方 Web 服务:http://tbe.taleo。 net/wsdl/WebAPI.wsdl
如果将其弹出到 SoapUI 中并打开 searchCandidate 操作,您将发现请求结构如下。请注意,in1
中包含一个
节点,该节点是在 WSDL 中定义的。
<urn:searchCandidate>
<in0>?</in0>
<in1>
<!--Zero or more repetitions:-->
<item>
<key>?</key>
<value>?</value>
</item>
</in1>
</urn:searchCandidate>
奇怪的是,当我们在 jDeveloper 中使用此 WSDL 并调用 searchCandidate 操作时,由于某种原因,jdeveloper 构建了以下 xml SOOP 消息。请注意,
不存在,而是
位于其位置。
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns0="urn:TBEWebAPI"
xmlns:ns1="http://xml.apache.org/xml-soap">
<env:Body>
<ns0:searchCandidate>
<in0>STRING DATA</in0>
<in1 xmlns:ans1="http://www.oracle.com/webservices/internal/literal"
xsi:type="ans1:hashMap">
<ans1:mapEntry xsi:type="ans1:mapEntry">
<ans1:key xsi:type="xsd:string">HireDate</ans1:key>
<ans1:value xsi:type="xsd:string">2011-12-31</ans1:value>
</ans1:mapEntry>
<ans1:mapEntry xsi:type="ans1:mapEntry">
<ans1:key xsi:type="xsd:string">status</ans1:key>
<ans1:value xsi:type="xsd:string">Hired</ans1:value>
</ans1:mapEntry>
</in1>
</ns0:searchCandidate>
</env:Body>
</env:Envelope>
以下是我们如何填充 searchCandidate 参数并调用 Web 服务。这只是一个片段,因为从开始到结束的整个过程有点复杂,只会使我在这里试图传达的问题变得混乱。为了测试这一点,我建议将 Web 服务的端点更改为 http://localhost:6667 之类的内容,然后只是嗅探http 流量以查看肥皂消息,因为错误是在实际调用 Web 服务之前创建的,因此无需完成对其服务器的调用。我们的企业软件是 Oracle 的 EnterpriseOne,他们的 Web 服务被称为“业务服务”,并使用 jDeveloper 创建它们并与主 ERP 系统连接,不确定这是否重要,但以防万一我想提一下。
RpcrouterSoapBinding_searchCandidate_ReqS inParam = new RpcrouterSoapBinding_searchCandidate_ReqS();
// Set in0
inParam.setIn0("String Data");
// Set in1
Map inputParamMap = new HashMap();
inputParamMap.put("HireDate", "2011-12-31");
inputParamMap.put("status", "Hired");
inParam.setIn1(inputParamMap);
// Begin service call
oracle.e1.bssv.J5706002.proxy.SearchResultArr searchReturn;
RpcrouterSoapBinding_searchCandidate_RespS outParam = new RpcrouterSoapBinding_searchCandidate_RespS();
try {
searchReturn = myPort.searchCandidate(inParam.getIn0().toString(),inParam.getIn1);
outParam.setSearchCandidateReturn(searchReturn);
} catch(Exception err){
System.out.println("I got an error.");
}
你以前见过这样的事情吗?序列化程序似乎忽略了 WSDL。
根据 WSDL 应具有 apachesoap:Map
类型,但正如您在此处看到的那样,它以某种方式设置为 ans1:hashMap
> 但我不知道如何告诉它使用正确的类型?
有人见过这种行为吗?
Oracle's jDeveloper seems to ignore ignore declarations in a WSDL when calling an external web service and I'm not sure why...?
We are trying to consume a third party web service found using this WSDL: http://tbe.taleo.net/wsdl/WebAPI.wsdl
If you pop that into SoapUI and open the searchCandidate operation you'll find the request structure to be the following. Note that in1
contains an <item>
node within it, which is defined in the WSDL.
<urn:searchCandidate>
<in0>?</in0>
<in1>
<!--Zero or more repetitions:-->
<item>
<key>?</key>
<value>?</value>
</item>
</in1>
</urn:searchCandidate>
The weird part is that when we use this WSDL in jDeveloper and call the searchCandidate operation, for some reason jdeveloper builds the following xml soap message. Note that <item>
is not there, but instead <mapEntry>
is in its place.
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns0="urn:TBEWebAPI"
xmlns:ns1="http://xml.apache.org/xml-soap">
<env:Body>
<ns0:searchCandidate>
<in0>STRING DATA</in0>
<in1 xmlns:ans1="http://www.oracle.com/webservices/internal/literal"
xsi:type="ans1:hashMap">
<ans1:mapEntry xsi:type="ans1:mapEntry">
<ans1:key xsi:type="xsd:string">HireDate</ans1:key>
<ans1:value xsi:type="xsd:string">2011-12-31</ans1:value>
</ans1:mapEntry>
<ans1:mapEntry xsi:type="ans1:mapEntry">
<ans1:key xsi:type="xsd:string">status</ans1:key>
<ans1:value xsi:type="xsd:string">Hired</ans1:value>
</ans1:mapEntry>
</in1>
</ns0:searchCandidate>
</env:Body>
</env:Envelope>
Here is how we are populate the searchCandidate parameters and calling the web service. This is only a snippet because the whole process from start to finish is a little complicated and will just clutter the issue I'm trying to convey here. To test this out I would recommend changing the endpoint of the webservice to something like http://localhost:6667 and then just sniff the http traffic to see the soap message, since the error is created before the actual call to the web service is made it's not necessary to complete the call to their servers. Our enterprise software is Oracle's EnterpriseOne and their web services are referred to as "Business Services" and uses jDeveloper to create them and interface with the main ERP system, not sure if that matters but just in case I wanted to mention it.
RpcrouterSoapBinding_searchCandidate_ReqS inParam = new RpcrouterSoapBinding_searchCandidate_ReqS();
// Set in0
inParam.setIn0("String Data");
// Set in1
Map inputParamMap = new HashMap();
inputParamMap.put("HireDate", "2011-12-31");
inputParamMap.put("status", "Hired");
inParam.setIn1(inputParamMap);
// Begin service call
oracle.e1.bssv.J5706002.proxy.SearchResultArr searchReturn;
RpcrouterSoapBinding_searchCandidate_RespS outParam = new RpcrouterSoapBinding_searchCandidate_RespS();
try {
searchReturn = myPort.searchCandidate(inParam.getIn0().toString(),inParam.getIn1);
outParam.setSearchCandidateReturn(searchReturn);
} catch(Exception err){
System.out.println("I got an error.");
}
Have you ever seen anything like this before? It seems like the serializer is ignoring the WSDL. <in1>
should have a type of apachesoap:Map
per the WSDL, but as you can see here somehow its getting set to ans1:hashMap
but I have no idea how to tell it to use the correct type?
Has anyone see this type of behavior before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明这是 jDeveloper 中的一个错误。 Oracle 正在修复错误。很高兴知道我没有疯。 :D
It turns out this was a bug in jDeveloper. Oracle is working on a bug fix. Glad to know Im not crazy. :D