Announcement Announcement Module
Collapse
No announcement yet.
Deprecated GenericMarshallingMethodEndpointAdapter vs DefaultMethodEndpointAdapter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Deprecated GenericMarshallingMethodEndpointAdapter vs DefaultMethodEndpointAdapter

    I was looking on Spring WS API for 2.0 and noticed that the GenericMarshallingMethodEndpointAdapter has been deprecated

    Deprecated. as of Spring Web Services 2.0, in favor of DefaultMethodEndpointAdapter and MarshallingPayloadMethodProcessor.

    Source: http://static.springsource.org/sprin...ntAdapter.html
    I use a Marshaller/Unmarshaller. It works fine with a GenericMarshallingMethodEndpointAdapter. I decided to upgrade using the DefaultMethodEndpointAdapter and MarshallingPayloadMethodProcessor. So I removed the following declaration:

    Code:
    <bean class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
    		<constructor-arg ref="castorMarshaller"/>
    		<constructor-arg ref="castorMarshaller"/>
    	</bean>
    And added the following:

    Code:
    <bean id="marshallingMethodProcessor" class="org.springframework.ws.server.endpoint.adapter.method.MarshallingPayloadMethodProcessor">
    		<constructor-arg ref="castorMarshaller"/>
    		<constructor-arg ref="castorMarshaller"/>
    	</bean>
    	
    	<bean id ="defaultMethondEndpointAdapter" class="org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter">
    		<property name="methodArgumentResolvers">
    			<list>
    				<ref bean="marshallingMethodProcessor"/>
    			</list>	
    		</property>
    		<property name="methodReturnValueHandlers">
    			<list>
    				<ref bean="marshallingMethodProcessor"/>
    			</list>
    		</property>
    	</bean>
    But I keep getting the following error:
    java.lang.IllegalStateException: No adapter for endpoint
    So I thought I need to set the property in the MessageDispatcher. So I did:
    Code:
    <bean id="messageDispatcher" class="org.springframework.ws.server.MessageDispatcher">
    		 	<property name="endpointAdapters">
    		 		<list>
    					<ref bean="defaultMethondEndpointAdapter"/>
    				</list>	
    			</property>
    	 </bean>
    I still get the error.

    By the way, I use annotations to mark my endpoint and methods
    Last edited by skram; Dec 25th, 2010, 09:51 PM. Reason: Problem has been resolved.

  • #2
    By the way I tried adding other Adapter types, but only the GenericMarshallingMethodEndpointAdapter matches with my endpoint

    Code:
    [DEBUG] [http-8080-Processor24 03:38:14] (MessageDispatcher.java:getEndpointAdapter:280) Testing endpoint adapter [org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter@9a1411]
    [DEBUG] [http-8080-Processor24 03:38:14] (MessageDispatcher.java:getEndpointAdapter:280) Testing endpoint adapter [org.springframewo[email protected]d]
    [DEBUG] [http-8080-Processor24 03:38:14] (MessageDispatcher.java:getEndpointAdapter:280) Testing endpoint adapter [org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter@1e22c75]
    [DEBUG] [http-8080-Processor24 03:38:14] (XMLContext.java:createUnmarshaller:177) Creating new Unmarshaller instance.

    Comment


    • #3
      I got it working

      Before this was my method:
      Code:
      @PayloadRoot(localPart = REQUEST_LOCAL_NAME, namespace = NAMESPACE_URI)
      	public TicketResponse receiveTicket( TicketRequest ticketRequest) { 
      ..
      }
      And that worked with GenericMarshallingMethodEndpointAdapter.

      With 2.0 that adapter has been deprecated.

      With the new adapters, you must use a combination of DefaultMethodEndpointAdapter and MarshallingPayloadMethodProcessor. This is basically a pluggable adapter. It's a little complicated but flexible than the GenericMarshallingMethodEndpointAdapter.

      Here's the new code:
      Code:
      @PayloadRoot(localPart = REQUEST_LOCAL_NAME, namespace = NAMESPACE_URI)
              @ResponsePayload
      	public TicketResponse receiveTicket( @RequestPayload TicketRequest ticketRequest) { 
      ..
      }

      I'm gonna post later a tutorial for this one so that others will know what's new with Spring WS 2.0.x

      Comment


      • #4
        I've uploaded a tutorial utilizing Spring WS 2.0.0 RC2 build.

        Here's the link: http://krams915.blogspot.com/2010/12...t-200-rc2.html

        Enjoy

        Comment

        Working...
        X