Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: WS-Adressing with sws:annotation-driven

  1. #11
    Join Date
    Jun 2011
    Posts
    5

    Question 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));
    	}
    }

  2. #12
    Join Date
    Oct 2011
    Location
    Johannesburg
    Posts
    1

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •