6.03. Intermediate - Creating the HTTP SU

We are going to expose our EJB service using HTTP component (consumer mode).

The Maven pom.xml

As for the CXF SU, we create the HTTP SU pom.xml :

pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.apache.servicemix.examples</groupId>
    <artifactId>ejb-example</artifactId>
    <version>1.0-SNAPSHOT</version>
  </parent>

  <groupId>org.apache.servicemix.examples</groupId>
  <artifactId>ejb-http-su</artifactId>
  <packaging>jbi-service-unit</packaging>
  <name>Apache ServiceMix :: Examples :: EJB :: HTTP SU</name>

  <dependencies>
    <dependency>
      <groupId>org.apache.servicemix</groupId>
      <artifactId>servicemix-http</artifactId>
      <version>2008.01</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
       <plugin>
         <groupId>org.apache.servicemix.tooling</groupId>
         <artifactId>jbi-maven-plugin</artifactId>
         <version>3.2.3</version>
         <extensions>true</extensions>
       </plugin>
    </plugins>
  </build>

</project>

JBI xbean.xml

Now we create our SU XBean descriptor in the src/main/resources directory :

xbean.xml
<beans xmlns:http="http://servicemix.apache.org/http/1.0"
       xmlns:myService="http://www.example.com/myService">

  <http:soap-consumer service="myService:my-service-http"
                      endpoint="myService:my-service-soap"
                      targetService="myService:my-service-ejb"
                      targetEndpoint="EJBImpl"
                      locationURI="http://0.0.0.0:8181/myService"
                      wsdl="classpath:myService.wsdl"
                      validateWsdl="no"/>

</beans>

The "fake" WSDL

Even if the WSDL is not required (the WSDL is generated from the EJB interface and implementation as we use @WebService annotation), a kind of "fake" WSDL is required.

It looks like this :

myService.wsdl
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:ns1="http://cxf.apache.org/transports/jbi"
                  xmlns:tns="http://www.exemple.com/myService"
                  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap12/"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  name="my-service-soap"
                  targetNamespace="http://www.exemple.com/myService">

  <wsdl:types>
    
  </wsdl:types>

</wsdl:definitions>