You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsif-user@ws.apache.org by "Andre P." <an...@gmail.com> on 2007/02/06 20:53:52 UTC

WSIF and BPEL

Hello everyone!
Could anybody please enlighten my ideas!

I was wondering, how the invocation in the BPEL is made. Does it dynamic
(stubless) invoke all the (SOAP) services using their WSDLs or it's
necessary to create all the proxies for the services first? How it is done,
anybody have any idea?

I'm using WSIF (actually WSIF from XSUL library developed in Indiana
University), and I would like to use it with BPEL, to stubless and
dynamically invoke all the (SOAP)services exposed and involved in my
business process workflow! Is it possible?

Thanks in advance

Andre

Re: [xgws-user] WSIF and BPEL

Posted by Aleksander Slominski <as...@cs.indiana.edu>.
Andre P. wrote:
> Hi again Alek!
> Well, I'm using the xsul dynamic invoker to stubless invoke *any*
> service that I want, in any framework/app server.
> I would like to create a simple scenario with 3 services, and create
> an workflow of this 3 services (first invoke the service 1 [with
> xsuldyninvoker], then with the return of service 1 invoke service 2
> [with xsuldyninvoker] and then with the return of service 2 invoke
> service 3 [with xsuldyninvoker too].
yes that should work as it is the simples possible workflow A -> B -> C
if you use XWSIF (in XSUL) you can access underlying XML element
(XmlElement) and use XPath processor (Jaxen) to do retrieval of XML
parts and stuck them into WSIFMessageElement which is XmlElement
>  
> This solution that you answered is not using BPEL at all? Just WSIF?
BPEL engine can use WSIF - in such case the engine orchestrates
invocation of services (main challenge: deal with concurrency ...)
> In my conception (i'm too lame yet), i was wondering in something like
> I know my wsdl endpoints previously (at design time of the BPEL
> workflow), and I "read" the BPEL workflow and invoke the services with
> the WSIF dyn. invoker (In a BPEL , the invocation is handled by the
> engine? It can invoke *any* webservice just like the xsul dynamic
> invoker?)
yes it could however remember that BPEL allow dynamic assignment of
service reference (so service location can change during BPEL workflow
execution) - that is clearly for later - after you get static
invocations to work
>  
> Sorry about my questions, but I'm a little "new" in this area! :)
that is fine - i CC wsif-user so others can add their comments on
WSIF/BPEL interactions.

best,

alek

>  
>
>     Andre P. wrote:
>>     Hello everyone!
>>     Could anybody please enlighten my ideas!
>>      
>>     I was wondering, how the invocation in the BPEL is made. Does it
>>     dynamic (stubless) invoke all the (SOAP) services using their
>>     WSDLs or it's necessary to create all the proxies for the
>>     services first? How it is done, anybody have any idea?
>>      
>>     I'm using WSIF (actually WSIF from XSUL library developed in
>>     Indiana University), and I would like to use it with BPEL, to
>>     stubless and dynamically invoke all the (SOAP)services exposed
>>     and involved in my business process workflow! Is it possible?
>     hi Andre,
>
>     in short: yes.
>
>     steps are pretty simple
>
>        1. you identify which WSDL, operation name and XML message
>           (content combined by using XML API suchs xpath, xslt, xquery
>           etc and actual actions described in your workflow)
>        2. you load wsdl or just get it from cache (so you have
>           WsdlDefinitions object)
>        3. then using WSIF API you create WSIFPort that can be used to
>           invoke that operation
>        4. invoke and wait for async response (the tricky part if you
>           want scalbility you should do it as request-response as a
>           pair of one-way messages and other tricks to allow waiting
>           for very long running responses without tying a thread)
>        5. process response output (agian XML APIs come handy and it is
>           in your workflow)
>
>     about 3&4: you can use pure WSIF API for example (with extension
>     that WSIFMessage is XmlElement so you can directly manipulate it
>     and even access SOAP Header inside - very handy in workflows  ...)
>     -  see XsulDynamicInvoker for full contained example
>
>             WSIFProviderManager.getInstance().addProvider( new
>     xsul.wsif_xsul_soap_http.Provider() );
>
>                 final WSIFServiceFactory factoryInstance =
>     WSIFServiceFactory.newInstance();
>                 // Do this each time because they might not be thread
>     safe.
>                 WSIFService service =
>     factoryInstance.getService(this.definitions);
>                 WSIFPort port = service.getPort();
>                 WSIFOperation gFacOperation =
>     port.createOperation(operationName);
>
>                 WSIFMessage inputMessage =
>     gFacOperation.createInputMessage();
>
>             // access XML inside inputMessage and SOAP Header
>             XmlElement xmlMessage = ((XmlElementAdapter)
>     inputMessage).getTarget();
>             XmlDocument inputEnvelopeDoc =
>     soapFragrance.wrapBodyContent(xmlMessage);
>             if (logger.isFinestEnabled()) logger.finest(" message: "+
>     XsulUtil.safeXmlToString(inputEnvelopeDoc));
>             XmlElement inputEnvelope =
>     inputEnvelopeDoc.getDocumentElement();
>             XmlElement inputHeader =
>     inputEnvelope.element(inputEnvelope .getNamespace(),
>     XmlConstants.S_HEADER);
>             if (inputHeader == null) {
>                 inputHeader = inputEnvelope.newElement (
>                         inputEnvelope.getNamespace(),
>     XmlConstants.S_HEADER);
>                 inputEnvelope.insertChild(0, inputHeader);
>                 inputHeader.setParent(inputEnvelope);
>             }
>             inputHeader.addElement (leadContextHeaderCopy);
>             // deep magic a.k.a. voodoo deployed here to connect all
>     living things together ...
>             ((XmlElement)
>     inputMessage).setParent(xmlMessage.getParent());
>      
>
>                 WSIFMessage outputMessage =
>     gFacOperation.createOutputMessage();
>                 WSIFMessage faultMessage =
>     gFacOperation.createFaultMessage();
>
>                 inputMessage.setObjectPart(parameterName, aparamvalue);
>                 // ...
>
>                 boolean success =
>     gFacOperation.executeRequestResponseOperation(inputMessage,
>     outputMessage, faultMessage);
>                 if (!success) {
>                     // and so on
>
>     or XWSIF extensions that allows client side handlers, control over
>     asnc responses, timeouts, etc. (see XwsifTestClient for full
>     contained example)
>
>             WSIFClient wclient = WSIFRuntime.newClient(wsdlLoc)
>                 .addHandler(new
>     StickySoapHeaderHandler("use-lead-header", leadContext))
>                 .useAsyncMessaging(correlator)
>                 //.setAsyncResponseTimeoutInMs(33 * 1000L); // to
>     simplify testing set to just few seconds
>                 .setAsyncResponseTimeoutInMs(0); //unlimited wait
>
>             WSIFPort port = wclient.getPort();
>             WSIFOperation operation = port.createOperation("add");
>             WSIFMessage inputMessage = operation.createInputMessage();
>             WSIFMessage outputMessage = operation.createOutputMessage();
>             WSIFMessage faultMessage = operation.createFaultMessage();
>
>             inputMessage.setObjectPart("x", "2222");
>             inputMessage.setObjectPart("y", "3333");
>             // and so on like in typical WSIF app
>
>     HTH
>
>     best,
>
>     alek
>


---------------------------------------------------------------------
To unsubscribe, e-mail: wsif-user-unsubscribe@ws.apache.org
For additional commands, e-mail: wsif-user-help@ws.apache.org


Re: [xgws-user] WSIF and BPEL

Posted by Aleksander Slominski <as...@cs.indiana.edu>.
Andre P. wrote:
> Hello everyone!
> Could anybody please enlighten my ideas!
>  
> I was wondering, how the invocation in the BPEL is made. Does it
> dynamic (stubless) invoke all the (SOAP) services using their WSDLs or
> it's necessary to create all the proxies for the services first? How
> it is done, anybody have any idea?
>  
> I'm using WSIF (actually WSIF from XSUL library developed in Indiana
> University), and I would like to use it with BPEL, to stubless and
> dynamically invoke all the (SOAP)services exposed and involved in my
> business process workflow! Is it possible?
hi Andre,

in short: yes.

steps are pretty simple

   1. you identify which WSDL, operation name and XML message (content
      combined by using XML API suchs xpath, xslt, xquery etc and actual
      actions described in your workflow)
   2. you load wsdl or just get it from cache (so you have
      WsdlDefinitions object)
   3. then using WSIF API you create WSIFPort that can be used to invoke
      that operation
   4. invoke and wait for async response (the tricky part if you want
      scalbility you should do it as request-response as a pair of
      one-way messages and other tricks to allow waiting for very long
      running responses without tying a thread)
   5. process response output (agian XML APIs come handy and it is in
      your workflow)

about 3&4: you can use pure WSIF API for example (with extension that
WSIFMessage is XmlElement so you can directly manipulate it and even
access SOAP Header inside - very handy in workflows  ...) -  see
XsulDynamicInvoker for full contained example

        WSIFProviderManager.getInstance().addProvider( new
xsul.wsif_xsul_soap_http.Provider() );

            final WSIFServiceFactory factoryInstance =
WSIFServiceFactory.newInstance();
            // Do this each time because they might not be thread safe.
            WSIFService service =
factoryInstance.getService(this.definitions);
            WSIFPort port = service.getPort();
            WSIFOperation gFacOperation =
port.createOperation(operationName);

            WSIFMessage inputMessage = gFacOperation.createInputMessage();

        // access XML inside inputMessage and SOAP Header
        XmlElement xmlMessage = ((XmlElementAdapter)
inputMessage).getTarget();
        XmlDocument inputEnvelopeDoc =
soapFragrance.wrapBodyContent(xmlMessage);
        if (logger.isFinestEnabled()) logger.finest(" message: "+
XsulUtil.safeXmlToString(inputEnvelopeDoc));
        XmlElement inputEnvelope = inputEnvelopeDoc.getDocumentElement();
        XmlElement inputHeader = inputEnvelope.element(inputEnvelope
.getNamespace(), XmlConstants.S_HEADER);
        if (inputHeader == null) {
            inputHeader = inputEnvelope.newElement(
                    inputEnvelope.getNamespace(), XmlConstants.S_HEADER);
            inputEnvelope.insertChild(0, inputHeader);
            inputHeader.setParent(inputEnvelope);
        }
        inputHeader.addElement(leadContextHeaderCopy);
        // deep magic a.k.a. voodoo deployed here to connect all living
things together ...
        ((XmlElement) inputMessage).setParent(xmlMessage.getParent());
 

            WSIFMessage outputMessage = gFacOperation.createOutputMessage();
            WSIFMessage faultMessage = gFacOperation.createFaultMessage();

            inputMessage.setObjectPart(parameterName, aparamvalue);
            // ...

            boolean success =
gFacOperation.executeRequestResponseOperation(inputMessage,
outputMessage, faultMessage);
            if (!success) {
                // and so on

or XWSIF extensions that allows client side handlers, control over asnc
responses, timeouts, etc. (see XwsifTestClient for full contained example)

        WSIFClient wclient = WSIFRuntime.newClient(wsdlLoc)
            .addHandler(new StickySoapHeaderHandler("use-lead-header",
leadContext))
            .useAsyncMessaging(correlator)
            //.setAsyncResponseTimeoutInMs(33 * 1000L); // to simplify
testing set to just few seconds
            .setAsyncResponseTimeoutInMs(0); //unlimited wait

        WSIFPort port = wclient.getPort();
        WSIFOperation operation = port.createOperation("add");
        WSIFMessage inputMessage = operation.createInputMessage();
        WSIFMessage outputMessage = operation.createOutputMessage();
        WSIFMessage faultMessage = operation.createFaultMessage();

        inputMessage.setObjectPart("x", "2222");
        inputMessage.setObjectPart("y", "3333");
        // and so on like in typical WSIF app

HTH

best,

alek

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