ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | celtix List | May 2006 Index

<--  Date Index  --> <--  Thread Index  -->

RE: [celtix] How to add handlers


Title: How to add handlers

Hi Richard,

 

The following changes need to be done to the sample.

 

a)     In Client.java, the client was invoking on the AddNumbersService, this is the far-end server.

Instead it should invoke upon the service in the router i.e. RouterAddNumberService.  The portName variable also needs to be updated.

The updated Client.java is attached.

b)     In the addNumbers.wsdl the routes are to be defined as below.

 

    <router:route name="RouterAddNumbers">

        <router:source port="RouterAddNumbersPort" service="tns:RouterAddNumbersService"/>

        <router:destination port="AddNumbersPort" service="tns:AddNumbersService"/>

    </router:route>

 

As per the schema in resources/schema/wsdl/routing.xsd.

The “port”  attribute takes the port defined in the wsdl service and is a xsd:string and not a xsd:QName.

 

Hence the router was not starting up the RouterAddNumbersService as it could not find the port defined in the particular service.

The updated addNumbers.wsdl is attached.

 

      c) Since the initial problem you were looking for adding handlers into the router.

I have added another target “router1” to build.xml which starts up the router and demonstrates handlers getting invoked when the client does the invocations.

 Attached is the corrp. configuration to insert the handlers celtix-router1.xml, and build.xml

 

Hope this helps.

 

Ajay


From: Shaw, Richard A [mailto:richard.shaw@xxxxxxxxxxxxxxxx]
Sent: 26 May 2006 14:30
To: celtix@xxxxxxxxxxxxx
Subject: RE: [celtix] How to add handlers

 

Thanks for that - I understand now. However, I can't get it to work.

 

I've added a zip of my samples\handlers project. I've done the following to it -

 

1 - added 2 new rules to the build router & client.router

         router - starts the router

        client.router - starts the client using the routers port number

2 - edited the wsdl file to include another service on port 9999 and a routing definition

3 - changed the name of the bus from celtix-st to celtix (not sure why I did this)

4 - to run it I do the following -

        ant server

        ant router

        ant client.router

 

and it doesn't work the client says the connection is refused.

 

I've checked my config for the client. If I change the address in the config back to 9000, it then works.

 

I started out by trying it with my real service but the router says unsupported route, so I tried this example instead, which seems to be closer to working.

 

 

Richard Shaw

¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤

Richard Shaw  
Technical Design Authority - Information Solutions Consultancy  
Intelligent Transport Systems

Atkins Highways and Transportation
Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW

Tel: +44 (0) 1372 756407 
Fax: +44 (0) 1372 740055
Mob: 07740 817586 
E-mail: richard.shaw@xxxxxxxxxxxxxxxx

www.atkinsglobal.com/its

 

 


From: Sakala, Adinarayana [mailto:ASAKALA@xxxxxxxx]
Sent: 25 May 2006 20:23
To: celtix@xxxxxxxxxxxxx
Subject: RE: [celtix] How to add handlers

Hi Richard,

 

You need to do following things inorder to build a BPMS to Legacy Relay service using Celtix Router.

 

1. First you need to define a Route in your WSDL. I havent seen your WSDL but since it is a plain vanilla SOAP/HTTP service

    The following example should work for you.

    All i did was creating a RelayService which will be used by celtix router to receive messages from BPMS to relay them to legacy backend application.

    Inorder for the Router to kickoff, I defined a router:router tag with Source and Destination for your scenario.

 

    <!-- This Service is used for BPMS Process to talk to Relay Service -->

    <service name= "RelayService">
        <port name="RelayPort" binding="tns:MySOAPBinding">
            <soap:address location="
http://localhost:9001/RelayService"/>
        </port>
    </service>

    <!-- This Service is used for Relay Service to talk to Legacy Service -->
    <service name="LegacyService">
        <port name="LegacyPort" binding="tns:MySOAPBinding">
            <soap:address location="
http://localhost:9002/LegacyService"/>
        </port>
    </service>
    <!--Route Used for BPMS to Legacy Relay  -->
    <router:route name="BPMSToLegacyRelay">
        <router:source port="RelayPort" service="tns:RelayService"/>
        <router:destination port="LegacyPort" service="tns:LegacyService"/>
    </router:route>

 

2. In the routing configuration file (samples/routing/soap_jms_http/celtix-router.xml) you need to update it to point to the above wsdl that contains routing information.

    This is just a spring configuration file that defines router specific information. Since you mentioned you wanted to add some handlers, you can just use this same configuation file to define handlers for you RelayService. Essentially what i am trying to clarify is you can just have one config file that defines both routing configuration and also handler configuration. See our Configuration documentation for more info [1]

 

3. Start the Relay Server (Router) using the config file. See the ant target that starts router in samples/routing/soap_jms_http/build.xml for example.

       <target name="router" description="run celtix router">
        <celtixrun classname="org.objectweb.celtix.routing.RouterManager" jvmarg1="-Dceltix.config.file=file:///${basedir}/celtix-router.xml" param1="-BUSid" param2="celtix-st"/>
    </target>

   If you are familiar with Ant, all this is doing is setting up the classpath and starting the router process by passing in configuration file.

   Probably Celtix should provide a Script for this :)

 

4. Make sure you BPMS client process is talking to RelayService by ensuring it uses the same soap client address that you used for Relay Service.

 

FYI, The above example and steps shows just one route. But technically you can have multiple routes in the same relay server. I never tried this but something that should work :).

 

 

Hope this helps,

 

Thanks,

Adi Sakala

-----Original Message-----
From: Shaw, Richard A [mailto:richard.shaw@xxxxxxxxxxxxxxxx]
Sent: Thursday, May 25, 2006 11:05 AM
To: celtix@xxxxxxxxxxxxx
Subject: RE: [celtix] How to add handlers

Thanks, but my real question is -

 

My BPMS process talks to my legacy software using SOAP over HTTP without me having installed any Celtix software at all. So if I add celtix-router config to the WSDL file how does it start using Celtix ?

 

Richard Shaw

¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤

Richard Shaw  
Technical Design Authority - Information Solutions Consultancy  
Intelligent Transport Systems

Atkins Highways and Transportation
Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW

Tel: +44 (0) 1372 756407 
Fax: +44 (0) 1372 740055
Mob: 07740 817586 
E-mail: richard.shaw@xxxxxxxxxxxxxxxx

www.atkinsglobal.com/its

 

 


From: Paibir, Ajay [mailto:ajay.paibir@xxxxxxxx]
Sent: 25 May 2006 13:04
To: celtix@xxxxxxxxxxxxx
Subject: RE: [celtix] How to add handlers

Hi Richard,

Yes this is possible using the Celtix-Router and defining routes for each of the BPMS Services to Legacy Services in the wsdl that need a relay server hop.

Since the BPMS and Legacy Server talk SOAP, the router will not do marshalling/unmarshalling, just pass the message on to the legacy end and back.

Regarding adding handlers, handler-chain can be defined for a wsdl service/endpoint using a bean definition.

A good start may be is to have a look at the samples in the celtix kit

Handlers – to add handlers for a particular Service/Port defined in the wsdl.

Routing/soap_jms_http – for the usage of celtix-router and defining the routes wsdl and configuration.

Ajay


From: Shaw, Richard A [mailto:richard.shaw@xxxxxxxxxxxxxxxx]
Sent: 25 May 2006 11:43
To: celtix@xxxxxxxxxxxxx
Subject: [celtix] How to add handlers

I want to add a handler to the bus to provide logging among other things, but I don't think I have a bus to connect to.

My client is an Intalio BPMS process and my server is a legacy system hosted in IIS. I'm using SOAP over HTTP to make the requests, and this is all described in a WSDL file.

So because my client and server are not written using Celtix I am assuming I don't have a Celtix bus to add handlers to.

What I was thinking was that I need a relay server which sits between these processes and is written using Celtix. The BPMS then talks to the relay server which passes the request to the legacy server. I can then add handlers to the bus. However, I don't want to create a relay process for every legacy system I have, I want to create a generic one that just passes things on without needing to interpret them.

Does what I am saying make sense ?

Is it possible to create a generic relay server ?

Richard Shaw

¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤

Richard Shaw  
Technical Design Authority - Information Solutions Consultancy  
Intelligent Transport Systems

Atkins Highways and Transportation
Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW

Tel: +44 (0) 1372 756407 
Fax: +44 (0) 1372 740055
Mob: 07740 817586 
E-mail: richard.shaw@xxxxxxxxxxxxxxxx

www.atkinsglobal.com/its

This email and any attached files are confidential and copyright protected. If you are not the addressee, any dissemination of this communication is strictly prohibited. Unless otherwise expressly agreed in writing, nothing stated in this communication shall be legally binding.

 

This message has been scanned for viruses by MailControl

Attachment: Client.java
Description: Client.java

<?xml version="1.0"?>
<project name="hello world demo" default="build" basedir=".">

    <condition property="celtix.home" value="${env.CELTIX_HOME}">
        <isset property="env.CELTIX_HOME"/>
    </condition>
    <property name="celtix.home" location="../.."/>

    <path id="routing.classpath">
        <fileset dir="${celtix.home}/lib">
            <include name="celtix-router-*.jar"/>
        </fileset>
        <pathelement location="${basedir}"/>
    </path>

    <property name="thirdparty.classpath" refid="routing.classpath"/>

    <import file="../common_build.xml"/>

    <target name="client" description="run demo client" depends="build">
        <celtixrun classname="demo.handlers.client.Client" param1="${basedir}/wsdl/addNumbers.wsdl" jvmarg1="-Dceltix.config.file=file:///${basedir}/celtix-client.xml"/>
    </target>

    <target name="server" description="run demo server" depends="build">
        <celtixrun classname="demo.handlers.server.Server" param1="${basedir}/wsdl/addNumbers.wsdl" jvmarg1="-Dceltix.config.file=file:///${basedir}/celtix-server.xml"/>
    </target>

    <target name="client.router" description="run demo client through router" depends="build">
        <celtixrun classname="demo.handlers.client.Client" param1="${basedir}/wsdl/addNumbers.wsdl"
		jvmarg1="-Dceltix.config.file=file:///${basedir}/celtix-client-router.xml"/>
    </target>

    <target name="client2" description="run demo client with out handlers" depends="build">
        <celtixrun classname="demo.handlers.client.Client" param1="${basedir}/wsdl/addNumbers.wsdl"/>
    </target>

    <target name="server2" description="run demo server with out handlers" depends="build">
        <celtixrun classname="demo.handlers.server.Server" param1="${basedir}/wsdl/addNumbers.wsdl"/>
    </target>

    <target name="generate.code">
        <echo level="info" message="Generating code using wsdl2java..."/>
        <wsdl2java file="addNumbers.wsdl"/>
    </target>

    <target name="router" description="run celtix router">
        <celtixrun classname="org.objectweb.celtix.routing.RouterManager"
		jvmarg1="-Dceltix.config.file=file:///${basedir}/celtix-router.xml"
		param1="-BUSid" param2="celtix"
		logging-properties-file="./etc/logging.properties"/>
    </target>

    <target name="router1" description="run celtix router">
        <celtixrun classname="org.objectweb.celtix.routing.RouterManager"
		jvmarg1="-Dceltix.config.file=file:///${basedir}/celtix-router1.xml"
		param1="-BUSid" param2="celtix"
		logging-properties-file="./etc/logging.properties"/>
    </target>

</project>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans SYSTEM "http://celtix.objectweb.org/configuration/spring/celtix-spring-beans.dtd";>

<beans
    xmlns:ct="http://celtix.objectweb.org/configuration/types";
    xmlns:rt-conf="http://celtix.objectweb.org/routing/configuration";
    xmlns:jaxws-types="http://celtix.objectweb.org/bus/jaxws/configuration/types";
>

  <!-- configuration for the pass through router in soap_jms_http demo -->

  <!-- to specify non-default configuration for a configurable component, supply a bean definition for this
       component with

       Class: the class name of the bean is derived from the namespace uri of the component's configuration
       in the following way:
       The namespace uri is converted into a package name. To this, the suffix 'spring' is appended, and
       finally the actual class name obtained by converting the last part of the package name into a class name
       and suffixing it with 'Bean'.
       Example:
       The namespace uri for the Routing component configuration is
           http://celtix.objectweb.org/routing/configuration
       The resulting bean class is
           org.objectweb.celtix.routing.configuration.spring.ConfigurationBean

       Id: a unique identifier for the instance of the configurable component represented by the bean
       The implementation for this is component specific, e.g. for the Bus component it is the bus's id
       (default: celtix), for Service components it the id of the bus, followed by a '.' and the id for the Router
       which is "router".

       The actual component's configuration then is composed of <property> elements, the name attribute of which
       must be the name of one of the component's configuration items.
       The (non-default) value for that item can be specified either as text (if this is possible, e.g. for
       strings) or as the content of the <value> element.

       In case of the router configuration the property name is routesWSDL and takes a string value representing a
       path to the wsdl which defines the route elements.

       Refer to the component configuration metadata (e.g. to router-config.xml) for more information
       about possible values.
  -->

  <bean id="celtix.router"
        class="org.objectweb.celtix.routing.configuration.spring.ConfigurationBean">

      <property name="routesWSDL">
          <value>
              <rt-conf:wsdlUrl>
                  <rt-conf:url>/wsdl/addNumbers.wsdl</rt-conf:url>
              </rt-conf:wsdlUrl>
          </value>
      </property>
  </bean>

<!--Server Side Handler-->
  <bean id="celtix.{http://www.objectweb.org/handlers}RouterAddNumbersService"; class="org.objectweb.celtix.bus.jaxws.endpoint_config.spring.EndpointConfigBean">

      <property name="handlerChain">
          <value>
              <jaxws-types:handler-chain>
                 <jaxws-types:handler>
                      <jaxws-types:handler-name>File Logging Handler</jaxws-types:handler-name>
                      <jaxws-types:handler-class>demo.handlers.common.FileLoggingHandler</jaxws-types:handler-class>
                  </jaxws-types:handler>
              </jaxws-types:handler-chain>
          </value>
      </property>

  </bean>

 <!--Client Side Handler-->
  <bean id="celtix.{http://www.objectweb.org/handlers}AddNumbersService/AddNumbersPort"; class="org.objectweb.celtix.bus.jaxws.port_config.spring.PortConfigBean">

      <property name="handlerChain">
          <value>
              <jaxws-types:handler-chain>
                 <jaxws-types:handler>
                      <jaxws-types:handler-name>Small Number Handler</jaxws-types:handler-name>
                      <jaxws-types:handler-class>demo.handlers.common.SmallNumberHandler</jaxws-types:handler-class>
                      <jaxws-types:init-param>
                          <jaxws-types:param-name>arg1</jaxws-types:param-name>
                          <jaxws-types:param-value>value1</jaxws-types:param-value>
                      </jaxws-types:init-param>
                      <jaxws-types:init-param>
                          <jaxws-types:param-name>arg2</jaxws-types:param-name>
                          <jaxws-types:param-value>value2</jaxws-types:param-value>
                      </jaxws-types:init-param>
                  </jaxws-types:handler>
              </jaxws-types:handler-chain>
          </value>
      </property>

  </bean>

</beans>

Attachment: addNumbers.wsdl
Description: addNumbers.wsdl



<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.