Examples of AxisMessage


Examples of org.apache.axis2.description.AxisMessage

        AxisOperation op = requestMessageContext.getOperationContext().getAxisOperation();
        AxisService service = requestMessageContext.getAxisService();

        // Handling the response
        OMElement bodyContent;
        AxisMessage outMessage = op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
        if (outMessage.getElementQName() != null) {
            bodyContent = fac.createOMElement(outMessage.getElementQName());
        } else {
            bodyContent =
                    fac.createOMElement(outMessage.getName(),
                            fac.createOMNamespace(service.getTargetNamespace(),
                                    service.getSchemaTargetNamespacePrefix()));
        }

        SOAPEnvelope envelope = fac.getDefaultEnvelope();
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

            axisOperation.addParameter(jsFunctionNameParamter);

            String[] params = extractInputParameters(engine, originalMethodName);

            // Create the in and out axis messages for this operation
            AxisMessage inMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);

            if (inMessage != null) {
                Object inputTypes = annotationParser.getInputTypesNameObject();
                inMessage.setName(method + Java2WSDLConstants.MESSAGE_SUFFIX);
                createAxisBindingMessage(soap11BindingOperation, inMessage,
                        WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                createAxisBindingMessage(soap12BindingOperation, inMessage,
                        WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                createAxisBindingMessage(httpBindingOperation, inMessage,
                        WSDLConstants.MESSAGE_LABEL_IN_VALUE);

                /*
                Generate the input element for the input message using the "inputTypes'
                annotation specified by the user
                */
                XmlSchemaElement element = schemaGenerator
                        .createInputElement(inMessage, inputTypes, operationName, params, method);
                if (element != null) {
                    inMessage.setElementQName(new QName(schemaTargetNamespace, element.getName()));
                }
            }

            AxisMessage outMessage =
                    axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
            Object outputType = annotationParser.getOutputTypeNameObject();
            //we always assume return parameter as "return"
            params = new String[]{"return"};

            if (outMessage != null) {
                outMessage.setName(method + Java2WSDLConstants.RESPONSE_MESSAGE);
                createAxisBindingMessage(soap11BindingOperation, outMessage,
                        WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                createAxisBindingMessage(soap12BindingOperation, outMessage,
                        WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                createAxisBindingMessage(httpBindingOperation, outMessage,
                        WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                /*
                Generate the output element for the input message using the "outputType"
                annotation specified by the user
                */
                XmlSchemaElement element = schemaGenerator
                        .createOutputElement(outMessage, outputType, operationName, params, method);
                if (element != null) {
                    outMessage.setElementQName(new QName(schemaTargetNamespace, element.getName()));
                }
            }
            axisService.addOperation(axisOperation);
            axisConfig.getPhasesInfo().setOperationPhases(axisOperation);
        }
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

        if (axisService == null) {
            throw new AxisFault("invalid service name");
        }

        AxisMessage axisMessage =
                axisService.getOperation(new QName(operationName)).getMessage(messageType);

        PolicySubject messagePolicySubject = axisMessage.getPolicySubject();
        List<PolicyComponent> policyList =
                new ArrayList<PolicyComponent>(messagePolicySubject.getAttachedPolicyComponents());
        Policy messagePolicy = org.apache.axis2.util.PolicyUtil.getMergedPolicy(policyList,
                                                                                axisService);
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

                Map axisMessagesMap = new AxisMessageLookup().lookup(operation);
                Set axisMessagesSet = axisMessagesMap.entrySet();
                for (Iterator iterator1 = axisMessagesSet.iterator(); iterator1.hasNext();) {
                    Map.Entry me = (Map.Entry) iterator1.next();
                    String lableKey = (String) me.getKey();
                    AxisMessage axisMessage = (AxisMessage) me.getValue();
                    OMElement axisMessageEle = createOMElement(fac, ns,
                                                               DeploymentConstants.TAG_MESSAGE);
                    OMAttribute axisMessageLableAttr = createOMAttribute(fac, ns,
                                                                         DeploymentConstants.TAG_LABEL, lableKey);
                    axisMessageEle.addAttribute(axisMessageLableAttr);

                    List axisMessageParameterList = axisMessage.getParameters();
                    serializeParameterList(axisMessageParameterList, axisMessageEle, fac, ns);

                    PolicyInclude policyInclude = operation.getPolicyInclude();
                    PolicyRegistry registry = policyInclude.getPolicyRegistry();
                    List policyList = policyInclude
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

               // BufferedReader reader = readRubyScript(inMessage);
                String script =  getRubyScript(inMessage.getAxisService());
                String rubyFunctionName = inferRubyFunctionName(inMessage);
                OMElement payload = getArgs(inMessage);

                AxisMessage inAxisMessage = inMessage.getAxisOperation().getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                AxisMessage outAxisMessage = inMessage.getAxisOperation().getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);



            Object args = payload;
            if (payload != null) {
                // We neet to get the Axis Message from the incomming message so that we can get its schema.
                // We need the schema in order to unwrap the parameters.

                AxisMessage axisMessage = inMessage.getAxisOperation().getMessage(
                        WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                XmlSchemaElement xmlSchemaElement = axisMessage.getSchemaElement();
                if (xmlSchemaElement != null) {
                    // Once the schema is obtained we iterate through the schema looking for the elemants in the payload.
                    // for Each element we extract its value and create a parameter which can be passed into the
                    // pythonscript function.
                    XmlSchemaType schemaType = xmlSchemaElement.getSchemaType();
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

            Object args = payload;
            if (payload != null) {

                // We neet to get the Axis Message from the incomming message so that we can get its schema.
                // We need the schema in order to unwrap the parameters.
                AxisMessage axisMessage = inMessage.getAxisOperation().getMessage(
                        WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                XmlSchemaElement xmlSchemaElement = axisMessage.getSchemaElement();
                if (xmlSchemaElement != null) {

                    // Once the schema is obtained we iterate through the schema looking for the elements in the payload.
                    // for Each element we extract its value and create a parameter which can be passed into the
                    // javascript function.
                    XmlSchemaType schemaType = xmlSchemaElement.getSchemaType();
                    if (schemaType instanceof XmlSchemaComplexType) {
                        XmlSchemaComplexType complexType = ((XmlSchemaComplexType) schemaType);
                        List params = handleComplexTypeInRequest(complexType, payload, engine,
                                new ArrayList());
                        args = params.toArray();
                    } else if (xmlSchemaElement.getSchemaTypeName() == Constants.XSD_ANYTYPE) {
                        args = payload;
                    }
                }
            } else {
                // This validates whether the user has sent a bad SOAP message
                // with a non-XML payload.
                if (soapEnvelope.getBody().getFirstOMChild() != null) {
                    OMText textPayLoad = (OMText) soapEnvelope.getBody().getFirstOMChild();
                    //we allow only a sequence of spaces
                    if (textPayLoad.getText().trim().length() > 0) {
                        throw new AxisFault(
                                "Non-XML payload is not allowed. PayLoad inside the SOAP body needs to be an XML element.");
                    }
                }
            }
            AxisMessage outAxisMessage = inMessage.getAxisOperation().getMessage(
                    WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
            // Get the result by executing the javascript file
            boolean annotated = false;
            Parameter parameter = outAxisMessage.getParameter(MashupConstants.ANNOTATED);
            if (parameter != null) {
                annotated = (Boolean) parameter.getValue();
            }
            Object response = engine.call(jsFunctionName, reader, args, scripts);

            // Create the outgoing message
            SOAPFactory fac;
            if (inMessage.isSOAP11()) {
                fac = OMAbstractFactory.getSOAP11Factory();
            } else {
                fac = OMAbstractFactory.getSOAP12Factory();
            }
            SOAPEnvelope envelope = fac.getDefaultEnvelope();
            SOAPBody body = envelope.getBody();
            XmlSchemaElement xmlSchemaElement = outAxisMessage.getSchemaElement();
            OMElement outElement;
            String prefix = "ws";
            if (xmlSchemaElement != null) {
                QName elementQName = xmlSchemaElement.getSchemaTypeName();
                OMNamespace namespace = fac.createOMNamespace(elementQName.getNamespaceURI(),
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

    String requestName = request.getRequestName();
    AxisOperation axisOp = cparams.getAxisService().getOperation(new QName(requestName));
    CallQueryGroup cqGroup = request.getCallQueryGroup();
    CallQuery defCallQuery = cqGroup.getDefaultCallQuery();
    Query query = defCallQuery.getQuery();
    AxisMessage inMessage = axisOp.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
    /* only create input parameters, if there are any available */
    if (inMessage != null &&
        (cparams.getDataService().isEmptyParamFix() ||
        defCallQuery.getWithParams().size() > 0)) {
      inMessage.setName(requestName + Java2WSDLConstants.MESSAGE_SUFFIX)
      /* create input message element */
      XmlSchemaElement inputElement = createElement(cparams, query.getInputNamespace(),
          requestName, true);
      /* complex type for input message element */
      XmlSchemaComplexType inputComplexType = createComplexType(cparams,
          query.getInputNamespace(), requestName, false);
      /* set element type */
      inputElement.setType(inputComplexType);
      /* batch requests */
      if (request instanceof Operation && ((Operation) request).isBatchRequest()) {
        XmlSchemaElement nestedEl = new XmlSchemaElement();
        Operation parentOp = ((Operation) request).getParentOperation()
            if (parentOp != null) {
              nestedEl.setRefName(cparams.getRequestInputElementMap().get(
                  parentOp.getRequestName()));
              nestedEl.setMaxOccurs(Long.MAX_VALUE);
              addElementToComplexTypeSequence(cparams, inputComplexType, query.getInputNamespace(),
                  nestedEl, false);
            } else {
          throw new DataServiceFault("No parent operation for batch request: "
              + request.getRequestName());
            }
      } else {
        /* normal requests */
        XmlSchemaElement tmpEl;
        Map<String, WithParam> withParams = defCallQuery.getWithParams();
        WithParam tmpWithParam;
        /* create elements for individual parameters */
        for (QueryParam queryParam : query.getQueryParams()) {
          if (DBConstants.QueryTypes.IN.equals(queryParam.getType())
              || DBConstants.QueryTypes.INOUT.equals(queryParam.getType())) {
            tmpWithParam = withParams.get(queryParam.getName());
            if (tmpWithParam == null) {
              /* this query param's value must be coming from an export, not from the
               * operation's parameter */
              continue;
            }
            tmpEl = createInputEntryElement(cparams, query, queryParam, tmpWithParam);
            /* add to input element complex type */
            addElementToComplexTypeSequence(cparams, inputComplexType, query.getInputNamespace(),
                tmpEl, false);
          }
        }       
      }
      /* set the input element qname in message */
      inMessage.setElementQName(inputElement.getQName());
      /* store request name and element qname mapping */
      cparams.getRequestInputElementMap().put(request.getRequestName(),
          inMessage.getElementQName());
    }
  }
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

      return;
    }
   
    AxisOperation axisOp = cparams.getAxisService().getOperation(
        new QName(request.getRequestName()));
    AxisMessage outMessage = axisOp.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
    outMessage.setName(request.getRequestName() + Java2WSDLConstants.RESPONSE);
   
    if (request.isReturnRequestStatus()) {
      outMessage.setElementQName(new QName(DBConstants.WSO2_DS_NAMESPACE,
          DBConstants.REQUEST_STATUS_WRAPPER_ELEMENT));
      return;
    }
   
    Result result = defCQ.getQuery().getResult();
    if (result.isXsAny() || result.getResultType() == ResultTypes.RDF) {
      outMessage.setElementQName(Constants.XSD_ANYTYPE);
      return;
    }
   
    /* create dummy element to contain the result element */
    XmlSchemaElement dummyParentElement = new XmlSchemaElement();
    dummyParentElement.setQName(new QName(result.getNamespace(), DUMMY_NAME));
    XmlSchema dummySchema = retrieveSchema(cparams, result.getNamespace());
    XmlSchemaComplexType dummyType = new XmlSchemaComplexType(dummySchema);
    dummyType.setName(DUMMY_NAME);
    dummyParentElement.setType(dummyType);
    /* lets do it */
    processCallQuery(cparams, dummyParentElement, defCQ);
    /* extract the element and set it to the message */
    XmlSchemaElement resultEl = (XmlSchemaElement) ((XmlSchemaSequence) dummyType.getParticle())
        .getItems().getItem(0);
    outMessage.setElementQName(resultEl.getRefName());
  }
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

  }
 
  private static AxisMessage getAxisMessageFromOperation(
      AxisOperation axisOperation, String direction) {
    Iterator<AxisMessage> msgs = axisOperation.getMessages();
    AxisMessage tmpAxisMessage = null;
    while (msgs.hasNext()) {
      tmpAxisMessage = msgs.next();
      if (tmpAxisMessage.getDirection().equals(direction)) {
        return tmpAxisMessage;
      }
    }   
    return null;
  }
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

    }
    }
 
  private static List<QueryParam> getQueryParamsFromAxisOperation(Map<QName, Document> modelMap,
      Map<QName, String> elementMap, AxisOperation axisOperation) throws DataServiceFault {
    AxisMessage axisMessage = getAxisMessageFromOperation(axisOperation, "in");
    if (axisMessage == null) {
      throw new DataServiceFault(
          "Valid in message cannot be found for the operation '"
              + axisOperation.getName() + "'");
    }
    XmlSchemaElement inMsgElement = axisMessage.getSchemaElement();
    /* no query params - return empty list */
    if (inMsgElement == null) {
      return new ArrayList<QueryParam>();
    }
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.