none
WCF Service on IIS and Java JAX-WS -Client yield connection reset exception RRS feed

  • Question

  • Hi everybody,

    I've been trying to set up a working WCF Web Service via SOAP 1.2 for several days now. Unfortunately, it seems impossible for a Java Client to consume this Web Service. As it is part of a minor project of mine, it is vital that the Web Service Consumer is a Java Client.

    What the WS is expected to do is as follows:

    1.  Receive a Complex Data Type and two integer numbers.
    2.  do some stuff.
    3.  Respond with a two-dimensional boolean array.

    I use Visual Studio 2012 for WCF with C# and Netbeans7.2.1 for Java Development. I wrote the WS and then let JAX-WS create the required proxy classes via WSDL-import. So far no errors warnings et cetera. The IIS is Version 7.5, hence on a Windows Server 2008R2 SP1 System and the Web Service got it's own site on it. There are no collisions in binding configuration on the IIS and the ports are open, according to telnet.

    It follows my web.config file from the WCF Service and I may provide any more details if required. I seem unable to find the cause for this anomaly.

    Oh, and i tried, of course, the tracing and logging functions provided by VS2012 but there are neither errors nor warnings from the IIS Express (which is used when hosting the Web Service in the local machine for test scenarios.

    <?xml version="1.0"?>
    <configuration>
    
      <system.diagnostics>
        <sources>
          <source propagateActivity="true" name="System.ServiceModel" switchValue="Verbose,ActivityTracing">
            <listeners>
              <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                <filter type="" />
              </add>
              <add name="ServiceModelTraceListener">
                <filter type="" />
              </add>
            </listeners>
          </source>
        </sources>
        <sharedListeners>
          <add initializeData="D:\Programming\CSharp Projects\eFrac\eFracWebService\Web_tracelog.svclog"
            type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
            <filter type="" />
          </add>
        </sharedListeners>
      </system.diagnostics>  
      
      <system.web>
        <compilation debug="true" targetFramework="4.0" />
      </system.web>
      <system.serviceModel>
        <bindings />
        <services>
          <service behaviorConfiguration="DefaultBehavior" name="eFracWebService.WebFractalService">
            <endpoint address="fractal" binding="wsHttpBinding" bindingConfiguration=""
              contract="eFracWebService.IWebFractal" />
            <host>
              <timeouts closeTimeout="00:00:10" openTimeout="00:01:00" />
            </host>
          </service>
          <service behaviorConfiguration="DefaultBehavior" name="eFracWebService.WebAutomatonService">
            <endpoint address="automaton" binding="wsHttpBinding" contract="eFracWebService.IWebAutomaton" />
          </service>
        </services>    
        
        <behaviors>
          <serviceBehaviors>
            <behavior name="DefaultBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      </system.serviceModel>
     <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
      </system.webServer>
      
    </configuration>

    And here is the Java Exception:

    Exception in thread "AWT-EventQueue-0" javax.xml.ws.WebServiceException: java.net.SocketException: Connection reset
    	at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:201)
    	at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:151)
    	at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83)
    	at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105)
    	at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587)
    	at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546)
    	at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531)
    	at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428)
    	at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211)
    	at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124)
    	at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98)
    	at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
    	at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
    	at com.sun.proxy.$Proxy30.getFractal(Unknown Source)
    	at efrac.core.Fractal.getFractal(Fractal.java:139)
    	at efrac.core.Fractal.GetFractal(Fractal.java:111)
    	at efrac.graphic.components.Events.fraktal_generieren(Events.java:134)
    	at efrac.graphic.components.MainWindow$20.actionPerformed(MainWindow.java:301)
    	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    	at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
    	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:809)
    	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:850)
    	at java.awt.Component.processMouseEvent(Component.java:6297)
    	at javax.swing.JComponent.processMouseEvent(JComponent.java:3275)
    	at java.awt.Component.processEvent(Component.java:6062)
    	at java.awt.Container.processEvent(Container.java:2039)
    	at java.awt.Component.dispatchEventImpl(Component.java:4660)
    	at java.awt.Container.dispatchEventImpl(Container.java:2097)
    	at java.awt.Component.dispatchEvent(Component.java:4488)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4575)
    	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4236)
    	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4166)
    	at java.awt.Container.dispatchEventImpl(Container.java:2083)
    	at java.awt.Window.dispatchEventImpl(Window.java:2489)
    	at java.awt.Component.dispatchEvent(Component.java:4488)
    	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:674)
    	at java.awt.EventQueue.access$400(EventQueue.java:81)
    	at java.awt.EventQueue$2.run(EventQueue.java:633)
    	at java.awt.EventQueue$2.run(EventQueue.java:631)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
    	at java.awt.EventQueue$3.run(EventQueue.java:647)
    	at java.awt.EventQueue$3.run(EventQueue.java:645)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    	at java.awt.EventQueue.dispatchEvent(EventQueue.java:644)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Caused by: java.net.SocketException: Connection reset
    	at java.net.SocketInputStream.read(SocketInputStream.java:168)
    	at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
    	at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
    	at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
    	at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:698)
    	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:641)
    	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:663)
    	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1218)
    	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
    	at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:198)
    	... 55 more

    Any help ist very much appreciated and woud like to have a working environment with as few complexities in it as possible.

    Thank you in advance for any help.



    • Edited by Mr Zeth Tuesday, March 26, 2013 6:44 PM
    Tuesday, March 26, 2013 6:03 PM

Answers

  • Hey,

    I don't know how the java client is reading the OData payload, I also don't know what the payload is. Perhaps you can break the problem down a bit more. First I would isolate the payload that is being sent from the OData service using Fiddler or some type of web request/response debugging tool. Second I would write a much smaller standalone test that doesn't use the gui and reads the payload that is sent. Then perhaps you can analyze this to figure out which specific part of the payload or request gives you the error.

    I still think you need something that understands OData to parse it. For example in the .net world you can't use a standard WCF to deserialize OData. Its a different format. I would think the same applies to the java components as well. But I haven't written code in Java in a long time so I can't really make a call on this either way. Also I think there are different ways to do services. WS is an older one, REST is newer paradigm and they made JAX-RS to handle REST services in Java.

    http://en.wikipedia.org/wiki/Java_API_for_RESTful_Web_Services

    Just as a note there is other options noted in this stack overflow

    http://stackoverflow.com/questions/2403359/how-do-i-interact-with-odata-from-java

    Thanks,

    Chris Robinson - WCF Data Services Team


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, March 27, 2013 4:49 PM
    Moderator

All replies

  • Hey,

    There is an existing open source project that connects to OData called OData4j, http://code.google.com/p/odata4j/. Perhaps you should try this out? At the least it might be a way for you to look at example code on how to do this.

    Thanks,

    Chris Robinson - WCF Data Services


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, March 27, 2013 12:59 AM
    Moderator
  • Hi Chris,

    I read through the guides and examples on the website you suggested. But to me, it looks like an alternative to JAX-WS!? I would rather solve the problem without any additional tools, programs and so on. I want to demonstrate, and use, the Web Service functionality with only the tools and libraries provided by the Frameworks and Development Environment I use.

    I fiddled somewhat with the web.conf of the Web Service and discoveread a something weird. I altered the binding setting from wsHttpBinding to basicHttpBinding. Then the Exception occured only, if one of the parameters exceeded a specific size. Maybe the payload of the WS Response got too large?

    But then, when I changed back to wsHttpBinding , it didn't work.

    Obviously, I don't want to blame WCF or JAX but at some Point I must have made a wrong configuration. I also forgot to mention that I tried in earler stages more easy WS WebMethods and they all worked perfectly.

    So, bearing this in mind, don't you think, there is a way of figuring out what I did wrong? I would rather correct my mistakes than let another tool pretend that I never made one :)

    Cheers!



    • Edited by Mr Zeth Wednesday, March 27, 2013 2:45 PM
    Wednesday, March 27, 2013 9:18 AM
  • Hey,

    I don't know how the java client is reading the OData payload, I also don't know what the payload is. Perhaps you can break the problem down a bit more. First I would isolate the payload that is being sent from the OData service using Fiddler or some type of web request/response debugging tool. Second I would write a much smaller standalone test that doesn't use the gui and reads the payload that is sent. Then perhaps you can analyze this to figure out which specific part of the payload or request gives you the error.

    I still think you need something that understands OData to parse it. For example in the .net world you can't use a standard WCF to deserialize OData. Its a different format. I would think the same applies to the java components as well. But I haven't written code in Java in a long time so I can't really make a call on this either way. Also I think there are different ways to do services. WS is an older one, REST is newer paradigm and they made JAX-RS to handle REST services in Java.

    http://en.wikipedia.org/wiki/Java_API_for_RESTful_Web_Services

    Just as a note there is other options noted in this stack overflow

    http://stackoverflow.com/questions/2403359/how-do-i-interact-with-odata-from-java

    Thanks,

    Chris Robinson - WCF Data Services Team


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, March 27, 2013 4:49 PM
    Moderator
  • Hey Chris,

    thanks a lot for your advice and I will surely take a closer look at the references you gave me. Additionally let me explain that my problem indeed is with the payload. I've found out that the Java Client, for some reason, delivers a wrong exception. I've built a client using svcutil and tested some less and more complex inputs and outputs. This is why it took me so long to answer. And up to a distinct response message size everything was alright. Thenceforth I received again an exception, but this time related to the client's ReceiveMessageSizeQuota (it did say so exactly in the exception). Once I adjusted within the app.config of the client, or from the WCF-Config Tool to be more precise, it worked again. So I now only need to find out where to adjust the same setting for the Java Client. Thanks again for your help and I will now try to find the solution from the JAX-Documentaion.

    Cheers!

    Friday, April 5, 2013 6:32 PM
  • Mr Zeth,

    Could you please publish the solution in case of you found, which may help me too as I am also facing such type of error

    Thanks in advance

    Thursday, May 7, 2015 8:57 AM