[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2523
  • Last Modified:

Calling WCF Service from Java -- Connection reset exceptions

Hello All,

A Java application is calling my WCF service.  Once in a while they get the follow exception:


Connection reset; nested exception is java.net.SocketException: Connection resetorg.springframework.ws.client.WebServiceIOException: I/O error: Connection reset; nested exception is java.net.SocketException: Connection reset
      at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:543)
      at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:384)
      at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:378)




This is the Java code being used to call the WCF Service:




public <T> T sendAndReceive(String uriString,
                                 WebServiceMessageCallback requestCallback,
                                 WebServiceMessageExtractor<T> responseExtractor) {
        Assert.notNull(responseExtractor, "'responseExtractor' must not be null");
        Assert.hasLength(uriString, "'uri' must not be empty");
        TransportContext previousTransportContext = TransportContextHolder.getTransportContext();
        WebServiceConnection connection = null;
        try {
            connection = createConnection(URI.create(uriString));
            TransportContextHolder.setTransportContext(new DefaultTransportContext(connection));
            MessageContext messageContext = new DefaultMessageContext(getMessageFactory());

            return doSendAndReceive(messageContext, connection, requestCallback, responseExtractor);
        }
        catch (TransportException ex) {
            throw new WebServiceTransportException("Could not use transport: " + ex.getMessage(), ex);
        }
        catch (IOException ex) {
            throw new WebServiceIOException("I/O error: " + ex.getMessage(), ex);
        }
        finally {
            TransportUtils.closeConnection(connection);
            TransportContextHolder.setTransportContext(previousTransportContext);
}


Any ideas?
0
smokinmark
Asked:
smokinmark
  • 4
  • 2
1 Solution
 
dpearsonCommented:
A connection reset exception generally just means the connection has been closed.

If this call is being placed over the internet this may simply be a network connection failure - somebody dropped the data along the chain between your servers.

However if the call is over a LAN you can probably assume the connection is reliable, in which case you should look for an error that's causing the communication to not complete - e.g. an exception being thrown part way through the message sending, which then prematurely causes the client to close the connection (or socket).

Doug
0
 
smokinmarkAuthor Commented:
Would you be willing to look at my web.config file for the WCF service?
0
 
dpearsonCommented:
Sorry - I'm not familiar with WCFs.  I've just seen those exceptions a thousand times in writing network services that operate over the web.

Doug
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
smokinmarkAuthor Commented:
I'm beginning to wonder if this is an IIS thing.

I have traced this further in the Windows Event Logs.  

"A process serving application pool 'XXX' suffered a fatal communication error with the Windows Process Activation Service. The process id was '1234'. The data field contains the error number."
0
 
smokinmarkAuthor Commented:
Turns out this was a Red Herring.  Problem is elsewhere.  Will make a separate post.  Thanks a million.
0
 
smokinmarkAuthor Commented:
As posted by me.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now