Hi
I'm not quite sure what you mean by
"//I need to show the xslt output here?? How??"
inside the method implementation ?
Actually, I've typed and realized why the provider won't be selected.
Your method returns 'String' - XSLTJaxbProvider extends JAXB provider
and expects an actual object be a JAXB bean because it works with JAXB
Marshaller.
Do you have XML as String ? If so wrap it into JAXBElement, or simply
add your own custom provider which will wrap String into StreamSource...
Cheers, Sergey
On 01/08/13 01:38, Dev1 wrote:
Thank you. I am able to get to connect to the mock url now. I start the
server and I am testing my service methods from the browser directly. But
now, I do not see the XSLT being used on the url path params or query params
- Basically the output of the method does not contain the xslt output. Not
sure what I am missing here.
When I debugged the xsltjabxprovider related stuff seem not to be picked up.
I am not sure if I missed any other setting??
Any help is highly appreciated.
Below is the code of the server and interface, Impl class and xslt.
*Server:*
private static void startServer() throws Exception {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(<MyWSServiceInterface>.class);
List providers = new ArrayList();
// add custom providers if any
XSLTJaxbProvider provider = new XSLTJaxbProvider();
Map xsltMap = new HashMap();
xsltMap.put("text/xml", "classpath:/xslt/TextToFilterXML.xsl");
provider.setInMediaTemplates(xsltMap);
provider.setResolver(new URIResolverImpl());
providers.add(provider);
sf.setProviders(providers);
sf.setResourceProvider(<MyWSServiceInterface>.class, new
SingletonResourceProvider(
new MyWSServiceImpl(), true));
sf.setAddress(http://localhost:9000/);
server = sf.create();
}
*MyWSServiceInterface:*
public interface MyWSServiceInterface{
@GET
@Path("/myserviceMthd/{domain}/{userId}")
@Produces("text/xml")
public String myserviceMthd(@PathParam("domain") String domain,
@PathParam("userId") String userId;
}
*MyWSImpl:*
public interface MyWSServiceImpl{
@GET
@Path("/myserviceMthd/{domain}/{userId}")
@Produces("text/xml")
public String myserviceMthd(@PathParam("domain") String domain,
@PathParam("userId") String userId
{
//I need to show the xslt output here?? How??
}
*XSLT:*
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:filter="Filter"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="*">
<name:name version="String" xmlns:name="name">
<xsl:call-template name="main">
<xsl:with-param name="<b>domain*"
select="''"/*>*
</xsl:call-template>
</doamin:domain>
</xsl:template>
<xsl:template name="main">
<xsl:variable name="inputValue" select="$domain"/>
<xsl:value-of select="$inputValue"
disable-output-escaping="yes"/>
<xsl:if test="string-length($inputValue)>0">
<domainName>
<xsl:value-of select="."/>
</domainName>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
--
View this message in context:
http://cxf.547215.n5.nabble.com/CXF-Web-client-test-with-mock-URL-tp5731684p5731726.html
Sent from the cxf-user mailing list archive at Nabble.com.
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com