[英]Spring-ws -Problem request webservice from tomcat 6
I have implement a certain spring-ws service and when I sent a soap message I receive in spring webapplication 1 (running on tomcat 6.0.32): 我已经实现了一个spring-ws服务,当我发送一个soap消息时,我收到了spring webapplication 1(在tomcat 6.0.32上运行):
Request: 请求:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:gen="http://www.foo.com/bar/webservice/generated">
<soapenv:Header/>
<soapenv:Body>
<gen:GetAllPanelWSRequest/>
</soapenv:Body>
</soapenv:Envelope>
Response 响应
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns2:GetAllPanelWSResponse xmlns:ns2="http://www.foo.com/bar/webservice/generated">
<ns2:PanelWS ns2:Id="5">
<ns2:name>all</ns2:name>
<ns2:code>all</ns2:code>
</ns2:PanelWS>
<ns2:PanelWS ns2:Id="9">
<ns2:name>test</ns2:name>
<ns2:code>test1</ns2:code>
</ns2:PanelWS>
</ns2:GetAllPanelWSResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
So far no problem. 到目前为止没问题。 From a webappliction 2 (not using spring MVC etc.) I made a function and when I run this function it works:
从webappliction 2(不使用spring MVC等)我创建了一个函数,当我运行这个函数时它工作:
Main.java : Main.java :
...
public class Main {
public static void main(String[] args) {
List<PanelWS> panelWSs = CallServices.getPanelWSs();
for (PanelWS p : panelWSs) {
System.out.println("\t" + makeString(p));
}
}
...
CallServices.java CallServices.java
public static List<PanelWS> getPanelWSs() {
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
PanelClient client = (PanelClient) ctx.getBean("client");
PanelWS panelWS = null;
// Get all panelWS
System.out.println("Get all panels...");
List<PanelWS> panelWSs = client.getAllPanelWS();
return panelWSs;
}
Output: 输出:
Get all panels...
[id=5, name=all, code=all]
[id=9, name=test, code=test1]
So this works great and as expected. 所以这很好,并且符合预期。 But when I want to call the function
但是当我想调用这个函数时
<%
List<PanelWS> panelWSs = CallServices.getPanelWSs();
%>
within a JSP (runnning on the same tomcat server) or a simple class I get the following error: 在JSP(在同一个tomcat服务器上运行)或一个简单的类中,我得到以下错误:
Server: 服务器:
13-mei-2011 17:57:37 com.sun.xml.internal.messaging.saaj.soap.MessageImpl saveChanges
SEVERE: SAAJ0539: Unable to get header stream in saveChanges
13-mei-2011 17:57:37 com.sun.xml.internal.messaging.saaj.soap.MessageImpl saveChanges
SEVERE: SAAJ0540: Error during saving a multipart message
Client: 客户:
org.springframework.ws.soap.saaj.SaajSoapMessageException: Could not write message to OutputStream: Error during saving a multipart message;
org.springframework.ws.soap.saaj.SaajSoapMessageException:无法将消息写入OutputStream:保存多部分消息时出错; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Error during saving a multipart message
嵌套异常是com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl:保存多部分消息时出错
I'm using the following Java version pointing to myeclipse and tomcat (runs on): 我正在使用以下Java版本指向myeclipse和tomcat(运行):
*JDK 1.6.0_13* * JDK 1.6.0_13 *
Jars: 罐子:
Full stacktrace of client 完整的堆栈跟踪的客户端
Message: org.springframework.ws.soap.saaj.SaajSoapMessageException: Could not write message to OutputStream: Error during saving a multipart message; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Error during saving a multipart message
Error ID: #9yb3mzb7
Stack trace: org.springframework.ws.soap.saaj.SaajSoapMessage.writeTo(SaajSoapMessage.java:169)
org.springframework.ws.client.core.WebServiceTemplate.sendRequest(WebServiceTemplate.java:580)
org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:549)
org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:502)
org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:351)
org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:345)
org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:337)
com.foo.bar.webservice.client.PanelMGMClientImpl.getAllPanelWS(PanelMGMClientImpl.java:22)
com.foo.bar.webservice.client.CallServices.getPanelWSs(CallServices.java:22)
org.apache.jsp.workspace.aclusers_jsp._jspService(aclusers_jsp.java:786)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
Fullstacktrace of server ** 服务器的fullstacktrace **
**SEVERE: Servlet.service() for servlet spring-ws threw exception
java.io.IOException: org.apache.xml.serializer.ToXMLSAXHandler cannot be cast to org.apache.xml.serializer.SerializationHandler
at com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl.output(EnvelopeImpl.java:298)
at com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl.output(EnvelopeImpl.java:309)
at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.getContentAsStream(SOAPPartImpl.java:305)
at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.getHeaderBytes(MessageImpl.java:947)
at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.saveChanges(MessageImpl.java:1098)
at org.springframework.ws.soap.saaj.Saaj13Implementation.writeTo(Saaj13Implementation.java:268)
at org.springframework.ws.soap.saaj.SaajSoapMessage.writeTo(SaajSoapMessage.java:165)
at org.springframework.ws.transport.AbstractWebServiceConnection.send(AbstractWebServiceConnection.java:45)
at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:97)
at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.foo.bar.support.gzip.CompressionFilter.doFilter(CompressionFilter.java:30)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:168)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
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:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:864)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665)
at java.lang.Thread.run(Thread.java:619)
16-mei-2011 14:20:12 com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory createEnvelope
SEVERE: SAAJ0511: Unable to create envelope from given source**
** **
hopefully this is enough information to solve the problem. 希望这是解决问题的足够信息。 I found some messages and bugs the pointing to the fact that I need to delete some Jars (xalan,xercesImpl and serializer) from the projects and add these jars to the
jdk\\lib\\endorsed\\
folder and add to tomcat the argument: -Djava.endorsed.dirs=
. 我发现了一些消息和错误指向我需要从项目中删除一些Jars(xalan,xercesImpl和serializer)并将这些jar添加到
jdk\\lib\\endorsed\\
文件夹并向tomcat添加参数: -Djava.endorsed.dirs=
。 This works but I can't do this because the applications is running on several servers already. 这有效,但我无法做到这一点,因为应用程序已在多个服务器上运行。
Thx in advance Thx提前
Alternative solution 替代方案
Solved It for now while using the Apache CXF on the client. 在客户端上使用Apache CXF时解决了这个问题。 And spring-ws 1.5.9 on the server... apparently spring-ws sucks with jdk > 1.5
并且服务器上的弹簧为1.5.9 ......显然,jdk> 1.5时弹簧很糟糕
Maybe you should try considering updating to xerces-2.10.x, the problem can be that in jdk6 (rt.jar) there is a com.sun.org.apache.xerces package which seem to contain a jaxp 1.4 implementation, so does xerces 2.10+: 也许你应该尝试考虑更新到xerces-2.10.x,问题可能是在jdk6(rt.jar)中有一个com.sun.org.apache.xerces包似乎包含一个jaxp 1.4实现,xerces也是如此2.10+:
"It also contains an implementation of the parser related portions of JAXP 1.4"
“它还包含JAXP 1.4的解析器相关部分的实现”
Are you building the binary containing the jsp as a separate process or you are building everything together? 您是否正在构建包含jsp的二进制文件作为单独的进程,或者您正在构建所有内容? If it's separated, you can try to remove xerces and xalan from the buildpath of that package only?
如果它是分开的,你可以尝试从该包的构建路径中删除xerces和xalan吗? - If you cannot, try upgrading maybe it'll help.
- 如果你不能,尝试升级也许它会有所帮助。
Still think it would be better to have a service calling your ws and you'd invoke that service from the jsp, that way you could test it separately, but perhaps you can't do that for some reason. 仍然认为让服务调用你的ws并且你从jsp调用该服务会更好,这样你可以单独测试它,但也许你不能因为某些原因那样做。
If both of these fail, can you post a) full stacktrace b) some of the errors which appear if you remove xerces and xalan alltogether? 如果这两个都失败了,你可以发布a)完整的堆栈跟踪b)如果你删除xerces和xalan一起出现的一些错误?
Solved It for now using the Apache CXF 2.4.0 on the client. 现在使用客户端上的Apache CXF 2.4.0解决了它。 And spring-ws 1.5.9 on the server... apparently spring-ws sucks with jdk > 1.5
并且服务器上的弹簧为1.5.9 ......显然,jdk> 1.5时弹簧很糟糕
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.