【问题标题】:IBM and Axis 1.4 web service's compatibilityIBM 和 Axis 1.4 Web 服务的兼容性
【发布时间】:2012-01-13 11:03:47
【问题描述】:

我遇到了网络服务问题。

我有一个 Web 服务,它使用 IBM Web 服务的堆栈在 WebSphere 应用程序服务器上部署和运行了很长时间。现在我已经将它迁移到 glassfish v2.1.1 到 Axis 1.4 堆栈。 Web 服务的 WSDL 没有更改以保持客户端兼容性

有一个具有布尔返回类型的 Web 服务方法。问题是当我调用我的方法肥皂响应在 glassfish 中返回不同:

例子:

WebSphere:

   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <checkPendingOperationsResponse xmlns="http://operations.appserver.dealer.omnitel.lt">
            <checkPendingOperationsReturn xsi:type="xsd:boolean" xmlns="">0</checkPendingOperationsReturn>
         </checkPendingOperationsResponse>
      </soapenv:Body>
   </soapenv:Envelope>

玻璃鱼:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
      <soapenv:Body>  
         <ns1:checkPendingOperationsResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://operations.appserver.dealer.omnitel.lt">   
            <checkPendingOperationsReturn href="#id0"/>  
         </ns1:checkPendingOperationsResponse>  
         <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:boolean" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">false</multiRef> 
      </soapenv:Body>
   </soapenv:Envelope>

问题是某些客户端无法处理“false”、“true”值,因为之前返回的值是“1”、“0”。

是否有解决方案或无法解决的证据?

提前致谢。

【问题讨论】:

  • Axis 1.x 是一个糟糕的 Web 服务堆栈,在许多情况下只是损坏了。如果您要迁移,请迁移到更现代的东西。

标签: java web-services axis


【解决方案1】:

如果您仍然希望为这些值返回 1 和 0(对应于 true 和 false),您可以像 sais here 那样强制返回类,或者创建一个拦截器,在发送响应之前对其进行更改。

【讨论】:

  • 但我不能强制或编写任何拦截器。如果 Web 服务返回 Boolean,它必须返回 Boolean,而不是 long,而不是 int。问题仅在于使用 gSAOP 生成的某些客户端。 “一个 XML Schema 类型不匹配”):SOAP 布尔类型编码的特殊之处在于它只定义了值 0 和 1,而内置的 XML Schema 布尔类型也将 false 和 true 符号常量定义为有效值。跨度>
  • 是的,你是对的,我的提议更像是一种黑客攻击。不幸的是,我认为没有其他事情可做,除非您愿意使用更现代的 SOAP Java 框架(如 CXF)重新做这件事。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-11-24
  • 1970-01-01
  • 1970-01-01
  • 2016-12-09
  • 2011-10-02
相关资源
最近更新 更多