The domain URI depicts which Tuscany SCA service registry to use to resolve 
remote endpoints by the service URI (componentName/serviceName/bindingName). By 
default, the domain URI is "default". To make remote endpoint descriptions 
available to a node, there are a few different ways:

* Use a distributed registry such as Hazelcast to broadcast 

* Use a static definition in node.xml, for example:

<?xml version="1.0" encoding="UTF-8"?>
<node xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"; 
xmlns="http://tuscany.apache.org/xmlns/sca/1.1";
    xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"; 
uri="appserver/node" domainRegistry="vm:default"
    domain="default">

    <!-- Configure the base URIs for a given binding -->
    <!-- Each base URI is for a protocol supported by the binding -->
    <binding name="sca:binding.ws" baseURIs="http://localhost"; />
    <binding name="tuscany:binding.http" baseURIs="http://localhost"; />
    <binding name="tuscany:binding.rest" baseURIs="http://localhost"; />
    <binding name="tuscany:binding.jsonrpc" baseURIs="http://localhost"; />

    <!-- Configure a list of contributions -->
    <contribution uri="contribution1" location="WEB-INF/classes" />


    <remoteEndpoints>
        <sca:composite 
targetNamespace="http://tuscany.apache.org/xmlns/sca/1.1"; name="Endpoint">
            <sca:component name="XComponent">
                <sca:service name="XResource">
                    <tuscany:binding.rest name="rest" 
uri="http://sample.com/services/x"; />
                </sca:service>
            </sca:component>
            <sca:component name="YComponent">
                <sca:service name="YService">
                    <tuscany:binding.jsonrpc name="jsonrpc"
                        uri="http://sample.com/services/yservice-jsonrpc"; />
                </sca:service>
            </sca:component>
        </<sca:composite>
        </remoteEndpoints>
</node>

Then in WEB-INF/web.xml, define the following:

    <context-param>
        <param-name>node.configuration</param-name>
        <param-value>/node.xml</param-value> <!-- relative to the root of the 
web app -->
    </context-param>

   <filter>
        <filter-name>tuscany</filter-name>
        <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter 
</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>tuscany</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>


Thanks,
Raymond


On Aug 20, 2012, at 6:04 PM, binhnt22 wrote:

> Hi Raymond,
>  
> This is a web application, I don’t know what to put into domainURI
>  
> Best regards
>  
> From: Raymond Feng [mailto:enjoyj...@gmail.com] 
> Sent: Monday, August 20, 2012 11:17 PM
> To: user@tuscany.apache.org
> Subject: Re: Call Tuscany 2.0 service from JBPM 5 WorkItemHandler
>  
> You can use the SCAClient API, such as:
>  
> SCAClientFactory clientFactory = 
> SCAClientFactory.newInstance(URI.create(domainURI); // 
> MyService service = clientFactory.getService(MyService.class, serviceURI);
>  
> On Aug 19, 2012, at 7:59 PM, binhnt22 wrote:
> 
> 
> Hi all,
> With Tuscany 1.6.2, I can make call to Tuscany service from WorkItemHandler 
> through DomainManager class.
> As far as I know, DomainManager class is not present in Tuscany 2.0.
> How can I achieve that with Tuscany 2.0 (calling Tuscany Service from a 
> random java class).
> Best regards,

Reply via email to