Results 1 to 4 of 4

Thread: Deprecated GenericMarshallingMethodEndpointAdapter vs DefaultMethodEndpointAdapter

Hybrid View

  1. #1
    Join Date
    Dec 2010
    Posts
    315

    Default 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 at 09:51 PM. Reason: Problem has been resolved.

  2. #2
    Join Date
    Dec 2010
    Posts
    315

    Default

    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.springframework.ws.server.endpoint.adapter.PayloadMethodEndpointAdapter@15291cd]
    [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.

  3. #3
    Join Date
    Dec 2010
    Posts
    315

    Default

    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

  4. #4
    Join Date
    Dec 2010
    Posts
    315

    Default

    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

Posting Permissions

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