Results 1 to 3 of 3

Thread: XFire and Service Registries

  1. #1

    Unhappy XFire and Service Registries

    Here's quite an interesting issue.

    I would like to use XFire with some Service Registry. (Sun Service's Registry for instance).

    To invoke a webService, using XFire in every samples I found, you find simply the url of WSDL.


    Code:
    <bean id="mySampleService" class="org.codehaus.xfire.spring.remoting.XFireClientFactoryBean">
        <property name="serviceClass">
          <value>fr.celphys.SampleServiceClass</value>
        </property>
        <property name="wsdlDocumentUrl">
          <value>http://localhost:8080/xfire/SampleService?WSDL</value>
        </property>
    </bean>
    Now imagine that to you "register" your service definition in a service registry. In many companies using Service Oriented Architecture it's more and more common. Instead of having the WDSL url, Xfire will have unique id called the URN or URI.

    By searching the service registry, you could retrieve the WSDL url I think,and then inject it to the XFire Servlet to populate your bean.

    I use Sun Service's registry to register my service.
    There is the JAXR (Java Api for XML Registries) contained in JWSDP could help me to search the regitry to find the correct.

    So I will try to develop my own serviceProvider extending the XFireClientFactoryBean create Client, something like

    Code:
    <bean id="mySampleService" class="fr.celphys.remoting.ServiceRegistryFactoryBean">
        <property name="serviceClass">
          <value>fr.celphys.SampleServiceClass</value>
        </property>
        <property name="registryUrl">
          <value>${registry.url}</value>
        </property>
        <property name="registryUserName">
          <value>${registry.username}</value>
        </property>
        <property name="registryUserPassword">
          <value>${registry.password}</value>
        </property>
        <property name="registryURI">
          <value>${registry.uri.sampleservice}</value>
        </property>
    </bean>
    If there won't be any other solution I'll develop the code and post it but it makes me feel that i try to re develop something existing. Maybe there is another solution to user XFire and UDDI or Registry.

    Any idea ? Is my way of thinking is the bad one ?
    Last edited by Celphys; Sep 7th, 2007 at 11:09 AM.

  2. #2

    Default Further informations

    No much success with this post.

    I search the web to find out a solution for my problem but I didn't find any correct solution. I only have a service registry to query to get the metadata of a service (as the wsdl url)

    Celtix or now CXF register EndPoints in the definition file with the tag <jaxws:endpoint ...> and define an id for the service. I don't want to use that way nor the Apache ServiceMix.

    As a result i will develop first a BeanFactoryPostProcessor. It will be 'transparent' for XFire.

    Later I probably use a ProxyFactoryBean using aop to override setting "wsdlDocumentUrl" property. Next time I post the sources.

  3. #3

    Smile

    Here the solution :

    I developped a BeanFactoryPostProcessor. Let's call it a "RegistryPlaceHolderConfigurer".

    I inject a bean to retrieve availables services in Registry. I called it "RegistryMetaDataProvider".

    Imagine I have published a service in my registry. "dummyService"
    It's URI in registry could be : //FOOCOMPANY/FOODEPARTMENT/FOOAPPLICATION/DUMMY

    Note : thanks to registry we can easily configure both security and versioning.

    I use to externalize environment constants using a properties file. Let's call it
    dev-configuration.properties :

    Code:
    # Sample registry configuration
    conf.registry.username=...
    conf.registry.password=...
    conf.registry.host=...
    conf.registry.port=...
    # Sample service declaration
    soa.service.dummyURI=//FOOCOMPANY/FOODEPARTMENT/FOOAPPLICATION/DUMMY
    Beginning of the Spring Definition File :

    Code:
    <bean id="myPropertyPlaceHolder" class="org.springframework.beans.factory.config.PropertyPlaceHolderConfigurer">
    <property name="order" value="1">
    <property name="locations">
     <value>dev-configuration.properties</value>
    </property>
    </bean>
    
    <bean id="myRegistryPlaceHolder" class="package.MyRegistryPlaceHolderConfigurer">
    <property name="order" value="2" />
    <property name="registryMetaDataProvider" ref="myRegistryMetaDataProvider" />
    </bean>
    
    <bean id="myRegistryMetaDataProvider" class="package.MyRegistryMetaDataProvider">
    <property name="host">
     <value>${conf.registry.host}</value>
    </property>
    <property name="username">
     <value>${conf.registry.username}</value>
    </property>
    <property name="password">
     <value>${conf.registry.password}</value>
    </property>
    <property name="port">
     <value>${conf.registry.port}</value>
    </property>
    And finally the definition of a service using XFIRE when the WSDL url is published in a Registry :

    Code:
    <bean id="myDummyService" class="org.codehaus.xfire.spring.remoting.XFireClientFactoryBean">
        <property name="serviceClass">
          <value>package.service.DummyService</value>
        </property>
        <property name="wsdlDocumentUrl">
          <value>@registry{${soa.service.dummyURI}}</value>
        </property>
         [... outhandlers...serviceFactory....]
    </bean>
    It works perfectly.
    Hope this help someone, one day.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •