Hi Simon,
Thanks for the pointers, I've taken a trawl through some more code, and
have a couple more questions if you don't mind ...
Hi Folks,
I'm brand new to Tuscany, and I've been working my way through the
documentation on the website. I don't use Eclipse, but much of the
documentation is geared towards using the Eclipse plugin to start the
tuscany application server. I can't find documentation on how to do this
/without/ eclipse, can someone point me in the right direction?
I'm trying to do the very basic "Hello World" example.
Is there perhaps a TuscanyServlet that I can set in my own web.xml, and do
my normal deployment through tomcat?
Cheers,
Richard
Hi Richard. Welcome to Tuscany.
There are a few words about how to develop an SCA application from the
command line in [1] but it doesn't cover doing webapp development. You could
take a look at one of the Tuscany samples that do this. For example, look in
samples/calculator-webapp [2]. You will see that the basic layout of this
webapp is that an SCA application (the calculator sample) is packaged as a
webapp and a jsp is fired up and makes a call to the Calculator component
described in the SCA composite file [3]. The web.xml file in this case
defines a servlet filter as follows.
OK, I see, it uses an SCADomain created by the TuscanyServletFilter, and
pulls the appropriate service out of that:
SCADomain scaDomain = (SCADomain)
application.getAttribute("org.apache.tuscany.sca.SCADomain");
CalculatorService calculatorService =
(CalculatorService)scaDomain.getService(CalculatorService.class,
"CalculatorServiceComponent");
So the bit I'm stuck on here is how to create the SCADomain for the
HelloWorld example automatically:
http://tuscany.apache.org/build-your-first-web-services-with-tuscany.html
It looks as though the Eclipse plugin can take the HelloWorld.composite
and turns it into a web application without having to add this extra
layer of a ServletFilter and a JSP. The differences that I can see are
that the Calculator.composite doesn't define a service, and instead the
TuscanyServletFilter is reading in that file and then making itself the
effective web-service interface. Meanwhile, the HelloWorld example has
a different kind of definition:
<component name="HelloWorldComponent">
<implementation.java class="hw.HelloWorldImpl"/>
<service name="HelloWorld">
<binding.ws uri="http://localhost:8080/HelloWorld"/>
</service>
</component>
The Eclipse plugin looks like it understands how to take this service
binding and turn it into an actual service. I think what I need to know
is how to deploy this particular type of composite definition (although
I'm also possibly off base here).
I tried writing a Launch class as per:
http://tuscany.apache.org/getting-started-with-tuscany.html
which basically did:
public static void main(String[] args)
throws Exception
{
SCADomain scaDomain = SCADomain.newInstance("HelloWorld.composite");
System.in.read();
scaDomain.close();
}
But this is throwing exceptions:
Exception in thread "main" org.osoa.sca.ServiceRuntimeException:
org.osoa.sca.ServiceRuntimeException:
java.lang.IllegalArgumentException: Composite not found:
HelloWorld.composite
That last part might be a classpath problem* which I haven't figured out
yet, but supposing it didn't balk, is this the right approach to
launching the application?
* - what mechanism does SCADomain.newInstance use to locate the
resource? is it just a Class.getResource or somesuch?
Cheers,
Richard
--
=======================================================================
Richard Jones | Hewlett-Packard Limited
Research Engineer, HP Labs | registered office:
Bristol, UK | Cain Road, Bracknell,
| Berks, RG12 1HN.
| Registered No: 690597 England
eml: [EMAIL PROTECTED] -------------------------------------
blg: http://chronicles-of-richard.blogspot.com/
-----------------------------------------------------------------------
The contents of this message and any attachments to it are confidential
and may be legally privileged. If you have received this message in
error, you should delete it from your system immediately and advise the
sender. To any recipient of this message within HP, unless otherwise
stated you should consider this message and attachments as "HP
CONFIDENTIAL".
========================================================================