We used to have templates for composites and replace at runtime from 
configuration and create Node by the following way ...It worked perfectly 
without any issue

public SCANode getSCANodeWrapper(String compositeName, String compositeXml)
                                                throws Exception {
                                logger.debug("Create SCA Node for " + 
compositeName + " with compositeXml:\n"
                                                                + compositeXml);

                                // create contribution object
                                String contribName = compositeName + 
"-contribution.xml";
                                String contribLocation = 
System.getProperty("sca.node.contrib.location");
                                if(contribLocation==null || 
contribLocation.equals("")) {
                                                contribLocation = 
getContributionJarFile();
                                }
                                logger.info("Contribution location 
...."+contribLocation);
                                SCAContribution  contrib1 = new 
SCAContribution(contribName, contribLocation);

                                // create SCA Node
                                SCANode node = 
SCANodeFactory.newInstance().createSCANode(compositeName, compositeXml,
                                                contrib1);

                                return new node;
                }

Regards
Raman

From: Raymond Feng [mailto:[email protected]]
Sent: Wednesday, October 26, 2011 5:13 AM
To: [email protected]
Subject: Re: How to externalize the webservice reference URL?

Good question!

We ran into the same issue here. Tuscany SCA doesn't have a built-in way to 
handle the externalization of such configuration. We end up doing the 
substitution using some kind of scripts.

Similar frameworks such as Spring provides some support for the env/profile 
based customizations. Maybe we should do something is Tuscany to support that. 
One idea could be the StAXArtifactProcessor to pre-process the composite files 
before XML parsing.

Thanks,
Raymond
________________________________________________________________
Raymond Feng
[email protected]<mailto:[email protected]>
Apache Software Foundation Member
Apache Tuscany PMC member and committer: 
tuscany.apache.org<http://tuscany.apache.org>
Co-author of Tuscany SCA In Action book: 
www.tuscanyinaction.com<http://www.tuscanyinaction.com>
Personal Web Site: www.enjoyjava.com<http://www.enjoyjava.com>
________________________________________________________________

On Oct 25, 2011, at 1:43 PM, Melinamani, Sanjay wrote:


Hi,
I like to externalize the webservice reference URL to a property file.
Example if I have the following composite, I like to read the URI from a 
property file since the URI changes from DEV to QA to PROD env. Let me know how 
this can be done?

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
                targetNamespace="http://helloworld";
                xmlns:hw=http://helloworld name="helloworldws">
    <component name="HelloWorldServiceComponent">
        <implementation.java class="helloworld.HelloWorldImpl" />
                    <service name="HelloWorldService">
                        <interface.wsdl 
interface="http://helloworld#wsdl.interface(HelloWorld)" />
                        <binding.ws 
uri="http://localhost:8085/HelloWorldService"/>
                    </service>
    </component>
</composite>

Thanks
Sanjay


Reply via email to