On Fri, Oct 30, 2009 at 10:57 PM, Brian Donaldson <bria...@gmail.com> wrote:
> I used the archetype to create the hello-world tuscany webapp.  The webapp
> demonstrates calling the helloworld service via a .jsp.  My question is --
> how would I modify the .composite file to also expose the helloworld service
> over SOAP?  I tried adding <binding.ws uri=...>, but that didn't seem to
> help.
> I'm deploying the .war to tomcat.
>
> Thanks for any insight.
> -B

There are two things you need to do:

1) update the projects pom.xml to include the dependencies required
when using Web Services

            <dependency>
               <groupId>org.apache.tuscany.sca</groupId>
               <artifactId>tuscany-binding-ws-axis2</artifactId>
               <version>${tuscany.version}</version>
               <scope>runtime</scope>
            </dependency>

2) update the .composite file for the WS definitions by adding a
<service> element to the HelloworldComponent:

    <component name="HelloworldComponent">
        <implementation.java class="foo.HelloworldImpl"/>
        <service name="HelloworldService">
          <binding.sca />
          <binding.ws name="foo" />
        </service>
    </component>

Some notes on the above:

In (1) the name of the dependency is tuscany-binding-ws-axis2 but
we're trying to change all 2.x code to use a consistent name pattern
tuscany-<type>-<name>-runtime, but binding.ws currently hasn't
finished being brought up in the 2.x so doesnt yet match that. That
should change by the next release so it will then be
tuscany-binding-ws-runtime to match all the others - eg:
tuscany-binding-jms-runtime, tuscany-implementation-bpel-runtime, etc.

In (2) the endpoint of the WS is based on
yourWebAppName/componentName/serviceName/bindingName and you can test
its there by adding a ?wsdl to the endpoint url and trying that in a
browser, eg:

http://localhost:8080/yourWebAppName/HelloworldComponent/HelloworldService/foo?wsdl

If you don't want to keep the JSP and <implementation.web> you can
simplify the scdl to:

    <component name="HelloworldComponent">
        <implementation.java class="foo.HelloworldImpl"/>
        <service name="HelloworldService">
          <binding.ws />
        </service>
    </component>

In that case the default binding name isnt included in the endpoint so
the url is:

http://localhost:8080/yourWebAppName/HelloworldComponent/HelloworldService?wsdl

And finally, it turns out that there is a problem in the M3 release
with the WS webapp support so the above does not work correctly and
you'll need to use the current trunk or the imminent M4 release. You
can do that by changing the version property in the achetype generated
pom.xml file, eg:

<tuscany.version>2.0-SNAPSHOT</tuscany.version>

HTH

   ...ant

Reply via email to