Hi
I am trying to use the new XSLTJaxbProvider as a provider for the JAX-RS
WebClient.
I am getting some null pointer exceptions thrown inside the
createTemplates() method of the provider , due to the
ui.getPathParameters() and the ui.getQueryParameters() both
returning null
Below is some test code (not spring wired) - is there something I am
missing, that would ensure the MessageContext creates a UriInfo object
correctly? - or is this simply a bug... if possible do you have an
example of using XSLTJaxbProvider with WebClient (HttpCentric) to
consume a webservice.
Thanks, Paul
WebClient webClient;
@Before
public void setup(){
Map<String,String> mediaTemplates = new
HashMap<String,String>();
mediaTemplates.put("text/xml","classpath:/story-transform.xsl");
XSLTJaxbProvider xsltJaxbProvider = new XSLTJaxbProvider();
xsltJaxbProvider.setConsumeMediaTypes(new
ArrayList<String>(Arrays.asList("text/xml")));
xsltJaxbProvider.setInMediaTemplates(mediaTemplates);
xsltJaxbProvider.setInParameters(new HashMap<String,Object>());
List<Object> providers = new ArrayList<Object>();
providers.add(xsltJaxbProvider);
webClient = WebClient.create(STORY_SERVICE_URL, providers); //
= URL to RESTful webservice to consume
StoryClient = new StoryClient();
StoryClient.setWebClient(webClient);
}
@Test
public void getStory() {
// assume Story object is annotated to be unmarshalled with JAXB
on the transofrmed XML
webClient.path("/story").type("text/xml").accept("text/xml");
webClient.query("story","storyId");
Story story = webClient.get(Story.class);
assertTrue(Story!=null);
// assert more stuff
}
This e-mail (and any attachments) is confidential and may contain personal
views which are not the views of the BBC unless specifically stated. If you
have received it in error, please delete it from your system. Do not use, copy
or disclose the information in any way nor act in reliance on it and notify the
sender immediately.
Please note that the BBC monitors e-mails sent or received. Further
communication will signify your consent to this
This e-mail has been sent by one of the following wholly-owned subsidiaries of
the BBC:
BBC Worldwide Limited, Registration Number: 1420028 England, Registered
Address: BBC Media Centre, 201 Wood Lane, London, W12 7TQ
BBC World News Limited, Registration Number: 04514407 England, Registered
Address: BBC Media Centre, 201 Wood Lane, London, W12 7TQ
BBC World Distribution Limited, Registration Number: 04514408, Registered
Address: BBC Media Centre, 201 Wood Lane, London, W12 7TQ