Re: WSIF extn for BSF

Aleksander Slominski <[email protected]> Tue, 27 Sep 2005 12:09:33 -0500
Newsgroups gmane.comp.apache.webservices.wsif.user,gmane.comp.apache.webservices.wsif.devel
Message-ID <[email protected]>
Bhuvan Gupta wrote:

> Hi All,
>  
> We have developed WSIF extensions for BSF (Bean Scripting Framework) 
> as part of one of our projects and would like to contribute this to 
> the WSIF project.
> Document containing details in attached.

hi Bhuvan,

this looks great (just a minor issues [1]) and definitely would be a 
great contribution to WSIF.

>  
> Let me know the procedure to commit it to the CVS.

we have moved now to SVN.

if you are an apache commiter (i was not able to determine that) then WS 
PMC can grant you karma to commit or i can apply your code as a patch.

if the contribution is bigger in size and you are not apache commiter i 
think we will need signed Contributor License Agreements (and Software 
Grant depending on size). see towards the end of 
http://www.apache.org/licenses/

thanks,

alek

[1] please do not send MS Word DOC attachment - they are sometimes 
filtered and not everybody can read MS Word documents. below is 
rendering of ti as HTML (copy and past) for anybody interested:

*WSDL BSF Extension*

 

 

   1. *Details :*

 

The BSF binding is a WSDL binding that allows abstract functionality in 
the abstract service description (messages, operation and port types) to 
be mapped to the functionality offered by Scripts directly. This means 
that a script can be described using WSDL, and can be accessed as a 
WSDL- described service through WSIF.

This makes use of Bean Scripting Framework (BSF) to provide the 
scripting capabilities.

 

 

The BSF binding extends WSDL with the following extensibility elements:

 

<definitions ....>

 

     <!-- BSF binding -->

     <binding ...>

             <bsf:binding/>

             <operation>*

                  <bsf:operation

                        methodname="nmtoken"

                        parameterOrder="nmtoken" ?

                        returnPart="nmtoken"? />?

               <input name="nmtoken"? />?

               <output name="nmtoken"? />?

              <fault name="nmtoken"? />?

             </operation>

      </binding>

 

       <service ... >

             <port>*

                      <bsf:script  lang="nmtoken"

                              src="nmtoken"? >

                        <!--actual script here -- >

                       </bsf:script>

             </port>

        </service>

</definitions>

 

 

 

Each element is described in detail below.

    * *bsf:binding* This indicates that the binding is a BSF binding.

 

    * *bsf:operation* This element maps an abstract WSDL operation to a
      Script method. The methodName attribute specifies the name of the
      Script method corresponding to the abstract operation. The
      parameterOrder attribute is similar to and overrides the
      paramterOrder specification in the abstract operation. It
      specifies the ordering of the input message parts for the
      invocation; in the BSF binding case it identifies the method
      signature. Having a parameterOrder attribute here allows us to map
      an abstract operation to a Script method even if their signatures
      aren't compatible in the ordering of parts. The returnPart is that
      part of the abstract output message which corresponds to the
      return value of the Script method.

 

    * *bsf:script* This element is an extension under the WSDL port
      element that allows specification of a Script as an endpoint for a
      service available via the BSF binding. The port whose address is
      specified this way must be associated with a BSF binding only.

      The *lang* attribute specifies the scripting engine to be used for
      script invocation. The *src* attribute specifies the location of
      the script file. The complete script can also be provided instead
      as CDATA  value for the *bsf:script *element.


 

   2. Example :

 

In the following example, a dateConversion service is offered through 
Java Script.  The service exposes *converData* operation which takes 
three input parameters (input data string, input dataformat  and output 
dateformat) and returns the converted date string.

 

 

 

<?xml version='1.0' encoding='UTF-8'?>

<definitions name='DateConversion'

                 
targetNamespace='http://xml.apache.org/axis/wsif/samples/js/DateConversion'

                 
xmlns:tns='http://xml.apache.org/axis/wsif/samples/js/DateConversion'

             xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/"

             xmlns:bsf='http://schemas.xmlsoap.org/wsdl/bsf/'

             xmlns:xsd='http://www.w3.org/2001/XMLSchema'

             xmlns='http://schemas.xmlsoap.org/wsdl/'>

 

   <message name='convertDateRequest'>

      <part name='dateString' type='xsd:string'/>

      <part name='inFormat' type='xsd:string'/>

      <part name='outFormat' type='xsd:string'/>

   </message>

 

   <message name='convertDateResponse'>

      <part name='result' type='xsd:string'/>

   </message>

 

   <portType name='DateConversionPortType'>

      <operation name='convertDate'>

         <input message='tns:convertDateRequest'/>

         <output message='tns:convertDateResponse'/>

      </operation>

   </portType>

 

   <binding name='DateConversionBSFBinding'

            type='tns:DateConversionPortType'>

     <bsf:binding/>

    <operation name="convertDate">

      <bsf:operation

         methodName="convertDate"

         parameterOrder="dateString inFormat outFormat"

         returnPart="result" />

      <input name="convertDateRequest"/>

      <output name="convertDateResponse"/>

    </operation>

  </binding>

 

   <service name='DateConversion'>

      <port name='DateConversionPort'

            binding='tns:DateConversionBSFBinding'>

            <!-- vendor-specific deployment information needs to be 
entered here -->

            <bsf:script lang="javascript" 
src="C:\\bhuvan\\wsif-2_0\\samples\\bpel\\Test.js"/>

      </port>

   </service>

</definitions>

 

 

 



-- 
The best way to predict the future is to invent it - Alan Kay