6

When trying a simple Web Service Hello World example with just one @Endpoint annotated class, the Endpoint is not registered when using the <sws:annotation-driven/> namespace.

However, by adding the usual <context:component-scan>, everything works well, the Endpoint-class is registered correctly. This is only true for the @Endpoint annotation, all other annotations (@RequestPayload, @ResponsePayload, @PayloadRoot) will be registered by the sws-namespace as expected.

Should the @Endpoint annotation not be processed by this namespace as well?

<beans>
   <!-- works for all annotations except @Endpoint -->
    <sws:annotation-driven/>

    <!-- when activated, @Endpoint is registered correctly <context:component-scan/> -->
</beans>
1
  • Can you tell me the address to this example? I am having hard time finding good Spring WS 2 tutorial.
    – Jaanus
    Sep 27, 2011 at 16:04

2 Answers 2

3

This is a known SWS bug: https://jira.springsource.org/browse/SWS-702.

1
  • I saw this bug-report, but Arjen's comment on 19/May seemed to me to indicate an other bug - my endpoint does not implement any interface, nor am I using aop-proxies (at least intentionally).
    – Ice09
    Jun 1, 2011 at 14:24
2

For now use both as in:

<context:component-scan base-package="com.coral.project.endpoints"/>

<sws:annotation-driven marshaller="marshaller" unmarshaller="marshaller"/>

this finds both @Endpoint and @PayloadRoot,@ResponsePayload annotations. This is the way they tell you to do it in Spring-WS reference:

http://static.springsource.org/spring-ws/sites/2.0/reference/html/tutorial.html#tutorial.implementing.endpoint

5
  • True, however there it's said: ...we also instruct Spring-WS to use annotation-driven endpoints, with the <sws:annotation-driven> element... so I understand that the context:cmp-scan was only used for registering components "outside" the sws-domain.
    – Ice09
    Jun 1, 2011 at 14:28
  • So is this a bug or by-design? I am having the same issue and this answer resolves it. It is just not this way in the examples Pivotal has in their spring documentation. See the 5.4. Endpoints section
    – gaoagong
    Aug 4, 2014 at 17:45
  • and can you explain me where this marhaller are sets ?
    – hudi
    Aug 8, 2014 at 10:41
  • It's a JAXB marshaller that you need to define and implement. Please see Spring's doc: docs.spring.io/spring-ws/site/reference/html/oxm.html and an example: thoughtforge.net/610/marshalling-xml-with-spring-ws-and-jaxb and also: mkyong.com/java/jaxb-hello-world-example
    – Benchik
    Aug 10, 2014 at 7:36
  • but I am not interested in jaxb. I want to know where spring-ws use this marshaller. In example which you post there is nothing about spring-ws mapping (it is mention in comments)
    – hudi
    Feb 23, 2015 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.