Invoking a Reference Operation
When you add a reference to a Spring component, TIBCO Business Studio - BPM Edition adds following a field and accessor methods to the abstract component implementation. ActiveMatrix Service Grid injects the referenced object into the component implementation.
TIBCO Business Studio - BPM Edition adds the following elements to the abstract component implementation:
- SCA reference annotation import
- A field that declares the referenced object
- Accessor methods
import org.osoa.sca.annotations.Reference; @Reference(name = "DateManagerPT") public void setDateManagerPT(DateManagerPT DateManagerPT) { this.DateManagerPT = DateManagerPT; } public DateManagerPT getDateManagerPT() { return this.DateManagerPT; }
req
object after the call to
getCurrentTime, make a deep copy of
req
as follows:
TimeRequestDocument req = TimeRequestDocument.Factory.newInstance(); req.setTimeRequest("America/Los_Angeles"); TimeRequestDocument reqcopy = (TimeRequestDocument)req.copy(); TimeResponseDocument time = getDateManagerPT().getCurrentTime(req); System.out.println("The time in " + reqcopy.getTimeRequest() + " is " + time.getTimeResponse());
Add the statement getportType().operation. If the reference is configured for dynamic wiring, you must define a method to create an endpoint reference (see Creating an Endpoint Reference) and call the method before invoking the reference object. For information on wiring, see "Static and Dynamic Wiring" in TIBCO ActiveMatrix® Service GridComposite Development.
The following code snippet demonstrates how to invoke the getCurrentTime operation on the reference configured for dynamic wiring with port type DateManagerPT:
setEPR(targetURI); String time = currentTime.getTimeResponse(); resp.setHelloResponse(getJavaGreeting() + " " + name + "! " + "The current time is " + time + "."); return resp;