Announcement Announcement Module
No announcement yet.
Spring WS with using SAAJ - No adapter for endpoint error Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring WS with using SAAJ - No adapter for endpoint error

    I am really struggling getting Spring-WS to return a response with attachments. I have managed to get an MTOM version to work but this has some pre-requisites on the client as i believe that the client has to be MTOM enabled as well (please correct me if this is not correct).

    What i am trying to do now is to use the standard SOAP with attachment implementation using SAAJ and Spring-WS.

    To do this i implemented an endpoint that just attaches an image from the local filesystem to the response.

        public class TestEndPoint {
        private SaajSoapMessageFactory saajMessageFactory;
        @PayloadRoot(namespace="", localPart="downloadMessageRequestSaaj")
        	public JAXBElement<DownloadResponseSaajType> invoke(@RequestPayload DownloadMessageRequestSaaj req, MessageContext context ) throws Exception  {
        		DownloadResponseSaajType response = new DownloadResponseSaajType();
        		DownloadResponseSaajType.PayLoad payload = new DownloadResponseSaajType.PayLoad();	
        		DataHandler handler = new javax.activation.DataHandler(new FileDataSource("c:\\temp\\maven-feather.png"));
        	        SaajSoapMessage message = saajMessageFactory.createWebServiceMessage();
        	        message.addAttachment("picture", handler);
        	        return objectFactory.createDownloadMessageResponseSaaj(response);  
        	public void setSaajMessageFactory(SaajSoapMessageFactory saajMessageFactory){
                this.saajMessageFactory = saajMessageFactory;
            public SaajSoapMessageFactory getSaajMessageFactory(){
                return saajMessageFactory;
    The Saaj properties are depency injected as shown below:

      	<context:component-scan base-package="com.mypackage"/>
        <bean id="soapMessageFactory" class="javax.xml.soap.MessageFactory" factory-method="newInstance" />
    	<bean id="saajMessageFactory" class="">
    		    <constructor-arg ref="soapMessageFactory" />
    	<bean id="myService" class="com.mypackage.TestEndPoint">
    	    <property name="saajMessageFactory" ref="saajMessageFactory" />
    When i try to call the above service i get the following error:

        <SOAP-ENV:Envelope xmlns:SOAP-ENV="">
                 <faultstring xml:lang="en">No adapter for endpoint [public javax.xml.bind.JAXBElement&lt;> com.mypackage.TestEndPoint.invoke(, throws java.lang.Exception]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?</faultstring>

  • #2
    I noticed today that i change the method signature to remove the MessageContext parameters as shown below then i dont get that error:

    public JAXBElement<DownloadResponseSaajType> invoke(@RequestPayload DownloadMessageRequestSaaj req)
    The problem however is that i need to access the MessageContext to be able to add the attachment. Could be that maybe my configuration is wrong somewhere?