我在使用smartGWT客户端应用程序通过SOAP调用Web服务操作时遇到问题。
我有两个应用程序在同一个TomCat服务器上运行:
如果我使用SoapUI进行呼叫操作getUser,那么一切正常。 但是,如果我通过我的smartGWT应用程序调用操作getUser,那么我会得到这个例外:
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
在日志中我有这个:
请求:
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]}
--------------------------------------
响应:
ID: 2
Response-Code: 500
Encoding: UTF-8
Content-Type: text/xml
Headers: {}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Error reading XMLStreamReader.</faultstring></soap:Fault></soap:Body></soap:Envelope>
--------------------------------------
我调用webservice的代码是这样的:
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]);
}
});
}
}
}
请帮帮我吗?