}
public String invoke(PartnerLinkInstance partnerLink, Operation operation, Element outgoingMessage,
InvokeResponseChannel channel) throws FaultException {
PartnerLinkDAO plinkDAO = fetchPartnerLinkDAO(partnerLink);
// The target (partner endpoint) -- if it has not been explicitly
// initialized
// then use the value from bthe deployment descriptor ..
Element partnerEPR = plinkDAO.getPartnerEPR();
EndpointReference partnerEpr;
if (partnerEPR == null) {
partnerEpr = _bpelProcess.getInitialPartnerRoleEPR(partnerLink.partnerLink);
// In this case, the partner link has not been initialized.
if (partnerEpr == null)
throw new FaultException(partnerLink.partnerLink.getOwner().constants.qnUninitializedPartnerRole);
} else {
partnerEpr = _bpelProcess._engine._contexts.eprContext.resolveEndpointReference(partnerEPR);
}
if (BpelProcess.__log.isDebugEnabled()) {
BpelProcess.__log.debug("INVOKING PARTNER: partnerLink=" + partnerLink +
", op=" + operation.getName() + " channel=" + channel + ")");
}
// prepare event
ProcessMessageExchangeEvent evt = new ProcessMessageExchangeEvent();
evt.setOperation(operation.getName());
evt.setPortType(partnerLink.partnerLink.partnerRolePortType.getQName());
evt.setAspect(ProcessMessageExchangeEvent.PARTNER_INPUT);
MessageExchangeDAO mexDao = _dao.getConnection().createMessageExchange(
MessageExchangeDAO.DIR_BPEL_INVOKES_PARTNERROLE);
mexDao.setStatus(MessageExchange.Status.NEW.toString());
mexDao.setOperation(operation.getName());
mexDao.setPortType(partnerLink.partnerLink.partnerRolePortType.getQName());
mexDao.setPartnerLinkModelId(partnerLink.partnerLink.getId());
mexDao.setPartnerLink(plinkDAO);
mexDao.setProcess(_dao.getProcess());
mexDao.setInstance(_dao);
mexDao.setPattern((operation.getOutput() != null ? MessageExchangePattern.REQUEST_RESPONSE
: MessageExchangePattern.REQUEST_ONLY).toString());
mexDao.setChannel(channel == null ? null : channel.export());
// Properties used by stateful-exchange protocol.
String mySessionId = plinkDAO.getMySessionId();
String partnerSessionId = plinkDAO.getPartnerSessionId();
if ( mySessionId != null )
mexDao.setProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID, mySessionId);
if ( partnerSessionId != null )
mexDao.setProperty(MessageExchange.PROPERTY_SEP_PARTNERROLE_SESSIONID, partnerSessionId);