IBM和Axis 1.4 web服务的兼容性

问题描述:

我正面临着web服务的问题。IBM和Axis 1.4 web服务的兼容性

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

有一个Web服务方法具有布尔返回类型。问题是,当我把我的方法SOAP响应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> 

Glassfish的:

<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> 

的问题是,有些客户是无法处理“假”,“真”值,因为之前返回的值为“1”,“0”。

有没有解决方案或证明它是不可能解决的?

在此先感谢。

+1

Axis 1.x是一个糟糕的Web服务栈,在很多情况下,它只是被破坏。如果你要迁移,然后迁移到更现代的东西。 – skaffman 2012-01-13 11:13:01

那么如果你还想为这些值返回1和0(对应于true和false),你可以像这样强制返回类,或者创建一个在发送响应之前改变它的拦截器。

+0

但我不能强制或写任何拦截器。如果Web服务'返回布尔值,它必须返回布尔值,不会很长,而不是int。 问题仅在于使用gSAOP生成的某些客户端。 “XML模式类型不匹配”):SOAP布尔类型编码的特殊之处在于它只定义值0和1,而内置XML模式布尔类型也将假和真符号常量定义为有效值。 – 2012-01-13 11:34:18

+0

是的,你说得对,我提议的更多的是黑客攻击。不幸的是,我不认为还有其他事情要做,除非你愿意用更现代的SOAP Java框架(如CXF)重新做这件事。 – 2012-01-13 14:09:52