Example #1
0
  private void processMessages(Iterator messages, AxisOperation operation)
      throws DeploymentException {
    while (messages.hasNext()) {
      OMElement messageElement = (OMElement) messages.next();
      OMAttribute label = messageElement.getAttribute(new QName(TAG_LABEL));

      if (label == null) {
        throw new DeploymentException(Messages.getMessage("messagelabelcannotfound"));
      }

      AxisMessage message = operation.getMessage(label.getAttributeValue());

      Iterator parameters = messageElement.getChildrenWithName(new QName(TAG_PARAMETER));

      // processing <wsp:Policy> .. </..> elements
      Iterator policyElements =
          messageElement.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY));

      if (policyElements != null) {
        processPolicyElements(policyElements, message.getPolicySubject());
      }

      // processing <wsp:PolicyReference> .. </..> elements
      Iterator policyRefElements =
          messageElement.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF));

      if (policyRefElements != null) {
        processPolicyRefElements(policyRefElements, message.getPolicySubject());
      }

      processParameters(parameters, message, operation);
    }
  }
  private void createMessage() {
    AxisMessage inMessage = new AxisMessage();
    inMessage.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_IN);
    inMessage.setParent(this);

    inFaultMessage = new AxisMessage();
    inFaultMessage.setParent(this);

    outFaultMessage = new AxisMessage();
    outFaultMessage.setParent(this);

    outPhase = new ArrayList();

    addChild("inMessage", inMessage);
  }
Example #3
0
  private ArrayList<AxisOperation> processOperations(Iterator operationsIterator) throws AxisFault {
    ArrayList<AxisOperation> operations = new ArrayList<AxisOperation>();
    while (operationsIterator.hasNext()) {
      OMElement operation = (OMElement) operationsIterator.next();
      // getting operation name
      OMAttribute op_name_att = operation.getAttribute(new QName(ATTRIBUTE_NAME));
      if (op_name_att == null) {
        throw new DeploymentException(
            Messages.getMessage(
                Messages.getMessage(DeploymentErrorMsgs.INVALID_OP, "operation name missing")));
      }

      // setting the MEP of the operation
      OMAttribute op_mep_att = operation.getAttribute(new QName(TAG_MEP));
      String mepurl = null;

      if (op_mep_att != null) {
        mepurl = op_mep_att.getAttributeValue();
      }

      String opname = op_name_att.getAttributeValue();
      AxisOperation op_descrip = null;

      // getting the namesapce from the attribute.
      OMAttribute operationNamespace = operation.getAttribute(new QName(ATTRIBUTE_NAMESPACE));
      if (operationNamespace != null) {
        String namespace = operationNamespace.getAttributeValue();
        op_descrip = service.getOperation(new QName(namespace, opname));
      }
      if (op_descrip == null) {
        op_descrip = service.getOperation(new QName(opname));
      }

      if (op_descrip == null) {
        op_descrip = service.getOperation(new QName(service.getTargetNamespace(), opname));
      }
      if (op_descrip == null) {
        if (mepurl == null) {
          // assumed MEP is in-out
          op_descrip = new InOutAxisOperation();
          op_descrip.setParent(service);

        } else {
          op_descrip = AxisOperationFactory.getOperationDescription(mepurl);
        }
        op_descrip.setName(new QName(opname));
        String MEP = op_descrip.getMessageExchangePattern();
        if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP)
            || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
            || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
            || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
            || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
            || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) {
          AxisMessage inaxisMessage = op_descrip.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
          if (inaxisMessage != null) {
            inaxisMessage.setName(opname + Java2WSDLConstants.MESSAGE_SUFFIX);
          }
        }

        if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(MEP)
            || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
            || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
            || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
            || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) {
          AxisMessage outAxisMessage = op_descrip.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
          if (outAxisMessage != null) {
            outAxisMessage.setName(opname + Java2WSDLConstants.RESPONSE);
          }
        }
      }

      // setting the PolicyInclude

      // processing <wsp:Policy> .. </..> elements
      Iterator policyElements = operation.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY));

      if (policyElements != null && policyElements.hasNext()) {
        processPolicyElements(policyElements, op_descrip.getPolicySubject());
      }

      // processing <wsp:PolicyReference> .. </..> elements
      Iterator policyRefElements =
          operation.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF));

      if (policyRefElements != null && policyRefElements.hasNext()) {
        processPolicyRefElements(policyRefElements, op_descrip.getPolicySubject());
      }

      // Operation Parameters
      Iterator parameters = operation.getChildrenWithName(new QName(TAG_PARAMETER));
      processParameters(parameters, op_descrip, service);
      // To process wsamapping;
      processActionMappings(operation, op_descrip);

      // loading the message receivers
      OMElement receiverElement = operation.getFirstChildWithName(new QName(TAG_MESSAGE_RECEIVER));

      if (receiverElement != null) {
        MessageReceiver messageReceiver =
            loadMessageReceiver(service.getClassLoader(), receiverElement);

        op_descrip.setMessageReceiver(messageReceiver);
      } else {
        // setting default message receiver
        MessageReceiver msgReceiver =
            loadDefaultMessageReceiver(op_descrip.getMessageExchangePattern(), service);
        op_descrip.setMessageReceiver(msgReceiver);
      }

      // Process Module Refs
      Iterator modules = operation.getChildrenWithName(new QName(TAG_MODULE));

      processOperationModuleRefs(modules, op_descrip);

      // processing Messages
      Iterator messages = operation.getChildrenWithName(new QName(TAG_MESSAGE));

      processMessages(messages, op_descrip);

      // setting Operation phase
      if (axisConfig != null) {
        PhasesInfo info = axisConfig.getPhasesInfo();

        info.setOperationPhases(op_descrip);
      }
      Iterator moduleConfigs = operation.getChildrenWithName(new QName(TAG_MODULE_CONFIG));
      processOperationModuleConfig(moduleConfigs, op_descrip, op_descrip);
      // adding the operation
      operations.add(op_descrip);
    }
    return operations;
  }
 public void setPhasesOutFaultFlow(ArrayList list) {
   outFaultMessage.setMessageFlow(list);
 }
 public void setPhasesInFaultFlow(ArrayList list) {
   inFaultMessage.setMessageFlow(list);
 }
 public ArrayList getPhasesOutFaultFlow() {
   return outFaultMessage.getMessageFlow();
 }
 public ArrayList getPhasesInFaultFlow() {
   return inFaultMessage.getMessageFlow();
 }