Stack Exchange
Java WSImport tool fails to generate JAX-WS SOAP client from WSDL
I have a web service and I’m always using Java’s wsimport tool to generate a JAX-WS SOAP client from the service’s WSDL.
I’ve started getting an error lately while generating the client, here is the stack trace:
IOException thrown when processing "http://localhost:60952/?xsd=xsd0". Exception: java.net.SocketException: Connection reset.
 Exception in thread "main" com.sun.tools.internal.ws.wscompile.AbortException
    at com.sun.tools.internal.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:129)
    at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2283)
    at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:183)
    at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:126)
    at com.sun.tools.internal.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:429)
    at com.sun.tools.internal.ws.wscompile.WsimportTool.run(WsimportTool.java:190)
    at com.sun.tools.internal.ws.wscompile.WsimportTool.run(WsimportTool.java:168)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:159)
    at com.sun.tools.internal.ws.WsImport.main(WsImport.java:42)

I checked and it looks like it is happening because of some limit in the number of APIs in the WSDL. (43 for exactly)
When I remove one API, no matter which one, the generation is passing successfully.
When I’m adding again an API and it reaches the limit, the generation fails.
I’ve tried using WSImport from JDK 7 & 8.
Here is the definitions of the WSDL:
wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="MyService" targetNamespace="http://tempuri.org/">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localhost:60952/?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://localhost:60952/?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://localhost:60952/?xsd=xsd2" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
</xsd:schema>
</wsdl:types>

Parameters for WSImport:  -s C:\output -p my.package http://localhost:60952/?wsdl
Is anyone familiar with this issue?
How can I debug the WSImport tool through Java? Couldn’t find the sources.

You can debug it using the -verbose switch:

Solaris/Linux

/bin/wsimport.sh -verbose

Windows

\bin\wsimport.bat -verbose

The error also seems to be that your server (your own computer) whether it be websphere, JBoss or GlassFish is resetting the connection.  Can you try restarting it to see if the error goes away?  Also, possibly try increasing the amount of memory allocated to it?
