Skip to main content

Posts

Showing posts with the label service

CXF-RS Hiding JAXRS Service Endpoints Listing

You may come across a scenario where you want to stop listing of the exposed service from given endpoint. This can be achieved by setting the property " org.apache.cxf.endpoint.private "   to true as shown in following snippet: < jaxrs:server id = "serivceId" address = "/test" > . . . < jaxrs:properties > < entry key = "org.apache.cxf.endpoint.private" value = "true" /> </ jaxrs:properties > </ jaxrs:server > This will stop the listing of the service when url http://server:port/ test is typed in the browser.

CXF-RS: Java Code Generation from xml/xsd

Cleaner approach is to use xjc like this: Continue to dirty approach below if u need to: When working with CXF-RS services often we start with XML message that will be served. After that we go through endless iteration of generating the right Java POJO's for the XML. The library like apache XMLBeans generate the Java code but the code generated is not what a developer would write and generally tedious to modify and understand. I have come across a work around for generating Java classes from XSD (xml) which is very close to what a developer with decent experience will write.  Follow the steps given below to explore the solution: 1. Generate the wsdl from from xsd as given in at this link  ( http://cxf.apache.org/docs/xsd-to-wsdl.html ). 2. The Java classes can be generated from wsdl from maven plugin entry below find complete details here   http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html org.apache.cxf cxf-codegen-plugin ...

First CXF-RS service with Tomcat web-container

Looking to get started on CXF-RS, well that was what i was looking for and there are load of articles doing however none of them provide sufficient bullet points to make me understand how the control is following are how to debug the application if something is not working. Well that's what i am going to write here. Following are components you need to get started with first CXF-RS: Tomcat Eclipse (or some equivalent IDE) Spring Create a dynamic web project in the eclipse (this is nothing but a simple web project which can deployed and can run when deployed in the web container like Tomcat). Keep your eye on the bold terms featuring in the files... Start will writing the web.xml descriptor file. contextConfigLocation WEB-INF/ deploy-context.xml org.springframework.web.context.ContextLoaderListener CXFServlet CXF Servlet org.apache.cxf.transport.servlet.CXFServlet 1 ...