Apache Tuscany > Home > SCA Overview > SCA Java > Java SCA Documentation Menu > SCA Java binding.ws User List | Dev List | Issue Tracker  
Resources

<binding.ws>

The Tuscany Java SCA runtime supports Web services by using the <binding.ws> SCDL extension. New Web service endpoints can be provided by using <binding.ws> within a SCA <service>, existing Web services can be invoked by using <binding.ws> within a SCA <reference>.

The Web service binding is one of the SCA extensions which is being formalized in the OASIS Open Composite Services Architecture with a published specifications document.

The Web service binding SCDL has the following format:

<binding.ws name="NCName"? uri="xs:anyURI"? wsdlElement="xs:anyURI"? wsdli:wsdlLocation="list of xs:anyURI"? >
   <wsa:EndpointReference>...</wsa:EndpointReference>*
</binding.ws>

simple use

All the attributes and elements of the Web service binding are optional, so the simplest way to use it is to use all the defaults:

<binding.ws/>

With that simplest form the endpoint which will be used is derived from the names of the component and binding. This works well for services but for references its likely not what you want, so with references the following is a more useful simplest form:

<binding.ws uri="http://someHost/someService"/>

wsdlElement

The wsdlElement attribute indicates that a WSDL document exists which should be used and it points to the element within that WSDL to use. The value of the wsdlElement attribute can have one of the following four forms:

  1. Service:
    <WSDL-namespace-URI>#wsdl.service(<service-name>)
    In this case, all the endpoints in the WSDL Service that have equivalent PortTypes with the SCA service or reference must be available to the SCA service or reference.
  2. Port (WSDL 1.1):
    <WSDL-namespace-URI>#wsdl.port(<service-name>/<port-name>)
    In this case, the identified port in the WSDL 1.1 Service must have an equivalent PortType with the SCA service or reference.
  3. Endpoint (WSDL 2.0):
    <WSDL-namespace-URI>#wsdl.endpoint(<service-name>/<endpoint-name>)
    In this case, the identified endpoint in the WSDL 2.0 Service must have an equivalent PortType with the SCA service or reference.
  4. Binding:
    <WSDL-namespace-URI>#wsdl.binding(<binding-name>)
    In this case, the identified WSDL binding must have an equivalent PortType with the SCA service or reference. In this case the endpoint address URI for the SCA service or reference must be provided via the URI attribute on the binding.
What will the endpoint be?
The actual Web service endpoint used depends on whether or not a WSDL port is being used, if the EndpointReference element or the uri attribute of the <binding.ws> has been specified, and the names of the component and binding. The actual alogrythim defined in the Web service binding specification is:
  1. Either the URIs in the endpoint(s) of the referenced WSDL
    or the URI specified by the wsa:Address element of the wsa:EndpointReference
  2. The explicitly stated URI in the "uri" attribute of the binding.ws element, which may be relative,
  3. The implicit URI as defined by the Assembly specification

The URI in the WSDL endpoint or in the wsa:Address of an EPR may be a relative URI, in which case it is relative to the URI defined in (2) or (3). The wsa:Address element can be the empty relative URI, in which case it uses the URI defined in (2) or (3) directly. This allows the EPR writer to specify reference parameters, metadata and other EPR contents while allowing the URI to be chosen by the deployer. To reference a WSDL document and also specify an EPR, the wsdlElement attribute must refer to a binding element in the WSDL and not an endpoint or service.

wsdlLocation

The wsdlLocation attribute enables defining the location of the WSDL document to be used. Using wsdlLocation is not normally necessary as the Tuscany contrabution service will have discovered all the WSDL documents within a deployed SCA contrabution.

wsa:EndpointReference

This attribute enables using a WS-Addressing EndpointReference that specifies the endpoint for the service or reference, or any WSA reference parameters, metadata and other EPR contents to be used.

Some examples:

This example shows making a HelloWorld component available as a Web service endpoint. All the Web service binding defaults are used so the endpoint of the Web service will be http://localhost:8080/HelloWorldComponent.

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
           targetNamespace="http://helloworld"
           xmlns:hw="http://helloworld"
           name="helloworldws">

    <service name="HelloWorldService" promote="HelloWorldComponent">
       <interface.java interface="helloworld.HelloWorldService" />
       <binding.ws />
    </service>

    <component name="HelloWorldComponent">
        <implementation.java class="helloworld.HelloWorldImpl" />
    </component>

</composite>
website stats