Hi,

I've created a wsdl for the BPEL invoking asynchronous web service. A snippet 
of the wsdl is shown below:

.
.
<!-- portType implemented by the ApprovalAsyncBPEL BPEL process -->
    <portType name="ApprovalAsyncBPEL">
        <operation name="initiate">
            <input message="tns:ApprovalAsyncBPELRequestMessage"/>
            <output message="tns:ApprovalAsyncBPELResponseMessage"/>
        </operation>
    </portType>

    <!-- portType implemented by the requester of ApprovalAsyncBPEL BPEL process
         for asynchronous callback purposes
         -->
    <portType name="ApprovalAsyncBPELCallback">
        <operation name="onResult">
            <input message="tns:ApprovalAsyncBPELResponseMessage"/>
        </operation>
    </portType>

    <binding name="ApprovalAsyncBinding" type="tns:ApprovalAsyncBPEL">
        <wsdlsoap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
                <operation name="initiate">
                        <wsdlsoap:operation soapAction=""/>
                        <input>
                                <wsdlsoap:body use="literal"/>
                        </input>
                        <output>
                                <wsdlsoap:body use="literal"/>
                        </output>
                </operation>
    </binding>

        <binding name="ApprovalAsyncCallbackBinding" 
type="tns:ApprovalAsyncBPELCallback">
                <wsdlsoap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="onResult">
            <wsdlsoap:operation soapAction=""/>
                        <input>
                                <wsdlsoap:body use="literal"/>
                        </input>
        </operation>
        </binding>

    <service name="ApprovalAsyncBPELService">
                <port name="ApprovalAsyncPort" 
binding="tns:ApprovalAsyncBinding">
                        <wsdlsoap:address 
location="http://hydhtc43236:8085/ApprovalAsyncBPELService"/>
                </port>
                <port name="ApprovalAsyncCallbackPort" 
binding="tns:ApprovalAsyncCallbackBinding">
                        <wsdlsoap:address 
location="http://hydhtc43236:8085/ApprovalAsyncBPELCallbackService"/>
                </port>
    </service>

    <plnk:partnerLinkType name="ApprovalAsyncBPELProvider">
        <plnk:role name="ApprovalAsyncBPELProvider" 
portType="tns:ApprovalAsyncBPEL"/>
    </plnk:partnerLinkType>
    <plnk:partnerLinkType name="ApproverPartnerLinkType">
        <plnk:role name="ApprovalAsyncProvider" portType="ns2:ApprovalData"/>
        <plnk:role name="ApprovalAsyncReceiver" 
portType="tns:ApprovalAsyncBPELCallback"/>
    </plnk:partnerLinkType>
.
.
</definitions>



I've created componentType file like you suggested. It is shown below:

<service name="ApprovalAsyncBPELService">
        <interface.wsdl 
interface="http://com.infosys.poc.procurement.approval#wsdl.interface(ApprovalAsyncBPEL)"
 
callbackInterface="http://com.infosys.poc.procurement.approval#wsdl.interface(ApprovalAsyncBPELCallback)"
 />
  </service>

  <reference name="ApprovalDataService">
         <interface.wsdl 
interface="http://approvaldata.procurement.poc.infosys.com#wsdl.interface(ApprovalData)"
 />
  </reference>

I hope this is correct. And my deploy.xml is something like:

<process name="tns:ApprovalAsyncBPELProcess">
                <active>true</active>
                <provide partnerLink="ApprovalAsyncBPELProvider">
                        <service name="wns:ApprovalAsyncBPELService" 
port="ApprovalAsyncPort"/>
                </provide>
                <invoke partnerLink="ApprovalRequester">
                        <service name="wns1:ApprovalDataService" 
port="ApprovalDataPort"/>
                </invoke>
        </process>

When I try to run it with this configuration, I get the following error:
"No service name for myRole plink ApprovalRequester"

FULL STACK TRACE:
run:
     [java] May 2, 2008 7:02:25 PM 
org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl$1 pr
oblem
     [java] WARNING: No targets for reference: ApprovalDataService
     [java] Starting ApprovalBPELServiceComponent
     [java] >>> Deploying : 
F:\Tuscany\tuscany-sca-1.1-incubating\working\ApprovalBPELComponent\target\cl
asses
     [java] 
org.apache.tuscany.sca.implementation.bpel.ode.ODEDeploymentException: >>> 
DEPLOY: Unexpected
 exception: Deployment failed within the engine.
     [java]     at 
org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer.deploy(EmbeddedODESer
ver.java:220)
     [java]     at 
org.apache.tuscany.sca.implementation.bpel.provider.BPELImplementationProvider.start(B
PELImplementationProvider.java:94)
     [java]     at 
org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.start(CompositeActivatorIm
pl.java:495)
     [java]     at 
org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.<init>(DefaultSCADomain.jav
a:189)
     [java]     at 
org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADomain.java:230)
     [java]     at 
org.apache.tuscany.sca.host.embedded.SCADomain.newInstance(SCADomain.java:69)
     [java]     at helloworld.BPELClient.main(BPELClient.java:14)
     [java] Caused by: org.apache.ode.bpel.iapi.ContextException: Deployment 
failed within the engine.
     [java]     at 
org.apache.ode.store.ProcessStoreImpl.deploy(ProcessStoreImpl.java:291)
     [java]     at 
org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer.deploy(EmbeddedODESer
ver.java:214)
     [java]     ... 6 more
     [java] Caused by: java.lang.IllegalArgumentException: No service name for 
myRole plink ApprovalReque
ster
     [java]     at 
org.apache.ode.bpel.engine.BpelProcess.setRoles(BpelProcess.java:385)
     [java]     at 
org.apache.ode.bpel.engine.BpelProcess.access$1000(BpelProcess.java:75)
     [java]     at 
org.apache.ode.bpel.engine.BpelProcess$HydrationLatch.doHydrate(BpelProcess.java:707)
     [java]     at 
org.apache.ode.bpel.engine.BpelProcess$HydrationLatch.access$100(BpelProcess.java:654)

     [java]     at 
org.apache.ode.bpel.engine.BpelProcess$HydrationLatch$2.run(BpelProcess.java:666)
     [java]     at 
org.apache.ode.bpel.engine.NStateLatch.latch(NStateLatch.java:89)
     [java]     at 
org.apache.ode.bpel.engine.BpelProcess.hydrate(BpelProcess.java:547)
     [java]     at 
org.apache.ode.bpel.engine.BpelServerImpl.register(BpelServerImpl.java:277)
     [java]     at 
org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer$1.onProcessStoreEvent
(EmbeddedODEServer.java:171)
     [java]     at 
org.apache.ode.store.ProcessStoreImpl.fireEvent(ProcessStoreImpl.java:501)
     [java]     at 
org.apache.ode.store.ProcessStoreImpl.deploy(ProcessStoreImpl.java:282)
     [java]     ... 7 more
     [java] ::arg:::::: <?xml version="1.0" encoding="UTF-8"?>
     [java] <ApprovalAsyncBPELRequest 
xmlns="http://com.infosys.poc.procurement.approval";>Hello</Approval
AsyncBPELRequest>
     [java] ::message:: <?xml version="1.0" encoding="UTF-8"?>
     [java] <message><payload><ApprovalAsyncBPELRequest 
xmlns="http://com.infosys.poc.procurement.approva
l">Hello</ApprovalAsyncBPELRequest></payload></message>
     [java] Exception in thread "main" java.lang.NullPointerException: null 
message!
     [java]     at 
org.apache.ode.bpel.engine.MessageImpl.<init>(MessageImpl.java:40)
     [java] Status: FAILURE
     [java]     at 
org.apache.ode.bpel.engine.MessageExchangeImpl.getResponse(MessageExchangeImpl.java:97
)
     [java]     at 
org.apache.tuscany.sca.implementation.bpel.provider.BPELInvoker.doTheWork(BPELInvoker.
java:145)
     [java]     at 
org.apache.tuscany.sca.implementation.bpel.provider.BPELInvoker.invoke(BPELInvoker.jav
a:90)
     [java]     at 
org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(Data
TransformationInterceptor.java:74)
     [java]     at 
org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValue
Interceptor.java:88)
     [java]     at 
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandle
r.java:249)
     [java]     at 
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandle
r.java:146)
     [java]     at $Proxy13.initiate(Unknown Source)
     [java]     at helloworld.BPELClient.main(BPELClient.java:17)
ApprovalAsyncBPELCallback



There is no service defined for the callback portType. Could that be the 
problem? If yes how do I define a service for the callback portType? What 
should my deploy.xml look like? I tried adding one more <provide> but it gave 
deployment error. Also is it correct to have both service and callback ports 
inside the same <service> in the wsdl like in our wsdl shown above?

Thanks & Regards
Ashwini Kumar Jeksani


-----Original Message-----
From: Mike Edwards [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 01, 2008 5:19 PM
To: tuscany-user@ws.apache.org
Subject: Re: Reg: Asynchronous Webservice in BPEL

Ashwini Kumar Jeksani wrote:
> Hi,
>
> I'm trying to create a BPEL for asynchronous web service call. A snippet of 
> it is shown below:
>
> <!-Receive request from client -->
> <receive createInstance="yes" operation="initiate " partnerLink=" 
> ApprovalAsyncBPELProvider" portType="ns1: ApprovalAsyncBPEL" variable=" 
> ApprovalAsyncBPELRequest"/>
>
> <!-Asynchronous Web Service Invoke -->
> <invoke inputVariable="asyncApprovalRequest" operation="approveDataLoad" 
> partnerLink="ApprovalAsyncReceiver" portType="ns2:ApprovalData">
>          <correlations>
>             <correlation initiate="yes" pattern="request" set="CS1"/>
>          </correlations>
> </invoke>
> <!-Receive Response from Asynchronous Web Service invoked above -- >
> <receive operation="onResult" partnerLink="ApprovalAsyncReceiver" 
> portType="ns1:ApprovalAsyncBPELCallback" variable="ApprovalAsyncBPELResponse">
>          <correlations>
>             <correlation initiate="no" set="CS1"/>
>          </correlations>
> </receive>
>
> The first receive in the above BPEL snippet is called by a client and 
> therefore I have declared it as a 'service' in componentType file.
> The invoke is for invoking an asynchronous web service operation. The 
> portType of that I have declared as 'reference' in the componentType file.
> The second receive in the above BPEL snippet acts as a callback to receive 
> response from an asynchronous web service. Where and How do I specify that 
> this is a callback? Is there way of specifying callbacks in componentType 
> file.?
>
> Thanks & Regards
> Ashwini Kumar Jeksani

Ashwini,

** WARNING - Long Post **

You're certainly going in the right direction here.

One way of specifying that a callback interface is in use is to declare
it in the SCDL files - in particular in the componentType file, using
something like this:

<interface.java interface="services.invoicing.ComputePrice"
                 callbackInterface="services.invoicing.InvoiceCallback"/>

This isn't the only way of specifying the callback, at least for Java
interfaces, since it is possible to use annotations within the interface
files, such as:

@Remotable
@Callback(MyServiceCallback.class)
public interface MyService {

     @OneWay
     void someMethod(String arg);
}

...and...

@Remotable
public interface MyServiceCallback {

     void receiveResult(String result);
}

Note the @Callback annotation in the forward call interface, which
points at the callback interface.

However, there is nothing like this available in WSDL.

Instead, a WSDL file can contain multiple service definitions (ie
PortTypes) - and so a single WSDL can hold both the forward and callback
interfaces, which might look something like this:

....

     <wsdl:portType name="MyService">
         <wsdl:operation name="someMethod">
             <wsdl:input message="tns:someMethodRequest"
                         name="someMethodRequest"/>
         </wsdl:operation>
     </wsdl:portType>

     <wsdl:portType name="MyServiceCallback">
         <wsdl:operation name="receiveResult">
             <wsdl:input message="tns:receiveResultRequest"
                         name="receiveResultRequest"/>
             <wsdl:output message="tns:receiveResultResponse"
                          name="receiveResultResponse"/>
         </wsdl:operation>
     </wsdl:portType>

....

In the SCDL which references a WSDL like this, in the component type and
in any relevant composite file, then it would look like this:

<interface.wsdl
interface="http://simplecallback#wsdl.interface(MyService)"
callbackInterface="http://simplecallback#wsdl.interface(MyServiceCallback)"
/>

When you set up a component which uses Web services the SCDL will look
something like this:

<component name="MyServiceComponent">
   <implementation.java class="simplecallback.MyServiceImpl" />
   <service name="MyService">
     <interface.wsdl
       interface="http://simplecallback#wsdl.interface(MyService)"

callbackInterface="http://simplecallback#wsdl.interface(MyServiceCallback)"/>
<binding.ws
wsdlElement="http://simplecallback#wsdl.port(MyServiceSoapService/MyServiceSoapPort)"/>
<callback>
<binding.ws
wsdlElement="http://simplecallback#wsdl.port(MyServiceCallbackSoapService/MyServiceCallbackSoapPort)"/>
</callback>
</service>
</component>

Excuse the formatting - it does not fit well into the width limits.

Of course, the WSDL that you produce will also have to have the BPEL
PartnerLinkType elements pointing to the appropriate PortType elements.

I think that's it...

...you can see an example of this in the simple-callback-ws sample in
Tuscany.

BTW, what I am working on right now is the code to eliminate the need to
build the componentType file.  The BPELDocumentProcessor code is bing
modified to read the BPEL process file and also to follow the links to
the WSDL files and to resolve the PartnerLink -> PartnerLinkType ->
PortType chains.  This will result in the generation of the component
type interface definition as above, with a reference to the PortType for
forward and callback interfaces.

I should post some code in the next couple of days.


Yours,  Mike.







**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are 
not to copy, disclose, or distribute this e-mail or its contents to any other 
person and any such actions are unlawful. This e-mail may contain viruses. 
Infosys has taken every reasonable precaution to minimize this risk, but is not 
liable for any damage you may sustain as a result of any virus in this e-mail. 
You should carry out your own virus checks before opening the e-mail or 
attachment. Infosys reserves the right to monitor and review the content of all 
messages sent to or from this e-mail address. Messages sent to or from this 
e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

Reply via email to