Thursday, February 22, 2007

Could not load WSDL: 500 java.net.SocketException: Connection reset

I'm in the process of building a Flex 1.5 app that calls two web services on another server. Frequently while testing the app, I would get hit with this error:

Could not load WSDL: 500 java.net.SocketException: Connection resetIt seemed to happen most often when first loading the app, although it occasionally happened while in the middle of using the app as well. I'm pretty sure it happened every time I made a change to the mxml code. Sometimes none of the data would load in the app when the error occurred and sometimes the data from one of the WSDLs would load (but not the other). To fix it, sometimes I could refresh the page or retry the action and it would work fine, but other times nothing I would do would fix it except for... clearing my browser cache, which would fix it every time. However, in a production environment, that wouldn't do.

The Internet was pretty quiet on the issue. One suggestion I found for related issues was to update the flex-config.xml file and set the <maxconnections> in the proxy section to 0 (unlimited - the default is 50). That didn't seem to help me though. However, I did find a way you can turn the WSDL proxy off, by adding useProxy="false" to the <mx:Webservice> tag. This did the trick for me. Make sure if you do this that you create a cross domain policy file on your WSDL server otherwise you won't be able to access them anymore. Adobe recommends that you use the proxy unless you have a good reason not to.