Websphere 7中的JAX-WS客户端失败,出现java.io.UnsupportedEncodingException:text / xml

时间:2016-03-25 16:48:50

标签: web-services websphere jax-ws

在IIS中部署AXIS2 Web服务。使用wsdl我生成了JAX-WS客户端。如果我单独使用它,即使用Oracle JDK,它可以正常工作。

我必须从我在websphere 7中部署的应用程序中调用webservice。因此,我在我的应用程序中包含了jax-ws生成的客户端(作为jar)。当应用程序调用webservice时,它失败并出现java.io.UnsupportedEncodingException:text / xml异常。 Websphere 7将与axis2相关的jar文件用于jax-ws。

异常详情:

引起:javax.xml.stream.XMLStreamException:java.io.UnsupportedEncodingException:text / xml

at com.ibm.xml.xlxp2.api.stax.msg.StAXMessageProvider.throwXMLStreamException(StAXMessageProvider.java:67)
at com.ibm.xml.xlxp2.api.stax.XMLStreamReaderImpl.setDocumentEntity(XMLStreamReaderImpl.java:401)
at com.ibm.xml.xlxp2.api.stax.XMLInputFactoryImpl.setDocumentEntity(XMLInputFactoryImpl.java:1440)
at com.ibm.xml.xlxp2.api.stax.XMLInputFactoryImpl.createXMLStreamReader(XMLInputFactoryImpl.java:1455)
at com.ibm.xml.xlxp2.api.stax.XMLInputFactoryImpl.createXMLStreamReaderInternal(XMLInputFactoryImpl.java:1555)
at com.ibm.xml.xlxp2.api.stax.XMLInputFactoryImpl.createXMLStreamReader(XMLInputFactoryImpl.java:1626)
at org.apache.axiom.om.util.StAXUtils$14.run(StAXUtils.java:618)
at java.security.AccessController.doPrivileged(AccessController.java:251)
at org.apache.axiom.om.util.StAXUtils.createSecureXMLStreamReader(StAXUtils.java:614)
at org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:58)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:191)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:139)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:102)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:66)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:353)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.execute(AxisInvocationController.java:581)
... 41 more

引起:java.io.UnsupportedEncodingException:text / xml

at sun.nio.cs.StreamDecoder.forInputStreamReader(StreamDecoder.java:115)
at java.io.InputStreamReader.<init>(InputStreamReader.java:93)
at com.ibm.xml.xlxp2.api.util.encoding.ByteStreamDataSource.convertToCharacterStream(ByteStreamDataSource.java:278)
at com.ibm.xml.xlxp2.api.util.encoding.PlatformEncodingSupport.loadFromByteStream(PlatformEncodingSupport.java:48)
at com.ibm.xml.xlxp2.api.util.SimpleParsedEntityFactory.detectEncodingSetSource(SimpleParsedEntityFactory.java:503)
at com.ibm.xml.xlxp2.api.util.SimpleParsedEntityFactory.setByteStreamSource(SimpleParsedEntityFactory.java:281)
at com.ibm.xml.xlxp2.api.sax.impl.SAX2ParsedEntityFactory.readFromInputSource(SAX2ParsedEntityFactory.java:122)
at com.ibm.xml.xlxp2.api.sax.impl.SAX2ParsedEntityFactory.createParsedEntity(SAX2ParsedEntityFactory.java:76)
at com.ibm.xml.xlxp2.api.stax.XMLStreamReaderImpl.setDocumentEntity(XMLStreamReaderImpl.java:394)
... 58 more

编辑:更多信息..网络服务正在返回响应。似乎websphere无法处理响应,即问题中指定的异常失败。

请帮忙。

1 个答案:

答案 0 :(得分:0)

异常是因为无效的响应标头*text/xml;charset:UTF-8*. It supposed to be *text/xml;charset=UTF-8*。 IBM JDK在解析时更严格,而Oracle JDK则不然。希望这有助于在调用任何外部Web服务时,如果任何人在Websphere应用程序服务器中遇到类似于“java.io.UnsupportedEncodingException:text / xml”的异常。