Announcement Announcement Module
Collapse
No announcement yet.
WS-Adressing with sws:annotation-driven Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • WS-Adressing with sws:annotation-driven

    Hello together,

    during upgrade from Spring-WS 1.5.9 to 2.0.0 I tried to change my well working XML-configuration to annotations using <sws:annotation-driven/>.

    Now only my webservice without WS-Adressing is running, but not the webservice with WS-Adressing.

    I get the following error message:

    WARN [EndpointNotFound.dispatch(238)] : No endpoint mapping found for [SaajSoapMessage {http://company.com/orderingsystem}SalesOrderStatusByPONumberQueryRequ est]

    I didnīt find any working examples with sws:annotation-driven and WS-Adressing. Does anybody has experience with that?

    Regards
    Sam

  • #2
    Hello,

    I had the same problem as below:

    Originally posted by saemmy View Post
    WARN [EndpointNotFound.dispatch(238)] : No endpoint mapping found for [SaajSoapMessage {http://company.com/orderingsystem}SalesOrderStatusByPONumberQueryRequ est]
    Fixed it by adding :

    <bean class="org.springframework.ws.soap.addressing.serv er.AnnotationActionEndpointMapping" />

    in my spring context xml.

    It looks like the <sws:annotation-driven /> does not triggers the AnnotationActionEndpointMapping to load.

    Only the SoapActionAnnotationMethodEndpointMapping and PayloadRootAnnotationMethodEndpointMapping are loaded in the AnnotationDrivenBeanDefinitionParser.

    I will report a bug in JIRA (edit: SWS-691 - Annotation-driven tag does not support ws-addressing @Action) for this.

    Regards,
    Willem
    Last edited by willemvd; Feb 8th, 2011, 06:52 AM. Reason: JIRA entry

    Comment


    • #3
      Hi all,

      I do have the same situation: migrating from 1.5.7 to 2.0.0.

      Everything was working perfectly good, then I added the @Endpoint to the endpoints and in the spring context removed all the mapping. Just have the <sws:annotation-driven /> and <sws:dynamic-wsdl />

      But then i get the error "No endpoint mapping found".

      They just work when i explicit set the bean for the Endpoint class and add in a mapping for PayloadRootQNameEndpointMapping.

      I have no idea why the classes annotated with @Endpoint are not being mapped as they should.

      the problem is that using the spring-ws 2.0 i have to add @Endpoint AND also map all the endpoints in a XMl file....

      Any tip?

      spring-ws-servlet.xml
      Code:
      <beans xmlns="http://www.springframework.org/schema/beans"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:context="http://www.springframework.org/schema/context"
          xmlns:aop="http://www.springframework.org/schema/aop"
          xmlns:tx="http://www.springframework.org/schema/tx"
          xmlns:sws="http://www.springframework.org/schema/web-services"
          xsi:schemaLocation="
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
          http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
          http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
          http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd">
      
      
          <sws:annotation-driven />
      
      
      
      	<bean id="placeHodlerConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
          	<property name="locations">
          		<list>
          			<value>classpath*:webservices.properties</value>
          		</list>
          	</property>
          </bean>
          <bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping" />
      <sws:dynamic-wsdl id="someSystem" portTypeName="SomeSystemPortType" locationUri="${somesystem.ws.location.wsdl}">
              <sws:xsd location="${somesystem.ws.location.xsd}"/>
          </sws:dynamic-wsdl>
      
      </beans>

      web.xml
      Code:
      <!-- Spring WS -->
      	<servlet>
      	    <servlet-name>spring-ws</servlet-name>
      	    <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
      	</servlet>
      	<servlet-mapping>
      	    <servlet-name>spring-ws</servlet-name>
      	    <url-pattern>/services/*</url-pattern>
      	</servlet-mapping>
          <!-- Spring WS -->

      Comment


      • #4
        Have you tried annotating your endpoint with @ResponsePayload and @RequestPayload like the following:

        Code:
        @PayloadRoot(localPart = REQUEST_LOCAL_NAME, namespace = NAMESPACE_URI)
         @ResponsePayload
         public SubscriptionResponse processSubscription( @RequestPayload SubscriptionRequest subscriptionRequest) {
        For more info see http://krams915.blogspot.com/2010/12...ing-3-mvc.html

        Comment


        • #5
          Sorry, forgot to attach the code... But yes, i did use those annotations also... But with no result....


          Well, for now i just downgrade back to Spring-WS 1.5.7.... Then I will try to start a project from scratch and see if it's work... Then try to put the old project into the new one...


          thanks!


          Originally posted by skram View Post
          Have you tried annotating your endpoint with @ResponsePayload and @RequestPayload like the following:

          Code:
          @PayloadRoot(localPart = REQUEST_LOCAL_NAME, namespace = NAMESPACE_URI)
           @ResponsePayload
           public SubscriptionResponse processSubscription( @RequestPayload SubscriptionRequest subscriptionRequest) {
          For more info see http://krams915.blogspot.com/2010/12...ing-3-mvc.html

          Comment


          • #6
            using the spring-ws 2.0 i have to add @Endpoint AND also map all the endpoints in a XMl file
            No it is "old school" .
            Just on line is enough tio detect them :

            Code:
            <context:component-scan 
              base-package="fr.yourCOmpany.endpoint,fr.yourCOmpany2.endpoint" />

            Comment


            • #7
              Code:
              <context:component-scan 
                base-package="fr.yourCOmpany.endpoint,fr.yourCOmpany2.endpoint" />
              Thatīs the only thing i didnīt do... but shouldnīt all packages of my project be scanned by default? Or do i have to force the scan on a pre-defined package with this tag?

              Gonna try this one....

              Comment


              • #8
                shouldnīt all packages of my project be scanned by default?
                Keep dreaming And how can Spring know which packages is part of your project and not ?

                Comment


                • #9
                  Hmm, thought about that, but since the docs didnīt say anything about it...

                  Comment


                  • #10
                    Ahhh, problem solved.
                    It was missing the component-scan tag...

                    thanks for the replies!

                    Comment


                    • #11
                      EndpointNotFound:dispatch():238: No endpoint mapping found for [AxiomSoapMessage

                      Hello,
                      i have the same problem.

                      I wrote the test for my spring webservice and when i run it all is ok - the handler method of endpoint is invoking.
                      But also i wrote the client for the deployed ws, and when i run it, the problem occured. And when i test my ws with SOAP UI or REST client - the same error: No responce.
                      My endpoint is placed in com.mycompany.person.ws and add this package in the component-scan.

                      In the eclipse:
                      Code:
                      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><xs:sendRequest xmlns:xs="http://mycompany.com/person/schemas"><xs:login>login</xs:login><xs:password>password</xs:password></xs:sendRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
                      07.06.2011 17:04:48 com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection post
                      SEVERE: SAAJ0008: Bad Response; Not Found
                      Exception in thread "main" com.sun.xml.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (404Not Found
                      	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:146)
                      	at PersonTest.PersonClient.callWebService(PersonClient.java:90)
                      	at PersonTest.PersonClient.main(PersonClient.java:118)
                      Caused by: java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (404Not Found
                      	at java.security.AccessController.doPrivileged(Native Method)
                      	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:140)
                      	... 2 more
                      Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (404Not Found
                      	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:323)
                      	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(HttpSOAPConnection.java:169)
                      	... 4 more
                      And in the Weblogics's log:
                      Code:
                      2011-06-07 17:04:48,397 [TRACE] [server.MessageTracing.received] received:receive():167: Received request [<?xml version='1.0' encoding='utf-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><xs:sendRequest xmlns:xs="http://mycompany.com/person/schemas"><xs:login>login</xs:login><xs:password>password</xs:password></xs:sendRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>]
                      2011-06-07 17:04:48,397 [WARN ] [ws.server.EndpointNotFound] EndpointNotFound:dispatch():238: No endpoint mapping found for [AxiomSoapMessage {http://mycompany.com/person/schemas}sendRequest]
                      Why? What is the reason?
                      Please tell me, must i use some Marshallers or Adapters? I thought that if i use PayloadRootAnnotationMethodEndpointMapping then i needn't something else. Or thats wrong?
                      I'll be glad for any answer. Thank you, guys!

                      My root-context.xml:
                      Code:
                      <?xml  version="1.0" encoding="UTF-8"?>
                      <beans xmlns="http://www.springframework.org/schema/beans"
                      	...>
                      
                      	<context:annotation-config />
                      
                      	<context:component-scan base-package="com.mycompany.person.dao" />
                      	<context:component-scan base-package="com.mycompany.person.service" />
                      	<context:component-scan base-package="com.mycompany.person.ws" />
                      	
                      	<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"/>
                      	<bean id="messageReceiver" class="org.springframework.ws.soap.server.SoapMessageDispatcher"/>
                      	<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping"/>
                      	<bean class="org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping" />
                      </beans>
                      My ws-servlet.xml:
                      Code:
                      <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                             ...>
                      
                          <sws:annotation-driven/>
                      
                          <sws:dynamic-wsdl id="person" portTypeName="Person" locationUri="/personService"
                                            targetNamespace="http://mycompany.com/person/definitions">
                              <sws:xsd location="/WEB-INF/person.xsd"/>
                          </sws:dynamic-wsdl>
                          
                          <sws:interceptors>
                      		<bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
                      	</sws:interceptors>
                      	
                      	<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping"/>
                      	
                      	<bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory">
                      	    <property name="payloadCaching" value="true"/>
                      	</bean>	
                      </beans>
                      My endpoint:
                      Code:
                      @Endpoint
                      public class PersonEndpoint {
                      
                          private static final String NAMESPACE_URI = "http://mycompany.com/person/schemas";
                      
                          private PersonService personService;
                      	
                      	private static final Log logger = LogFactory.getLog(PersonEndpoint.class);
                      	private final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
                      
                          @Autowired
                          public PersonEndpoint(PersonService personService) throws JDOMException {
                              this.personService = personService;
                              Namespace namespace = Namespace.getNamespace("xs", NAMESPACE_URI);
                          }
                      
                          @PayloadRoot(namespace = NAMESPACE_URI, localPart = "sendRequest")
                      	@ResponsePayload
                          public Element handleSendRequest(@RequestPayload Element sendRequest) throws Exception {
                              logger.info("[~~~~~~~ PersonEndpoint ~~~~~~~] In PersonEndpoint: Received sendRequest");
                      		...
                          }
                      }

                      My test (that's ok) looks like this:
                      Code:
                      @RunWith(SpringJUnit4ClassRunner.class)
                      @ContextConfiguration(locations={"/spring/root-context.xml"})
                      public class PersonEndpointIntegrationTest {
                      	private static final Log logger = LogFactory.getLog(PersonEndpointIntegrationTest.class);
                      	
                      	@Autowired
                      	private ApplicationContext applicationContext;
                      	private MockWebServiceClient mockClient;
                      	
                      	@Before
                      	public void createClient() {
                      		mockClient = MockWebServiceClient.createClient(applicationContext);
                      	}
                      
                      	@Test
                      	public void personEndpoint() throws Exception {
                      		Source requestPayload = new StringSource(
                      				"<sendRequest xmlns='http://mycompany.com/person/schemas'>" +
                      					"<login>login</login>" +
                      					"<password>password</password>" +
                      				"</sendRequest>");
                      		Source responsePayload = new StringSource(
                      				"<sendResponse xmlns='http://mycompany.com/person/schemas'>" +
                      					"9" +
                      				"</sendResponse>");
                      		
                      		mockClient.sendRequest(withPayload(requestPayload)).
                      			andExpect(payload(responsePayload));
                      	}
                      }

                      Comment


                      • #12
                        I also had to add <context:component-scan base-package="package.path"/> to enable endpoint detected, although the documentation for <sws:annotation-driven/> says the element's presence "Configures the annotation-driven Spring WS endpoint programming model." This is using Spring-WS-Core version 2.0.2.RELEASE.

                        Comment

                        Working...
                        X