Examples of AxisMessage


Examples of org.apache.axis2.description.AxisMessage

     * @param operation
     * @return Returns Element.
     */
    protected Element   getOutputParamElement(Document doc, AxisOperation operation) {
        Element paramElement = doc.createElement("param");
        AxisMessage outputMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
        String typeMappingStr;
        String parameterName;

        if (outputMessage != null) {
            parameterName = this.mapper.getParameterName(outputMessage.getElementQName());
            String typeMapping = this.mapper.getTypeMappingName(outputMessage.getElementQName());
            typeMappingStr = (typeMapping == null)
                    ? ""
                    : typeMapping;
        } else {
            parameterName = "";
            typeMappingStr = "";
        }

        addAttribute(doc, "name", parameterName, paramElement);
        addAttribute(doc, "type", typeMappingStr, paramElement);

        //adds the short type
        addShortType(paramElement,
                (outputMessage.getElementQName() == null) ? null :
                        outputMessage.getElementQName().getLocalPart());

        // add an extra attribute to say whether the type mapping is the default
        if (mapper.getDefaultMappingName().equals(typeMappingStr)) {
            addAttribute(doc, "default", "yes", paramElement);
        }

        // add this as a body parameter
        addAttribute(doc, "location", "body", paramElement);
        String localPart = operation.getName().getLocalPart();
        addAttribute(doc, "opname", JavaUtils.xmlNameToJava(localPart), paramElement);

        //if the unwrapping or backWordCompatibility flag is on then we have to
        //put the element complex type if it exits
        if (this.codeGenConfiguration.isBackwordCompatibilityMode() ||
                !this.codeGenConfiguration.isParametersWrapped()) {
            if (outputMessage.getParameter(Constants.COMPLEX_TYPE) != null) {
                Parameter parameter = outputMessage.getParameter(Constants.COMPLEX_TYPE);
                addAttribute(doc, "complextype", (String) parameter.getValue(), paramElement);
            }
        }
        String partName = outputMessage.getPartName();
        if (partName != null && codeGenConfiguration.getOutputLanguage().equals("jax-ws")) {
            String javaName = null;
            if (JavaUtils.isJavaKeyword(partName)) {
                javaName = JavaUtils.makeNonJavaKeyword(partName);
            } else {
                javaName = JavaUtils.xmlNameToJavaIdentifier(JavaUtils.xmlNameToJava(partName));
            }
            addAttribute(doc, "partname", javaName, paramElement);
        }

        // this message has been unwrapped - find the correct references of the
        // the message by looking at the unwrapped details object and attach the
        // needed parameters inside main parameter element
        if (outputMessage.getParameter(Constants.UNWRAPPED_KEY) != null) {

            //we have this unwrapped earlier. get the info holder
            //and then look at the parameters
            Parameter detailsParameter =
                    outputMessage.getParameter(Constants.UNWRAPPED_DETAILS);
            MessagePartInformationHolder infoHolder =
                    (MessagePartInformationHolder) detailsParameter.getValue();
            List partsList = infoHolder.getPartsList();

            //populate the parts list - this list is needed to generate multiple
            //parameters in the signatures
            // in out put params we only intersted if there is only one parameter
            // otherwise we can not unwrap it.
            if (partsList.size() == 1) {
                QName qName = (QName) partsList.get(0);
                paramElement.appendChild(generateParamComponent(doc,
                        this.mapper.getParameterName(qName),
                        this.mapper.getTypeMappingName(
                                qName),
                        operation.getName(),
                        qName,
                        qName.getLocalPart(),
                        (this.mapper.getTypeMappingStatus(
                                qName) != null),
                        Constants.ARRAY_TYPE.equals(
                                this.mapper.getTypeMappingStatus(
                                        qName)))
                );
            }

        }

        QName paramQName = outputMessage.getElementQName();
        if (paramQName != null) {
            Element qNameElement = doc.createElement("qname");
            addAttribute(doc, "nsuri", paramQName.getNamespaceURI(), qNameElement);
            addAttribute(doc, "localname", paramQName.getLocalPart(), qNameElement);
            paramElement.appendChild(qNameElement);
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

        String tmpElementName = null;

        //-------------------------------------
        // first try the "out" message
        //-------------------------------------
        AxisMessage out = null;
        try {
            out = op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
        } catch (Exception ex) {
            // just absorb the exception
        }

        if (out != null) {
            tmpName = out.getName();

            QName tmpQout = out.getElementQName();
            if (tmpQout != null) {
                tmpElementName = tmpQout.toString();
            }
        }

        // check the criteria for a match

        boolean matching = matchMessageNames(tmpName, tmpElementName, msgName, msgElementName);

        if (matching) {
            // trace point
            if (log.isTraceEnabled()) {
                log.trace("ObjectStateUtils:findMessage(): returning OUT message  [" + msgName
                        + "]  [" + msgElementName + "] ");
            }

            return out;
        }

        //-------------------------------------
        // next, try the "in" message
        //-------------------------------------
        AxisMessage in = null;
        try {
            in = op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        } catch (Exception ex) {
            // just absorb the exception
        }

        if (in != null) {
            tmpName = in.getName();

            QName tmpQin = in.getElementQName();
            if (tmpQin != null) {
                tmpElementName = tmpQin.toString();
            }
        } else {
            tmpName = null;
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

            AxisOperation op = inMessage.getOperationContext().getAxisOperation();
            method = (Method)(op.getParameterValue("myMethod"));
            AxisService service = inMessage.getAxisService();
            OMElement methodElement = inMessage.getEnvelope().getBody()
                    .getFirstElement();
            AxisMessage inAxisMessage = op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
            String messageNameSpace = null;


            if (method == null) {
                String methodName = op.getName().getLocalPart();
                Method[] methods = ImplClass.getMethods();

                for (int i = 0; i < methods.length; i++) {
                    if (methods[i].getName().equals(methodName)) {
                        method = methods[i];
                        op.addParameter("myMethod", method);
                        break;
                    }
                }
                if (method == null) {
                    throw new AxisFault("No such method '" + methodName +
                            "' in class " + ImplClass.getName());
                }
            }
            Object resObject = null;
            if (inAxisMessage != null) {
                resObject = RPCUtil.invokeServiceClass(inAxisMessage,
                        method,
                        obj,
                        messageNameSpace,
                        methodElement,inMessage);
            }


            SOAPFactory fac = getSOAPFactory(inMessage);

            // Handling the response
            AxisMessage outaxisMessage = op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
            if (outaxisMessage != null && outaxisMessage.getElementQName() !=null) {
                messageNameSpace = outaxisMessage.getElementQName().getNamespaceURI();
            } else {
                messageNameSpace = service.getTargetNamespace();
            }

            OMNamespace ns = fac.createOMNamespace(messageNameSpace,
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

        SOAPEnvelope soapEnvelope = soapFactory.getDefaultEnvelope();
        SOAPBody body = soapEnvelope.getBody();
        XmlSchemaElement xmlSchemaElement = null;
        AxisOperation axisOperation = messageContext.getAxisOperation();
        if (axisOperation != null) {
            AxisMessage axisMessage =
                    axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
            xmlSchemaElement = axisMessage.getSchemaElement();

        if (xmlSchemaElement == null) {
            OMElement bodyFirstChild =
                            soapFactory.createOMElement(messageContext.getAxisOperation().getName(), body);
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

            AxisOperation axisOperation = service.getOperation(new QName(methodName));
            if (axisOperation == null) {
                axisOperation = Utils.getAxisOperationForJmethod(jMethod);
                if (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(
                        axisOperation.getMessageExchangePattern())){
                    AxisMessage outMessage = axisOperation.getMessage(
                            WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                    if (outMessage !=null ){
                        outMessage.setName(methodName + RESULT);
                    }
                }
                addToService = true;
            }

            // Maintain a list of methods we actually work with
            list.add(jMethod);
            processException(jMethod,axisOperation);
            uniqueMethods.put(getSimpleName(jMethod), jMethod);
            //create the schema type for the method wrapper

            uniqueMethods.put(getSimpleName(jMethod), jMethod);
            JParameter[] paras = jMethod.getParameters();
            String parameterNames[] = methodTable.getParameterNames(methodName);
            AxisMessage inMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
            if (inMessage != null) {
                inMessage.setName(methodName + "RequestMessage");
            }
            if (paras.length > 1) {
                sequence = new XmlSchemaSequence();
                methodSchemaType = createSchemaTypeForMethodPart(getSimpleName(jMethod));
                methodSchemaType.setParticle(sequence);
                inMessage.setElementQName(typeTable.getQNamefortheType(methodName));
                service.addMessageElementQNameToOperationMapping(methodSchemaType.getQName(),
                        axisOperation);
                inMessage.setPartName(methodName);
                for (int j = 0; j < paras.length; j++) {
                    JParameter methodParameter = paras[j];
                    if (generateRequestSchema(methodParameter, parameterNames, j, jMethod, sequence)) {
                        break;
                    }
                }
            } else if (paras.length == 1) {
                if (paras[0].getType().isArrayType()) {
                    sequence = new XmlSchemaSequence();

                    methodSchemaType = createSchemaTypeForMethodPart(methodName);
                    methodSchemaType.setParticle(sequence);
                    JParameter methodParameter = paras[0];
                    inMessage.setElementQName(typeTable.getQNamefortheType(methodName));
                    service.addMessageElementQNameToOperationMapping(methodSchemaType.getQName(),
                            axisOperation);
                    inMessage.setPartName(methodName);
                    if (generateRequestSchema(methodParameter, parameterNames, 0, jMethod, sequence)) {
                        break;
                    }
                } else {
                    String parameterName = null;
                    JParameter methodParameter = paras[0];
                    JAnnotation paramterAnnon =
                            methodParameter.getAnnotation(AnnotationConstants.WEB_PARAM);
                    if (paramterAnnon != null) {
                        parameterName =
                                paramterAnnon.getValue(AnnotationConstants.NAME).asString();
                    }
                    if (parameterName == null || "".equals(parameterName)) {
                        parameterName = (parameterNames != null && parameterNames[0] != null) ?
                                parameterNames[0] : getSimpleName(methodParameter);
                    }
                    JMethod processMethod = (JMethod) processedParameters.get(parameterName);
                    if (processMethod != null) {
                        throw new AxisFault("Inavalid Java class," +
                                " there are two methods [" + processMethod.getSimpleName() + " and " +
                                jMethod.getSimpleName() + " ]which have the same parameter names");
                    } else {
                        processedParameters.put(parameterName, jMethod);
                        generateSchemaForType(null, paras[0].getType(), parameterName);
                        inMessage.setElementQName(typeTable.getQNamefortheType(parameterName));
                        inMessage.setPartName(parameterName);
                        inMessage.setWrapped(false);
                        service.addMessageElementQNameToOperationMapping(typeTable.getQNamefortheType(parameterName),
                                axisOperation);
                    }
                }
            }

            // for its return type
            JClass returnType = jMethod.getReturnType();

            if (!returnType.isVoidType()) {
                AxisMessage outMessage = axisOperation.getMessage(
                        WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                if (returnType.isArrayType()) {
                    methodSchemaType =
                            createSchemaTypeForMethodPart(getSimpleName(jMethod) + RESULT);
                    sequence = new XmlSchemaSequence();
                    methodSchemaType.setParticle(sequence);
                    JAnnotation returnAnnon =
                            jMethod.getAnnotation(AnnotationConstants.WEB_RESULT);
                    String returnName = "return";
                    if (returnAnnon != null) {
                        returnName = returnAnnon.getValue(AnnotationConstants.NAME).asString();
                        if (returnName != null && !"".equals(returnName)) {
                            returnName = "return";
                        }
                    }
                    if (nonRpcMethods.contains(methodName)) {
                        generateSchemaForType(sequence, null, returnName);
                    } else {
                        generateSchemaForType(sequence, returnType, returnName);
                    }
                } else {
                    generateSchemaForType(null, returnType, methodName + RESULT);
                    outMessage.setWrapped(false);
                }
                outMessage.setElementQName(typeTable.getQNamefortheType(methodName + RESULT));
                outMessage.setName(methodName + "ResponseMessage");
                outMessage.setPartName(methodName + RESULT);
                service.addMessageElementQNameToOperationMapping(
                        typeTable.getQNamefortheType(methodName + RESULT),
                        axisOperation);
            }
            if (addToService) {
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

                    inMessageContext.setServiceContext(outMessageContext.getServiceContext());
                    if (!operationContext.isComplete()) {
                        operationContext.addMessageContext(inMessageContext);
                    }
                    AxisOperation axisOp = operationContext.getAxisOperation();
                    AxisMessage inMessage = axisOp.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                    inMessageContext.setAxisMessage(inMessage);
                    inMessageContext.setServerSide(false);
                }

            } else {
                msgCtx.setOperationContext(operationContext);
                msgCtx.setServiceContext(outMessageContext.getServiceContext());
                AxisOperation axisOp = operationContext.getAxisOperation();
                AxisMessage inMessage = axisOp.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                msgCtx.setAxisMessage(inMessage);
                msgCtx.setTransportIn(inMessageContext.getTransportIn());
                msgCtx.setTransportOut(inMessageContext.getTransportOut());
                msgCtx.setServerSide(false);
                msgCtx.setProperty(BaseConstants.MAIL_CONTENT_TYPE,
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

        assertNotNull(er);
        AxisService service = er.getService("MessagetestService");
        assertNotNull(service);
        AxisOperation op = service.getOperation(new QName("echoString"));
        assertNotNull(op);
        AxisMessage message = op.getMessage("In");
        assertNotNull(message);
        Parameter para = message.getParameter("messageIN");
        assertNotNull(para);
        assertEquals(para.getValue(), "messageIN");


        op = service.getOperation(new QName("echoStringArray"));
        assertNotNull(op);
        message = op.getMessage("In");
        assertNotNull(message);
        para = message.getParameter("messageIN");
        assertNotNull(para);
        assertEquals(para.getValue(), "messageIN");

        message = op.getMessage("Out");
        assertNotNull(message);
        para = message.getParameter("messageOut");
        assertNotNull(para);
        assertEquals(para.getValue(), "messageOut");

    }
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

                continue;
            }
            AxisOperation operation = axisService.getOperation(new QName(opName));
            // if the operation there in services.xml then try to set it schema element name
            if (operation != null) {
                AxisMessage inMessage = operation.getMessage(
                        WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                if (inMessage != null) {
                    inMessage.setName(opName + Java2WSDLConstants.MESSAGE_SUFFIX);
                    QName complexSchemaType = table.getComplexSchemaType(opName);
                    inMessage.setElementQName(complexSchemaType);
                    if (complexSchemaType != null) {
                        axisService.addMessageElementQNameToOperationMapping(complexSchemaType,
                                operation);
                    }
                }
                DataType returnType = corbaOperation.getReturnType();
                if (returnType != null && !CorbaUtil.getQualifiedName(returnType).equals(VOID)) {
                    AxisMessage outMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                    QName qNamefortheType = table.getQNamefortheType(opName + RESPONSE);
                    outMessage.setElementQName(qNamefortheType);
                    if (qNamefortheType != null) {
                        axisService.addMessageElementQNameToOperationMapping(qNamefortheType, operation);
                    }
                    outMessage.setName(opName + RESPONSE);
                }
                if (corbaOperation.hasRaises()) {
                    List extypes = corbaOperation.getRaises();
                    for (int j = 0; j < extypes.size(); j++) {
                        AxisMessage faultMessage = new AxisMessage();
                        ExceptionType extype = (ExceptionType) extypes.get(j);
                        String exname = extype.getName() ;
                        if(extypes.size()>1){
                            faultMessage.setName(opName + FAULT + j);
                        } else{
                            faultMessage.setName(opName + FAULT);
                        }
                        faultMessage.setElementQName(
                                table.getComplexSchemaType(exname + FAULT));
                        operation.setFaultMessages(faultMessage);
                    }

                }
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

        String opName = corbaOperation.getName();
        DataType returnType = corbaOperation.getReturnType();
        if (returnType == null || CorbaUtil.getQualifiedName(returnType).equals(VOID)) {
            if (corbaOperation.hasRaises()) {
                operation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_OUT);
                AxisMessage outMessage = operation.getMessage(
                        WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                outMessage.setElementQName(table.getQNamefortheType(opName + RESPONSE));
                outMessage.setName(opName + RESPONSE);
            } else {
                operation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_ONLY);
            }
        } else {
            operation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_OUT);
            AxisMessage outMessage = operation.getMessage(
                    WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
            outMessage.setElementQName(table.getQNamefortheType(opName + RESPONSE));
            outMessage.setName(opName + RESPONSE);
        }
        if (corbaOperation.hasRaises()) {
            List extypes = corbaOperation.getRaises();
            for (int j= 0 ; j < extypes.size() ; j++) {
                AxisMessage faultMessage = new AxisMessage();
                ExceptionType extype = (ExceptionType) extypes.get(j);
                String exname = extype.getName() ;
                if(extypes.size() >1){
                    faultMessage.setName(opName + FAULT + j);
                } else {
                    faultMessage.setName(opName + FAULT);
                }
                faultMessage.setElementQName(
                        table.getComplexSchemaType(exname + FAULT));
                operation.setFaultMessages(faultMessage);
            }
        }
        operation.setName(new QName(opName));
        AxisMessage inMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        if (inMessage != null) {
            inMessage.setElementQName(table.getComplexSchemaType(opName));
            inMessage.setName(opName + Java2WSDLConstants.MESSAGE_SUFFIX);
        }
        return operation;
    }
View Full Code Here

Examples of org.apache.axis2.description.AxisMessage

        try {
            AxisOperation op = inMessage.getOperationContext().getAxisOperation();
            AxisService service = inMessage.getAxisService();
            OMElement methodElement = inMessage.getEnvelope().getBody().getFirstElement();

            AxisMessage inAxisMessage = op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
            String messageNameSpace;
            QName elementQName;
            methodName = op.getName().getLocalPart();

            Invoker invoker = (Invoker) invokerCache.get(methodName);
            if (invoker==null) {
                if (orb==null) {
                    Parameter orbParam = service.getParameter(ORB_LITERAL);
                    orb = orbParam != null ? (ORB) orbParam.getValue() : CorbaUtil.getORB(service);
                }
                org.omg.CORBA.Object obj = CorbaUtil.resolveObject(service, orb);
                Parameter idlParameter = service.getParameter(IDL_LITERAL);
                if (idlParameter==null)
                    throw new CorbaInvocationException("No IDL found");
                IDL idl = (IDL) idlParameter.getValue();
                invoker = CorbaUtil.getInvoker(service, obj, idl, methodName);
                invokerCache.put(methodName, invoker);
            }

            if (inAxisMessage != null) {
                if (inAxisMessage.getElementQName()!=null) {
                    elementQName = inAxisMessage.getElementQName();
                    messageNameSpace = elementQName.getNamespaceURI();
                    OMNamespace namespace = methodElement.getNamespace();
                    if (messageNameSpace != null) {
                        if (namespace == null ||
                                !messageNameSpace.equals(namespace.getNamespaceURI())) {
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.