use of org.wso2.carbon.bpel.core.ode.integration.BPELMessageContext in project carbon-business-process by wso2.
the class AxisServiceUtils method invokeService.
public static void invokeService(BPELMessageContext partnerInvocationContext, ConfigurationContext configContext) throws AxisFault {
MessageContext mctx = partnerInvocationContext.getInMessageContext();
OperationClient opClient = getOperationClient(partnerInvocationContext, configContext);
mctx.getOptions().setParent(opClient.getOptions());
/*
Else we assume that the epr is not changed by the process.
In this case there's a limitation we cannot invoke the epr in the wsdl
(by assingning that epr by partnerlink assign) if there is a endpoint
configuration available for that particular service
*/
addCustomHeadersToMessageContext(mctx);
opClient.addMessageContext(mctx);
Options operationOptions = opClient.getOptions();
if (partnerInvocationContext.getUep().isAddressingEnabled()) {
// Currently we set the action manually, but this should be handled by
// addressing module it-self?
String action = getAction(partnerInvocationContext);
if (log.isDebugEnabled()) {
log.debug("Soap action: " + action);
}
operationOptions.setAction(action);
// TODO set replyto as well
// operationOptions.setReplyTo(mctx.getReplyTo());
}
if (partnerInvocationContext.getUep().getAddress() == null) {
partnerInvocationContext.getUep().setAddress(getEPRfromWSDL(partnerInvocationContext.getBpelServiceWSDLDefinition(), partnerInvocationContext.getService(), partnerInvocationContext.getPort()));
}
operationOptions.setTo(partnerInvocationContext.getUep());
opClient.execute(true);
if (partnerInvocationContext.isTwoWay()) {
partnerInvocationContext.setOutMessageContext(opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE));
partnerInvocationContext.setFaultMessageContext(opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_FAULT_VALUE));
}
}
use of org.wso2.carbon.bpel.core.ode.integration.BPELMessageContext in project carbon-business-process by wso2.
the class SOAPUtils method buildSoapDetail.
private static OMElement buildSoapDetail(final BPELMessageContext bpelMessageContext, final MessageExchange odeMessageContext) throws AxisFault {
Element message = odeMessageContext.getResponse().getMessage();
QName faultName = odeMessageContext.getFault();
Operation operation = odeMessageContext.getOperation();
SOAPFactory soapFactory = bpelMessageContext.getSoapFactoryForCurrentMessageFlow();
if (faultName.getNamespaceURI() == null) {
return toFaultDetail(message, soapFactory);
}
Fault f = operation.getFault(faultName.getLocalPart());
if (f == null) {
return toFaultDetail(message, soapFactory);
}
// For faults, there will be exactly one part.
Part p = (Part) f.getMessage().getParts().values().iterator().next();
if (p == null) {
return toFaultDetail(message, soapFactory);
}
Element partEl = DOMUtils.findChildByName(message, new QName(null, p.getName()));
if (partEl == null) {
return toFaultDetail(message, soapFactory);
}
Element detail = DOMUtils.findChildByName(partEl, p.getElementName());
if (detail == null) {
return toFaultDetail(message, soapFactory);
}
return OMUtils.toOM(detail, soapFactory);
}
use of org.wso2.carbon.bpel.core.ode.integration.BPELMessageContext in project carbon-business-process by wso2.
the class SOAPUtils method parseSOAPResponseFromPartner.
public static org.apache.ode.bpel.iapi.Message parseSOAPResponseFromPartner(BPELMessageContext partnerInvocationContext, MessageExchange partnerRoleMessageExchange) throws BPELFault {
org.apache.ode.bpel.iapi.Message messageToODE = partnerRoleMessageExchange.createMessage(partnerRoleMessageExchange.getOperation().getOutput().getMessage().getQName());
BindingOperation bindingOp = getBindingOperation(partnerInvocationContext, partnerRoleMessageExchange.getOperationName());
BindingOutput bindingOutPut = getBindingOutPut(bindingOp);
SOAPEnvelope responseFromPartnerService = partnerInvocationContext.getOutMessageContext().getEnvelope();
if (partnerInvocationContext.isSoap12()) {
javax.wsdl.extensions.soap12.SOAP12Body soapBodyDefinition = getSOAP12Body(bindingOutPut);
if (soapBodyDefinition != null) {
if (responseFromPartnerService.getBody() != null) {
extractSOAPBodyParts(partnerRoleMessageExchange, messageToODE, responseFromPartnerService.getBody(), soapBodyDefinition.getParts(), soapBodyDefinition.getNamespaceURI(), partnerInvocationContext.isRPCStyleOperation());
} else {
throw new BPELFault("SOAP Body cannot be null for WSDL operation which " + "requires SOAP Body.");
}
}
} else {
javax.wsdl.extensions.soap.SOAPBody soapBodyDefinition = getSOAP11Body(bindingOutPut);
if (soapBodyDefinition != null) {
if (responseFromPartnerService.getBody() != null) {
extractSOAPBodyParts(partnerRoleMessageExchange, messageToODE, responseFromPartnerService.getBody(), soapBodyDefinition.getParts(), soapBodyDefinition.getNamespaceURI(), partnerInvocationContext.isRPCStyleOperation());
} else {
throw new BPELFault("SOAP Body cannot be null for WSDL operation which " + "requires SOAP Body.");
}
}
}
if (getSOAPHeaders(bindingOutPut) != null && responseFromPartnerService.getHeader() != null) {
extractSoapHeaderParts(messageToODE, partnerInvocationContext.getBpelServiceWSDLDefinition(), responseFromPartnerService.getHeader(), getSOAPHeaders(bindingOutPut), partnerRoleMessageExchange.getOperation().getOutput().getMessage());
}
return messageToODE;
}
use of org.wso2.carbon.bpel.core.ode.integration.BPELMessageContext in project carbon-business-process by wso2.
the class BPELProcessProxy method createInputMessageToODE.
private Message createInputMessageToODE(final BPELMessageContext bpelMessageContext, final MyRoleMessageExchange messageExchange) throws AxisFault {
// Preparing message to send to ODE
Message odeRequest = messageExchange.createMessage(messageExchange.getOperation().getInput().getMessage().getQName());
fillODEMessage(odeRequest, bpelMessageContext.getRequestMessage());
return odeRequest;
}
use of org.wso2.carbon.bpel.core.ode.integration.BPELMessageContext in project carbon-business-process by wso2.
the class BPELProcessProxy method invokeBPELProcessThroughODEMessageExchange.
private Future invokeBPELProcessThroughODEMessageExchange(final MyRoleMessageExchange odeMessageExchange, final BPELMessageContext bpelMessageContext) throws AxisFault {
Message request = createInputMessageToODE(bpelMessageContext, odeMessageExchange);
if (log.isDebugEnabled()) {
log.debug("Invoking ODE using MEX " + odeMessageExchange);
log.debug("Message content: " + DOMUtils.domToString(request.getMessage()));
}
return odeMessageExchange.invoke(request, bpelMessageContext.getAttachmentIDList());
}
Aggregations