Spring-ws 和 Stripes 框架 - 一杯糟糕的鸡尾酒?

发布于 2024-12-05 19:54:43 字数 3502 浏览 0 评论 0 原文

我正在使用 Spring 2.5.6、Spring-ws 1.5.9 和 Stripes 1.5.6。

我有一个正在运行的 Web 服务,它使用 xml 解析等来实现。我不会详细介绍这一点,因为我认为这不是问题所在。

我正在开发一个新的 ws,发现此页面非常有用: http://jeromebulanadi.wordpress.com/2010/02/25/basic-spring-web-service-tutorial-from-contract-to-security/

...所以使用上面作为实现新 ws 的示例(该链接包含一个对象编组/解组的示例,而不是您自己执行所有 xml)。

当连接到 ws 时,我收到此错误消息(来自 Web 服务模板 - 也在 Spring 中):

org.springframework.ws.client.WebServiceTransportException: Not Found [404]
        at org.springframework.ws.client.core.WebServiceTemplate.handleError(WebServiceTemplate.java:627)
        at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:551)
        at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:502)
        at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:351)
        at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:345)
        at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:337)

调用源自我的模板,我这样调用:

GetSignalsByCprRequest request = new GetSignalsByCprRequest();
request.setCpr(new BigInteger(cpr));
GetSignalsByCprResponse response = (GetSignalsByCprResponse) getWebServiceTemplate().marshalSendAndReceive(request);

更大的堆栈跟踪是:

21-09-2011 11:16:35 INFO  com.mydomain.ws.client.SignalsTemplateImpl  - Entering getSignals(..) in SignalsTemplateImpl
--- ENTER TEMPLATE ---
21-09-2011 11:16:35 TRACE net.sourceforge.stripes.controller.StripesFilter  - Intercepting request to URL: /salesoverview-ws-war/services
21-09-2011 11:16:35 DEBUG net.sourceforge.stripes.controller.StripesFilter  - LocalePicker selected locale: da_DK
21-09-2011 11:16:35 DEBUG net.sourceforge.stripes.controller.StripesFilter  - LocalePicker did not pick a character encoding, using default: UTF-8
21-09-2011 11:16:35 DEBUG net.sourceforge.stripes.controller.UrlBindingFactory  - No URL binding matches /salesoverview-ws-war/services
21-09-2011 11:16:35 DEBUG net.sourceforge.stripes.controller.UrlBindingFactory  - No URL binding matches /salesoverview-ws-war/services
org.springframework.ws.client.WebServiceTransportException: Not Found [404]
        at org.springframework.ws.client.core.WebServiceTemplate.handleError(WebServiceTemplate.java:627)
        at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:551)
        at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:502)
        at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:351)
        at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:345)
        at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:337)

“--- 输入模板 --- " 打印在创建的请求/响应的正上方。错误发生在GetSignalsByCprResponse response = (GetSignalsByCprResponse) getWebServiceTemplate().marshalSendAndReceive(request); 我很茫然——我不知道该去哪里。我有一个轻微的想法,肥皂消息不包含名称空间,或者 Stripes 捕获请求 - 基于堆栈跟踪...Stripes 使用 DynamicMappingFilter,从而将 url 模式映射到/* - 这可能是问题所在。

非常感谢任何想法或指示!

I'm using Spring 2.5.6, Spring-ws 1.5.9, and Stripes 1.5.6.

I have a working webservice which was implementing using xml parsing etc. I'll not go into details about this, as I don't think this is the problem.

I'm working on a new ws and found this page quite useful: http://jeromebulanadi.wordpress.com/2010/02/25/basic-spring-web-service-tutorial-from-contract-to-security/

...so using the above as example to implement a new ws (the link contains an example with marshalling/unmarshalling of objects instead of doing all the xml yourself).

When connecting to the ws I get this error message (from a webservice template - also in Spring):

org.springframework.ws.client.WebServiceTransportException: Not Found [404]
        at org.springframework.ws.client.core.WebServiceTemplate.handleError(WebServiceTemplate.java:627)
        at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:551)
        at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:502)
        at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:351)
        at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:345)
        at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:337)

The call originates from my template and I'm calling like this:

GetSignalsByCprRequest request = new GetSignalsByCprRequest();
request.setCpr(new BigInteger(cpr));
GetSignalsByCprResponse response = (GetSignalsByCprResponse) getWebServiceTemplate().marshalSendAndReceive(request);

A larger stack trace is:

21-09-2011 11:16:35 INFO  com.mydomain.ws.client.SignalsTemplateImpl  - Entering getSignals(..) in SignalsTemplateImpl
--- ENTER TEMPLATE ---
21-09-2011 11:16:35 TRACE net.sourceforge.stripes.controller.StripesFilter  - Intercepting request to URL: /salesoverview-ws-war/services
21-09-2011 11:16:35 DEBUG net.sourceforge.stripes.controller.StripesFilter  - LocalePicker selected locale: da_DK
21-09-2011 11:16:35 DEBUG net.sourceforge.stripes.controller.StripesFilter  - LocalePicker did not pick a character encoding, using default: UTF-8
21-09-2011 11:16:35 DEBUG net.sourceforge.stripes.controller.UrlBindingFactory  - No URL binding matches /salesoverview-ws-war/services
21-09-2011 11:16:35 DEBUG net.sourceforge.stripes.controller.UrlBindingFactory  - No URL binding matches /salesoverview-ws-war/services
org.springframework.ws.client.WebServiceTransportException: Not Found [404]
        at org.springframework.ws.client.core.WebServiceTemplate.handleError(WebServiceTemplate.java:627)
        at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:551)
        at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:502)
        at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:351)
        at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:345)
        at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:337)

"--- ENTER TEMPLATE ---" is printed just above the request/response is created. The error happens in GetSignalsByCprResponse response = (GetSignalsByCprResponse) getWebServiceTemplate().marshalSendAndReceive(request);
I'm quite blank - I have no idea as where to go. I have a slight idea that either the soap message doesn't contain the namespace OR that Stripes catches the request - based on the stack trace... Stripes is using DynamicMappingFilter, thus mapping the url-pattern to /* - which might be the problem.

Any ideas or pointers is much appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

本宫微胖 2024-12-12 19:54:43

似乎您的 Stripes servlet 正在处理您希望由 Spring-ws servlet 处理的 URL,该 Spring-ws servlet 将处理您的 Web 服务请求。您可能需要检查 web.xml 中的

Seems that your Stripes servlet is handling URL’s you want to be handled by the Spring-ws servlet that will handle your web service requests. You might want to check your <url-pattern> in your web.xml.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文