"org.xml.sax.SAXParseException: Premature end of file." while parsing schema
I'm writing a webservice client running on Linux JBoss 5.0.1 / JBossWS Native 3.1.1 which is calling a service running on a Windows Tomcat 6.0.29 / Metro Stack.
The WSDLs and the referenced XSD files are accessible via browser and also the JUnit tests I wrote work just fine. But when the client is running inside JBoss, I get the following stacktrace:
Caused by: org.jboss.ws.metadata.wsdl.WSDLException: javax.wsdl.WSDLException: WSDLException (at /definitions/types/xsd:schema): faultCode=PARSER_ERROR: Problem parsing '开发者_开发百科http://server:8280/ValueListService/?xsd=1'.: org.xml.sax.SAXParseException: Premature end of file.
at org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitionsFactory.java:152)
at org.jboss.ws.metadata.umdm.ServiceMetaData.getWsdlDefinitions(ServiceMetaData.java:293)
at org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder.buildMetaData(JAXWSClientMetaDataBuilder.java:84)
at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.<init>(ServiceDelegateImpl.java:138)
at org.jboss.ws.core.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:63)
at javax.xml.ws.Service.<init>(Service.java:79)
at javax.xml.ws.Service.create(Service.java:96)
at ...
By debugging the JBossWS WSDL implementation I found, that the InputStream which is created from the referenced XSD is null. This normally points me to the assumption, that there is some kind of networking issue (or firewall) between the client and the server. This is all very confusing, as I have the Unit tests running on the same machine, so it can't be because of that.
It took me quite a while to understand the inner workings of the WS implementation, but I got a solution now.
The problem resides within JBoss native, which cannot cope with the Metro generated URLs. My woraround for now is loading the WSDLs and XSDs from my local resources and changing the endpoint address to the real server address manually.
@artbristol, thanks for your help.
精彩评论