title: Calling web service operation via SOAP with smartGWT client application
body: <p>I have problem with calling web service operation via SOAP with smartGWT client application.</p>
  
  <p>I have two applications running on same TomCat server:</p>
  
  <ol>
  <li>web service with some operations defined by wsdl (generated by apache CXF 2.5 from java classes)</li>
  <li>smartGWT client application</li>
  </ol>
  
  <p>If I use SoapUI for call operation getUser, then everything works fine. 
  But if I call operation getUser via my smartGWT app then I get this Exception:</p>
  
  <pre><code>WARNING: Interceptor for {http://serviceImpl.tuke.sk/}UserManagementServiceImplService has thrown exception, unwinding now
  org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
      at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:237)
      at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:60)
      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
      at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:123)
      at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:206)
      at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)
      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:193)
      at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:126)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:107)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      at java.lang.Thread.run(Thread.java:680)
  Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
   at [row,col {unknown-source}]: [1,0]
      at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:677)
      at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2104)
      at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2010)
      at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1102)
      at com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1125)
      at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:138)
      ... 23 more
  2.11.2011 19:56:34 org.apache.cxf.services.UserManagementServiceImplService.UserManagementServiceImplPort.UserManagementService
  </code></pre>
  
  <p>In the logs I have this:</p>
  
  <p>request:</p>
  
  <pre><code>ID: 2
  Address: http://localhost:8080/healthCard/userManagementService
  Encoding: UTF-8
  Http-Method: POST
  Content-Type: text/xml; charset=UTF-8
  Headers: {Accept=[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8], accept-charset=[ISO-8859-2,utf-8;q=0.7,*;q=0.7], accept-encoding=[gzip, deflate], accept-language=[sk,cs;q=0.8,en-us;q=0.5,en;q=0.3], cache-control=[no-cache], connection=[keep-alive], Content-Length=[0], content-type=[text/xml; charset=UTF-8], cookie=[__utma=111872281.318978992.1316156803.1317062005.1317851878.15; __utmz=111872281.1316156804.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)], host=[localhost:8080], pragma=[no-cache], referer=[http://localhost:8080/healthCardGui/index.html], SOAPAction=[""], user-agent=[Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0.1) Gecko/20100101 Firefox/7.0.1]}
  --------------------------------------
  </code></pre>
  
  <p>response:</p>
  
  <pre><code>ID: 2
  Response-Code: 500
  Encoding: UTF-8
  Content-Type: text/xml
  Headers: {}
  Payload: &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;soap:Body&gt;&lt;soap:Fault&gt;&lt;faultcode&gt;soap:Client&lt;/faultcode&gt;&lt;faultstring&gt;Error reading XMLStreamReader.&lt;/faultstring&gt;&lt;/soap:Fault&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;
  --------------------------------------
  </code></pre>
  
  <p>And my code of calling webservice is this:</p>
  
  <pre><code>    XMLTools.loadWSDL("http://localhost:8080/healthCard/userManagementService?wsdl", new WSDLLoadCallback() {
        public void execute(WebService webService) {
            webservice = webService;
        }
      });
  
      return form;
  
    }
  
    class UserForm extends DynamicForm {
      public void callService() {
        if (webservice == null) {
          SC.say("Please try again in a moment  - still loading web service descriptor");
        } else {
          setValue("username", "Loading...");
          Map data = new LinkedHashMap();
          data.put("firstname", getValueAsString("username"));
  
  
          webservice.callOperation("getUser", data, null, new WebServiceCallback() {
  
            public void execute(Object[] data, JavaScriptObject xmlDoc, RPCResponse rpcResponse,
                JavaScriptObject wsRequest) {
              UserForm.this.setValue("username", (String) data[0]);
            }
          });
        }
      }
    }
  </code></pre>
  
  <p><strong>Could you help me with it please?</strong> </p>