使用带有动态 wsdl 的注释驱动 Spring WS 2.0.2 未找到端点映射

发布于 2024-12-08 05:48:33 字数 1727 浏览 1 评论 0原文

我使用注释驱动的 Spring WS 2.0.2 创建一个简单的 Web 服务,但未找到 enpoint 映射。

输入和输出是 jdom 元素,以使其尽可能简单。

Web 服务在 Tomcat 6.0.29 上使用 Java 1.6 运行,返回错误 页面(请求的资源()不可用)到我的 SoapUI 服务测试。

这是我在日志记录中遇到的错误:

WARNING: No endpoint found for [SaajSoapMessage (http://foo.bar/myTest)myRequest]

以下是我认为与端点映射相关的配置部分: (如果我缺少更多相关部分,请回复...)

架构 (WEB-INF/xsd/myTest.xsd)

targetNamespace="http://foo.bar/myTest"

...

<element name="myRequest" type="tns:string"/>
<element name="myResponse" type="tns:string"/>

web.xml (WEB-INF /web.xml)

<servlet-class>
org.springframework.ws.transport.http.MessageDispatcherServlet
</servlet-class>
<init-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>/WEB-INF/spring/config.xml</param-value>
</init-param>
<init-param>
  <param-name>transformWsdlLocations</param-name>
  <param-value>true</param-value>
</init-param>

Spring 配置 (/WEB-INF/spring/config.xml)

<sws:annotation-driven/>

<sws:dynamic-wsdl id="myTest"
  portTypeName="myTest"
  localUri="/"
  targetNamespace="http://foo.bar/myTest">
  <sws:xsd location="/WEB-INF/xsd/myTest.xsd"/>
</sws:dynamic-wsdl>

端点 (src/main/java/bar/foo/MyEndpoint.java)

@Endpoint
public class MyEndpoint{
  @PayloadRoot(localPart="myRequest",namespace="http://foo.bar/myTest")
  @ResponsePayload
  public Element mySearch( @RequestPayload Element myRequest){
     return myRequest;
  }
}

Im using annotation driven Spring WS 2.0.2 to create a simple Webservice, but the enpoint mapping was not found.

Input and Output are jdom Elements to keep it as simple as possible.

The Webservice is running with Java 1.6 on Tomcat 6.0.29 wich returns an error
page (The requested Resource () is not available) to my SoapUI Service Test.

Here is the Error I get in my logging:

WARNING: No endpoint found for [SaajSoapMessage (http://foo.bar/myTest)myRequest]

Here are the parts of the configuration I deem relvant for the Endpoint mapping:
(If there are more relevant parts I am missing please ask back...)

Schema (WEB-INF/xsd/myTest.xsd)

targetNamespace="http://foo.bar/myTest"

...

<element name="myRequest" type="tns:string"/>
<element name="myResponse" type="tns:string"/>

web.xml (WEB-INF/web.xml)

<servlet-class>
org.springframework.ws.transport.http.MessageDispatcherServlet
</servlet-class>
<init-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>/WEB-INF/spring/config.xml</param-value>
</init-param>
<init-param>
  <param-name>transformWsdlLocations</param-name>
  <param-value>true</param-value>
</init-param>

Spring config (/WEB-INF/spring/config.xml)

<sws:annotation-driven/>

<sws:dynamic-wsdl id="myTest"
  portTypeName="myTest"
  localUri="/"
  targetNamespace="http://foo.bar/myTest">
  <sws:xsd location="/WEB-INF/xsd/myTest.xsd"/>
</sws:dynamic-wsdl>

Endpoint (src/main/java/bar/foo/MyEndpoint.java)

@Endpoint
public class MyEndpoint{
  @PayloadRoot(localPart="myRequest",namespace="http://foo.bar/myTest")
  @ResponsePayload
  public Element mySearch( @RequestPayload Element myRequest){
     return myRequest;
  }
}

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

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

发布评论

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

评论(1

一身仙ぐ女味 2024-12-15 05:48:33

在寻找解决方案时,我发现它包含在 这个答案

添加

...
xmlns:context="http://www.springframework.org/schema/context"
...
xsi:schemaLocation=" ...
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd ... "

<context:component-scan base-package="bar.foo"/>

到我的 Spring 配置中,让 servlet 找到我的端点。

我的问题是,我发现 Spring 文档中没有包含示例代码
此步骤及其相关性。

好吧 - 实际上我在之前的教程中找到了这个代码片段,但它有点超载了我不需要的功能,并且正如官方文档中一样,它没有解释为什么它是必要的。

Searching for a sollution I found it contained in this answer

Adding

...
xmlns:context="http://www.springframework.org/schema/context"
...
xsi:schemaLocation=" ...
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd ... "

<context:component-scan base-package="bar.foo"/>

to my Spring configuration let the servlet find my Endpoint.

My problem was, that no sample code in a spring documentation I found contained
this step and its relevance.

Well - actually I found this code snipplet in a tutorial earlier, but it was a bit overloaded with features I did not need, and as in the official docs it was not explained why it was necessary.

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