Maven + Apache Felix + CXF + DOSGi: An Example of DOSGi Service
Link in series
Link to two Felix instances
Here is yet another post in Maven + Apache Felix + CXF + DOSGi series.
Here I will show how to use Apache CXF DOSGi for cosuming remote services. You may see the sources on my GitHub account.
We will have
Maven + Apache Felix + CXF: Securing a Service with HTTP Basic Authentication
This is another post in series Maven + Apache Felix + CXF + DOSGi Series. Here I will describe how to secure CXF published web services with HTTP basic authentication. You can find the sources on my GitHub account.
We will have three projects here. The first one defines an interface for a service. Another one provides implementation for it. And the third one will provide security.
dosgiSecurity
dosgiSecurity-api
dosgiSecurity-impl
dosgiSecurity-security
dosgiSecurity will be just a holder project.
Our interface HelloService in bundle dosgiSecurity-api will be similar to the one we defined in
Maven + Apache Felix + CXF: RESTful Webservice with CXF. Using POST.
It is another post in Maven + Apache Felix + CXF + DOSGi Series.
In this post I showed you how to create a RESTful webservice consuming and creating a String. However, the example was using @GET method. Here I will show, what changes need to be done in order to consume input from @POST. As usual, sources are available in the end of the post.
Simply change @GET to @POST and remove
CXF RESTful Webservices: Running on a Different Port
This is a short post in Maven + Apache Felix + CXF + DOSGi Series
If you want webservices to be published on a different port, add the following to your config.properties:
org.osgi.service.http.port=8081
And also change the publishing line in the Activator:
restProps.put("org.apache.cxf.rs.address", "http://localhost:8081/");
Maven + Apache Felix + CXF: Creating a RESTful Webservice with CXF. Consuming an Object
This is the following post in Maven + Apache Felix + CXF + DOSGi series.
Here we continue working with RESTful webservices. In the last post I showed how to returne an Object in XML with JAXB, and this post will based on it. In this post I will show how to consume an object. The title is rather misleading, but what I meant is "consuming XML and converting it to an object". Again, it is assumed that you followed the setup from the first post in the series. You will find attached sources in the end of the post.
We will have the same Felix Launcher project as in the previous post. To remind you, we will use
Maven + Apache Felix + CXF: Creating a RESTful Webservice with CXF. Returning and Object.
It is another post in series Maven + Apache Felix + CXF + DOSGi.
This example is based on a post about simple JAX-RS webservice with CXF. But this post describes a way how to return a more complex object, instead of a String.
First, we create a class in our test.bundle bundle MyMessage in package test.bundle:
package test.bundle;
public class MyMessage {
private String message;
public MyMessage(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
}
We will return this object in XML format to REST webservice requester. We will use
Maven + Apache Felix + CXF: Creating a RESTful Webservice with CXF. A Simple String Example.
This is next post in Maven + Apache Felix + CXF + DOSGi series.
This is example is based on the sample application developed in previous post. Again, it is assumed here that you are using M2Eclipse plugin, if you want to run examples from Eclipse.
As usual, source is included in the end of the post.
First of, we need to
Axis2: Removing Namespace from SOAP Response
By default Axis2 will return a response with namespace, for example:
<ns1:return xmlns:ns1="http://ws.portal._3dfacto.com/">
<response>
<status>Situation normal: all fucked up</status>
</response>
</ns1:return>
In order to remove it in services.xml add elementFormDefaultQualified to the schema tag:
<schema schemaNamespace="http://maksim.sorokin.dk/" elementFormDefaultQualified="false" />
So you will have the following SOAP response:
<return>
<response>
<status>Situation normal: all fucked up</status>
</response>
</return>
Taken from here
Axis2 + Guice + Maven + Servlets
In this post I will continue Axis2 + Maven + Servlets + Tomcat topic. I will refer to it as previous post, because some stuff will be repeated. I will show how to have Google Guice dependency injection in Axis2 webservices.
I will reuse technique from sagara's Blog. It works perfectly, but it can be improved a little.
The same Axis2 wsdl generation technique will be used, so I will not refer to it again.
Again, we start by our
JAX-WS web services + Maven + Tomcat
There is an awesome article about Deploy JAX-WS web services on Tomcat. It describes how to have a web service running without much effort.
We will follow the article and do the same, but with three differences:
- We will build it with Maven
- We will omit interface in the web service
- We will not copy jars to the Tomcat. All dependencies will be managed by Maven
Let's start by creating a fresh maven project jaxwsExample. pom.xml will contain single