You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Bruce Snyder <br...@gmail.com> on 2007/08/16 22:55:08 UTC

Re: Service Engine Exposed as a web service

On 7/30/07, SriB <sr...@avocent.com> wrote:
>
> Hi Guys!
>
> I posted this before, but the post did not show up (not yet anyway..) so
> forgive me for posting again, just in case.
>
>
> I have a Service Engine that I want exposed as a web service.
>
> I created the following:
>
> 1.  A SU with a consumer http bc
> 2.  An SU for the service engine
> 3. A Service assembly with the above two.
>
> Now, for 2, what should the SU xbean look like?  I also created a WSDL as
> part of the SE's SU. But not sure what the xbean would look like for it.

This will require an annotation on the Service Engine's endpoint class
for XBean so that you can create the xbean.xml. There are a few steps
to achieving this, so I'll go over them below:

1) Add the maven-xbean-plugin in the pom.xml for your project. This
obviously requires that you build your project using Maven 2. Below is
an example of the syntax to be added to the build/plugins element:

          <plugin>
            <groupId>org.apache.xbean</groupId>
            <artifactId>maven-xbean-plugin</artifactId>
            <version>3.1</version>
            <executions>
              <execution>
                <configuration>
                  <type>service-engine</type>
                  <component>com.mycompany.foo.MyComponent</component>
                  <namespace>http://foo.mycompany.com/1.0</namespace>
                </configuration>
                <goals>
                  <goal>mapping</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

The component element above contains the fully qualified name of the
Component class for the SE. The namespace element can be anything you
want as long as it conforms to the XML Namespaces spec. The example
namespace above is simply the package path and version which is very
common in the Java world.

2) On the endpoint class, you will need to add an XBean annotation.
Below is an example of the annotation:

@org.apache.xbean.XBean element="endpoint"

The string 'endpoint' can be anything you like. The most common name
is simply endpoint but I recommend using something unique.

3) Upon building the SE project, you will see the target/xbean
directory is created. This holds all the items that are generated by
XBean to make writing the xbean.xml file easier.

4) Create the xbean.xml configuration file. You will need to use the
namespace from above as well as the element name. Below is an example
of this:

<beans xmlns:foo="http://foo.mycompany.com/1.0">
  <foo:endpoint abc="xyz" />
</beans>

The foo:endpoint element is then pointing to your Endpoint class and
calling a setting on it named setAbc with a value of xyz.

I just threw this together quickly, so hopefully I haven't forgotten
anything and hopefully it makes sense. Please let me know if you have
any questions.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/
Castor - http://castor.org/