[SWS-558] Use custom data types for @XPathParam annotations Created: 26/Aug/09  Updated: 04/May/12  Resolved: 04/Jan/11

Status: Closed
Project: Spring Web Services
Component/s: Core
Affects Version/s: 1.5.7
Fix Version/s: 2.0 GA

Type: Improvement Priority: Minor
Reporter: Eivind Tagseth Assignee: Arjen Poutsma
Resolution: Complete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File extendable.patch    

 Description   

We've been using @XPathParam annotations for a while, but the supported data types are too limiting. This becomes very clear with web services being passed a user context object as their first parameter. Setting up an XPathParam annotation for each user context field in the endpoint methods spoils the elegance of using XPathParam annotations.

The attached patch makes it possible to define your endpoint methods like this:

    public void supportedTypes(@XPathParam("/root/child/complexType") UserContext userContext) {}

by creating a UserContextParamConverter handling the conversion from a Node to the UserContext object, and registering this converter using the converters property in the bean definition of the ExtendableXPathParamAnnotationMethodEndpointAdapter class.

This implementation tries XPathParamAnnotationMethodEndpointAdapter's conversion support first, then asks each converter registered. If my approach makes sense, theres no reason why the existing conversion support cannot be moved into it's own ParamConverter implementation as well.

Please let me know if this is useful or if there are changes I could make to make it more acceptable.

The patch depends on my other issue, SWS-557.



 Comments   
Comment by Eivind Tagseth [ 26/Aug/09 ]

A new class that extends XPathParamAnnotationMethodEndpointAdapter with the ability to register custom data type converters. Needs the patch from SWS-557 in order to compile.

Comment by Arjen Poutsma [ 04/Jan/11 ]

As of Spring-WS 2.0, the @XPathParam-annotated datatypes can now be converted into any type by using a Spring 3.0 ConversionService.

Comment by Arjen Poutsma [ 04/May/12 ]

Closing old issues

Generated at Mon Dec 18 05:19:22 UTC 2017 using JIRA 6.4.14#64029-sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.