当前位置: 动力学知识库 > 问答 > 编程问答 >

No Endpoint mapping found using annotation driven Spring WS 2.0.2 with dynamic wsdl

问题描述:

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;

}

}

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: