On Dec 4, 2007 8:57 AM, Christian Jauss <[EMAIL PROTECTED]>
wrote:

> Hi Tuscany-users,
>
> I'm currently trying to implement a Web Map Service as a Service Component
> following SCA. At the moment I have the problem that I don't know how to
> get the http request information, especially the URL, inside the java
> implementation.
> As I know the entry point interface gets the annotation "Service", but
> this annotation doesn't say anything about the protocol of the service.
> Unfortunately I can't found any information to that inside the library
> "tuscany-sca-all-1.0-incubating.jar" or the internet.
> Can anybody help me with that problem? I have to run the Service at the
> end of the week.
>
> Best regards,
> Christian Jauss
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> Hi Christian

In SCA components are built and described independently of how the component
interfaces are exposed as services. So, for example, we can take a look at
our calculator sample [1]. If you look inside this sample you will find the
SCA composite file [2] that describes the components in the application and
the way that these components are wired together through their references
and services. You can see here how the CalculatorServiceComponent is wired
to the AddServiceComponent using the attribute target="AdServiceComponent"
on the addService reference of the CalculatorServiceComponent .

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
           targetNamespace="http://sample";
           xmlns:sample="http://sample";
           name="Calculator">

    <component name="CalculatorServiceComponent">
                <implementation.java class="calculator.CalculatorServiceImpl"/>
        <reference name="addService" target="AddServiceComponent" />
    </component>

    <component name="AddServiceComponent">
        <implementation.java class="calculator.AddServiceImpl"/>
    </component>


It's important to note that there is no description here of what protocols
are used to allow the CalculatorServiceComponent and AddServiceComponent to
communicate. SCA will use a default protocol to make this happen.  If we
want to be explicit about protocols, perhaps because we want our services to
be accessible by other applications, we can go ahead an define some explicit
bindings for the services that are provided. for example, from the
calculator-ws-webapp sample [3]

    <component name="CalculatorServiceComponent">
                <implementation.java class="calculator.CalculatorServiceImpl"/>
        <reference name="addService" >
           <interface.java interface="calculator.AddService" />
            <binding.ws
uri="http://localhost:8080/sample-calculator-ws-webapp/AddServiceComponent"/>
        </reference>
        <reference name="subtractService"
target="SubtractServiceComponent"></reference>
        <reference name="multiplyService"
target="MultiplyServiceComponent"></reference>
        <reference name="divideService"
target="DivideServiceComponent"></reference>
    </component>

    <component name="AddServiceComponent">
        <implementation.java class="calculator.AddServiceImpl"/>
        <service name="AddService">
             <interface.java interface="calculator.AddService" />
            <binding.ws/>
        </service>
    </component>


You will note that CalculatorServiceComponent and AddServiceComponent now
communicate over web services. We could equally have used any other protocol
that Tuscany SCA currently supports. Let's change it to RMI.


    <component name="CalculatorServiceComponent">
                <implementation.java class="calculator.CalculatorServiceImpl"/>
        <reference name="addService" >
           <interface.java interface="calculator.AddService" />
            <tuscany:binding.rmi host="localhost" port="8099"
serviceName="AddService"/>
        </reference>
        <reference name="subtractService"
target="SubtractServiceComponent"></reference>
        <reference name="multiplyService"
target="MultiplyServiceComponent"></reference>
        <reference name="divideService"
target="DivideServiceComponent"></reference>
    </component>

    <component name="AddServiceComponent">
        <implementation.java class="calculator.AddServiceImpl"/>
        <service name="AddService">
             <interface.java interface="calculator.AddService" />
            <tuscany:binding.rmi host="localhost" port="8099"
serviceName="AddService"/>
        </service>
    </component>


I'm trying to demonstrate here that a component doesn't know what binding
its services are exposed using or indeed what binding its references talk to
services over. Hence we don't have APIs which give a component
implementation access to details known only to the binding, for example,
what URL an HTTP request arrives on when the binding uses HTTP. If such
information is needed in the component it should come in through the service
interface.

Maybe you could say a little more about the information that you Web Map
Service needs to operate on and how you intend to map this to a component.

Regards

Simon

[1]
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/samples/calculator/
[2]
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/samples/calculator/src/main/resources/Calculator.composite
[3]
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/samples/calculator-ws-webapp/src/main/resources/Calculator.composite

Reply via email to