I have just started learning CXF. I made a maven archetype project through eclipse. When I run the maven build and deployed in the JBoss its working fine.
@WebService
public interface HelloWorld {
String sayHi(String text);
}
@WebService(endpointInterface = "foo.HelloWorld" )
public class HelloWorldImpl implements HelloWorld {
public String sayHi(String text) {
return new "Hello"+text;
}
}
Then I created an Employee class, with name and salary as its field with getter and setters. And I just changed the return type of HelloWorld sayHi’s method to Employee and I returned an Employee Object from HelloWorldimpl sayHi Method.
Then also it is working fine (I mean I checked it using SOAP UI, after modifying the code I am getting an Employee xml)
Where is this transformation code written.
Also I didn’t find cxf.xml and cxf-servlet.xml in the code: (Where are these xml kept in the code)
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
Please help me to understand this.
@ŁukaszBachman I got the XML files in the CXF*.jar file.
What should I do to make an extension in this project. Do I need to add the beans in the xml files?
you are obviously using CXF with Spring to import resources defined on CLASSPATH. This means, that Spring will try to import any kind of beans defined in provided two files (cxf.xml and cxf-servlet.xml).
Classloader will load all libraries defined for your web application (/WEB-INF/lib directory) when servlet container starts it. Then it will start Spring framework (defined in /WEB-INF/web.xml). When spring is loaded it will try to create all Beans defined for your webapp, so it will analyse your own application context just to find out, that it also needs to import some resource located in
META-INF/cxf/cxf.xmlon classpath. So it will look for it, once again, in all libraries located in/WEB-INF/lib.That is why you don’t see those two files in your project. They are provided by CXF library (cxf.jar). You might want to check it out yourself, just open cxf.jar as a regular ZIP file and browse to
/META-INF.Final remark, those two files are provided by CXF framework, so you probably don’t need to modify it. You might just have a look at it, if it will help you out to understand CXF internals.