tuscany-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Millies, Sebastian" <Sebastian.Mill...@softwareag.com>
Subject Dynamic service references ?
Date Wed, 16 Nov 2011 09:40:15 GMT
Hello there,

can references in composite files somehow be made dynamic? In particular, can I define or
override
the endpoints in a web service reference at run time?

My question pertains to Tuscany 1.6.

Let me go into some detail to explain the real problem I want to solve. I have a set of items
that need
to be sent to SAP backend systems. These SAP systems expose the same interface (remote function
modules and web services). Every item has an endpointProperties attribute that determines
which
system it needs to go to.

Currently, this is done outside of Tuscany: The connection is created on the fly using SAP
Java Connector
(JCo) exploiting the endpointProperties. A remote call is made through this connection using
SAP’s proprietary
RFC protocol.

I’d like to change this to a service-based setup with Tuscany, exploiting SAP web services.
The motivation for this
is twofold: First it removes  a dependency on proprietary technology (including native code),
second it opens up
the possibility to connect in a generic way to non-SAP systems that offer compatible interfaces
.

So on my side (the Tuscany SAP client side) I go through the usual steps:

a)      expose function module as a web service

b)      get the wsdl

c)       use wsimport to create a service interface from the wsdl

d)      remove JAX-WS annotations, make interface remotable, and ensure method names are identical
to operation names in wsdl

e)      add an attribute of the interface type to my service implementation and annotate it
with @Reference

f)       define the reference to the SAP service in my composite file

I understand (correctly, I hope, I have not tested this) that I can override whatever endpoint
is specified in the wsdl by
specifying the uri attribute on the web service binding. Here’s a snippet from an example
composite file:

  <sca:reference name="bapiCostcenterGetList" promote="servercomponent/bapiCostcenterGetList">
       <sca:interface.java interface="bapi.ZWSBAPICOSTCENTERGETLIST"/>
       <!--  wsdlElement="<TargetNamespace>#wsdl.port(<SvcName>/<PortName>)"
-->
       <sca:binding.ws wsdlElement="urn:sap-com:document:sap:rfc:functions#wsdl.port(ZWS_BAPI_COSTCENTER_GETLISTService/ZWS_BAPI_COSTCENTER_GETLIST)"
       <!--  Override service endpoint -->
       uri="http://sapd01.me.corp.ids-scheer.com:8000/sap/bc/srt/rfc/sap/zws_bapi_costcenter_getlist/100/zws_bapi_costcenter_getlist/zws_bapi_costcenter_getlist"
/>
    </sca:reference>

As compared to the dynamic approach with hard-coded RFC calls, the connection endpoint is
now hard-wired in the composite file.
Is there a way to define Tuscany web service references with dynamic endpoints? Or alternatively,
could I perhaps use the endpointProperties
and modify the injected service proxy before making a remote call? Or is  there some entirely
different route that does not involve steps a) to f) above?

How would you deal with this type of situation?


n  Sebastian
IDS Scheer Consulting GmbH
Geschäftsführer/Managing Directors: Kamyar Niroumand, Ivo Totev
Sitz/Registered office: Altenkesseler Straße 17, 66115 Saarbrücken, Germany - Registergericht/Commercial
register: Saarbrücken HRB 19681
http://www.softwareag.com

Mime
View raw message