Problem Description:
Tomcat 5.5.17 is used as the web service host and weblogic 9.2.0 is used as the web service client.
If the return value of ws methods is a complex object, an exception will be thrown:
java 代码
at weblogic.xml.stax.XMLStreamReaderBase.getTextCharacters(XMLStreamReaderBase.java:487)
at org.codehaus.xfire.util.stax.DepthXMLStreamReader.getTextCharacters(DepthXMLStreamReader.java:180)
at org.codehaus.xfire.util.stax.DepthXMLStreamReader.getTextCharacters(DepthXMLStreamReader.java:180)
at org.codehaus.xfire.aegis.type.basic.Base64Type.readObject(Base64Type.java:71)
at org.codehaus.xfire.aegis.type.basic.BeanType.readObject(BeanType.java:159)
at org.codehaus.xfire.aegis.AegisBindingProvider.readParameter(AegisBindingProvider.java:162)
at org.codehaus.xfire.service.binding.AbstractBinding.read(AbstractBinding.java:206)
at org.codehaus.xfire.service.binding.WrappedBinding.readMessage(WrappedBinding.java:50)
at org.codehaus.xfire.soap.handler.SoapBodyHandler.invoke(SoapBodyHandler.java:42)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.client.Client.onReceive(Client.java:382)
Thoughts:
According to the stacktrace, it seems weblogic's default xml stax parser doesn't work with xfire 1.2.4 if the method's return value is complex objects. Am thinking to replace the default parser with the one from xfire's library. But how?
Solution:
Set "prefer-web-inf-classes" to true.
xml 代码
Based on the document:
If true, classes located in the WEB-INF directory of a web-app will be loaded in preference to classes loaded in the application or system classloader. Defaults to false. Value specified via console will be given precedence over this setting.
Problem solved!