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>
Ice09
  • 8,951
  • 4
  • 23
  • 25
  • Can you tell me the address to this example? I am having hard time finding good Spring WS 2 tutorial. – Jaanus Sep 27 '11 at 16:04

2 Answers2

3

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

abalogh
  • 8,239
  • 2
  • 34
  • 49
  • 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 01 '11 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

Benchik
  • 2,057
  • 5
  • 26
  • 44
  • True, however there it's said: ...we also instruct Spring-WS to use annotation-driven endpoints, with the element... so I understand that the context:cmp-scan was only used for registering components "outside" the sws-domain. – Ice09 Jun 01 '11 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](http://docs.spring.io/spring-ws/site/reference/html/server.html) – gaoagong Aug 04 '14 at 17:45
  • and can you explain me where this marhaller are sets ? – hudi Aug 08 '14 at 10:41
  • It's a JAXB marshaller that you need to define and implement. Please see Spring's doc: http://docs.spring.io/spring-ws/site/reference/html/oxm.html and an example: http://thoughtforge.net/610/marshalling-xml-with-spring-ws-and-jaxb/ and also: http://www.mkyong.com/java/jaxb-hello-world-example/ – Benchik Aug 10 '14 at 07: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 '15 at 11:27