Package org.apache.axis2.description

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 + RESPONSE);
                    }
                }
                addToService = true;
            }
            // Maintain a list of methods we actually work with
            list.add(jMethod);

            processException(jMethod,axisOperation);
            uniqueMethods.put(methodName, jMethod);
            JParameter[] paras = jMethod.getParameters();
            String parameterNames[] = null;
            AxisMessage inMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
            if (inMessage != null) {
                inMessage.setName(methodName + Java2WSDLConstants.MESSAGE_SUFFIX);
            }
            if (paras.length > 0) {
                parameterNames = methodTable.getParameterNames(methodName);
                sequence = new XmlSchemaSequence();

                methodSchemaType = createSchemaTypeForMethodPart(methodName);
                methodSchemaType.setParticle(sequence);
                inMessage.setElementQName(typeTable.getQNamefortheType(methodName));
                service.addMessageElementQNameToOperationMapping(methodSchemaType.getQName(),
                        axisOperation);
            }

            for (int j = 0; j < paras.length; j++) {
                JParameter methodParameter = paras[j];
                String parameterName = null;
                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[j] != null) ?
                            parameterNames[j] : getSimpleName(methodParameter);
                }
                JClass paraType = methodParameter.getType();
                if (nonRpcMethods.contains(getSimpleName(jMethod))) {
                    generateSchemaForType(sequence, null, getSimpleName(jMethod));
                    break;
                } else {
                    generateSchemaForType(sequence, paraType, parameterName);
                }
            }
            // for its return type
            JClass returnType = jMethod.getReturnType();

            if (!returnType.isVoidType()) {
                String partQname = methodName + RESPONSE;
                methodSchemaType =
                        createSchemaTypeForMethodPart(partQname);
                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(getSimpleName(jMethod))) {
                    generateSchemaForType(sequence, null, returnName);
                } else {
                    generateSchemaForType(sequence, returnType, returnName);
                }
                AxisMessage outMessage = axisOperation.getMessage(
                        WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                outMessage.setElementQName(typeTable.getQNamefortheType(partQname));
                outMessage.setName(partQname);
                service.addMessageElementQNameToOperationMapping(methodSchemaType.getQName(),
                        axisOperation);
            }
            if (addToService) {
                service.addOperation(axisOperation);
View Full Code Here


                typeTable.addComplexSchema(partQname,elementName);

                if (AxisFault.class.getName().equals(extype.getQualifiedName())) {
                    continue;
                }
                AxisMessage faultMessage = new AxisMessage();
                faultMessage.setName(extype.getSimpleName());
                faultMessage.setElementQName(typeTable.getQNamefortheType(partQname));
                axisOperation.setFaultMessages(faultMessage);
            }
        }
    }
View Full Code Here

        assertNotNull(service);
        axisConfig.addService(service);
        assertEquals("MyService", service.getName());
        AxisOperation axisOperation = service.getOperation(new QName("add"));
        assertNotNull(axisOperation);
        AxisMessage messge = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        // messge.getSchemaElement().toString()
        assertNotNull(messge);
        assertNotNull(messge.getSchemaElement());
        assertNotNull(service.getOperation(new QName("putValue")));
        assertNotNull(axisConfig.getService("MyService"));
        service.printWSDL(System.out);

        RPCServiceClient client = new RPCServiceClient(clinetConfigurationctx, null);
View Full Code Here

            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(PolicyInclude.AXIS_MESSAGE_POLICY, policyElements,
                                      message.getPolicyInclude());
            }

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

            if (policyRefElements != null) {
                processPolicyRefElements(PolicyInclude.AXIS_MESSAGE_POLICY, policyRefElements,
                                         message.getPolicyInclude());
            }

            processParameters(parameters, message, operation);

        }
View Full Code Here

                        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
View Full Code Here

        mc.setServiceContext(sc);

        mc.setTo(new EndpointReference("axis2/services/NullService"));
        mc.setWSAAction("DummyOp");

        AxisMessage axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        mc.setAxisMessage(axisMessage);

        return mc;
    }
View Full Code Here

        // Walk the fault information
        FaultDescription[] faultDescs = getFaultDescriptions();
        if (faultDescs != null) {
            for (int i=0; i <faultDescs.length; i++) {
       
                AxisMessage faultMessage = new AxisMessage();
                String faultName = faultDescs[i].getName();
                faultMessage.setName(faultName);
               
                String faultAction =
                        WSDL11ActionHelper.getFaultActionFromStringInformation( messageExchangePattern,
                                        portTypeName,
                                        newAxisOperation.getName().getLocalPart(),
                                        faultMessage.getName());
               
                if (faultAction != null) {
                        newAxisOperation.addFaultAction(faultMessage.getName(), faultAction);
                }
                newAxisOperation.setFaultMessages(faultMessage);
            }
        }

        //REVIEW: Determine if other axisOperation values may need to be set
        //      Currently, the following values are being set on AxisOperation in
        //      ServiceBuilder.populateService which we are not setting:
        //          AxisOperation.setPolicyInclude()
        //          AxisOperation.setWsamappingList()
        //          AxisOperation.setOutputAction()
        //          AxisOperation.addFaultAction()
        //          AxisOperation.setFaultMessages()

        // If this is a DOC/LIT/BARE operation, then set the QName of the input AxisMessage to the
        // part for the first IN or IN/OUT non-header parameter.  If there are no parameters, then don't set
        // anything.  The AxisMessage name is used to do SOAP-body based routing of DOC/LIT/BARE
        // incoming messages.
        if (getSoapBindingStyle() == javax.jws.soap.SOAPBinding.Style.DOCUMENT
                && getSoapBindingUse() == javax.jws.soap.SOAPBinding.Use.LITERAL
                && getSoapBindingParameterStyle() == javax.jws.soap.SOAPBinding.ParameterStyle.BARE)
        {
            ParameterDescription[] paramDescs = getParameterDescriptions();
            if (paramDescs != null && paramDescs.length > 0) {
                for (ParameterDescription paramDesc : paramDescs) {
                    WebParam.Mode paramMode = paramDesc.getMode();
                    if (!paramDesc.isHeader()
                            && (paramMode == WebParam.Mode.IN || paramMode == WebParam.Mode.INOUT))
                    {
                        // We've found the first IN or INOUT non-header parameter, so set the AxisMessage
                        // QName based on this parameter then break out of the loop.
                        AxisMessage axisMessage =
                                newAxisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                        String elementName = paramDesc.getParameterName();
                        String partNamespace = paramDesc.getTargetNamespace();
                        if (log.isDebugEnabled()) {
                            log.debug("Setting up annotation based Doc/Lit/Bare operation: " +
                                    newAxisOperation.getName()
                                    + "; axisMessage: " + axisMessage + "; name: "
                                    + elementName + "; partTNS: " + partNamespace);
                        }
                        if (axisMessage == null) {
                            // TODO: RAS & NLS
                            throw ExceptionFactory.makeWebServiceException(
                                    "Could not setup Doc/Lit/Bare operation because input message is null");
                        } else if (DescriptionUtils.isEmpty(partNamespace)) {
                            // TODO: RAS & NLS
                            throw ExceptionFactory.makeWebServiceException(
                                    "Could not setup Doc/Lit/Bare operation because part namespace is empty");
                        } else if (DescriptionUtils.isEmpty(elementName)) {
                            // TODO: RAS & NLS
                            throw ExceptionFactory.makeWebServiceException(
                                    "Could not setup Doc/Lit/Bare operation because name is empty");
                        } else {
                            QName partQName = new QName(partNamespace, elementName);
                            if(log.isDebugEnabled()) {
                                log.debug("Setting AxisMessage element QName for bare mapping: " +
                                        partQName);
                            }
                            axisMessage.setElementQName(partQName);
                        }
                        break;
                    }
                }
            }
View Full Code Here

        }
        if (getSoapBindingStyle() == javax.jws.soap.SOAPBinding.Style.DOCUMENT
                && getSoapBindingUse() == javax.jws.soap.SOAPBinding.Use.LITERAL
                && getSoapBindingParameterStyle() == javax.jws.soap.SOAPBinding.ParameterStyle
                .BARE) {
            AxisMessage axisMessage =
                    null;
            if (axisOperation!=null) {
                axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
            } else {
                axisMessage = newAxisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
            }
            if (axisMessage != null) {
                QName elementQName = axisMessage.getElementQName();
                if (!DescriptionUtils.isEmpty(elementQName)) {
                    axisService.addMessageElementQNameToOperationMapping(elementQName,
                            newAxisOperation);
                }
            }
View Full Code Here

        mc.setServiceContext(sc);

        mc.setTo(new EndpointReference("axis2/services/NullService"));
        mc.setWSAAction("DummyOp");

        AxisMessage axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        mc.setAxisMessage(axisMessage);

        return mc;
    }
View Full Code Here

            AxisOperation op = inMessage.getOperationContext().getAxisOperation();

            OMElement methodElement = inMessage.getEnvelope().getBody()
                    .getFirstElement();

            AxisMessage inAxisMessage = op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
            String messageNameSpace = null;
            String methodName = op.getName().getLocalPart();
            Method[] methods = ImplClass.getMethods();
            for (int i = 0; i < methods.length; i++) {
                if (methods[i].getName().equals(methodName)) {
View Full Code Here

TOP

Related Classes of org.apache.axis2.description.AxisMessage

Copyright © 2018 www.massapicom. 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.