1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.kandula.wscoor;
18
19 import org.apache.axiom.om.OMElement;
20 import org.apache.axis2.AxisFault;
21 import org.apache.axis2.context.OperationContext;
22 import org.apache.axis2.wsdl.WSDLConstants;
23 import org.apache.kandula.Constants;
24 import org.apache.kandula.context.AbstractContext;
25 import org.apache.kandula.context.CoordinationContext;
26 import org.apache.kandula.storage.StorageFactory;
27
28 /***
29 * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
30 */
31
32 public class ActivationRequesterPortTypeRawXMLSkeleton {
33 private OperationContext opContext;
34
35 public void setOperationContext(OperationContext opContext) {
36 this.opContext = opContext;
37 }
38
39 public OMElement createCoordinationContextResponseOperation(
40 OMElement responseElement) throws AxisFault {
41 OMElement response = responseElement.getFirstElement();
42 if ("CoordinationContext".equals(response.getLocalName())) {
43 OMElement header = opContext.getMessageContext(
44 WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope()
45 .getHeader();
46 String requesterID = header.getFirstChildWithName(
47 Constants.REQUESTER_ID_PARAMETER).getText();
48 CoordinationContext coordinationContext = CoordinationContext.Factory
49 .newContext(response);
50 AbstractContext context = (AbstractContext) StorageFactory
51 .getInstance().getInitiatorStore().get(requesterID);
52 context.setCoordinationContext(coordinationContext);
53 }
54 return null;
55 }
56 }