我试图创建一个Web服务,并且应该通过push接收数据。我使用NetBeans从WSDL生成了一个Web。不幸的是,我总是在输出中获得:
无法创建SOAP消息,原因是: XML读取器错误: com.ctc.wstx.exc.WstxParsingException:无效UTF-8启动字节0x8b (在char #2,字节#-1)由: com.ctc.wstx.exc.WstxIOException:无效UTF-8启动字节0x8b (在char #2,字节#-1)
如果更改绑定类型:
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)我得到:
不支持的内容-类型: text/html支持的内容是: application/soap+xml
所以它是一个1.1SOAP协议(改为SOAP11HTTP_BINDING)。
我使用Glassfish 3.1.2.2并已经将JVM-选项更改为:
-Dfile.encoding=UTF-8和
-Dfile.encoding=UTF8但没起作用。UTF16或UTF-16抛出异常.
这就是我的pom.xml的样子:
...
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>PushService.wsdl</wsdlFile>
</wsdlFiles>
<staleFile>${project.build.directory}/jaxws/stale/PushService.stale</staleFile>
</configuration>
<id>wsimport-generate-PushService</id>
<phase>generate-sources</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>webservices-api</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<configuration>
<sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>
<xnocompile>true</xnocompile>
<verbose>true</verbose>
<extension>true</extension>
<catalog>${basedir}/src/jax-ws-catalog.xml</catalog>
</configuration>
</plugin>
...我怎样才能解决这个问题?
更新:的原因是服务发送请求gzipped。那么,我如何解压压缩的答案呢?
发布于 2013-10-07 10:58:51
显然玻璃鱼还不支持gzip解码。因此,我请求一个过滤器,它解码输入:
@WebFilter(filterName = "GZipInputFilter", urlPatterns = {"/*"})
public class GZipInputFilter implements Filterhttps://stackoverflow.com/questions/19092341
复制相似问题