Package org.codehaus.jam

Examples of org.codehaus.jam.JMethod


    /**
     * Generate the porttypes
     */
    private void generatePortType(OMFactory fac, OMElement defintions) {
        JMethod jmethod = null;
        OMElement operation = null;
        OMElement message = null;
        OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME, wsdl);
        defintions.addChild(portType);
        portType.addAttribute(ATTRIBUTE_NAME, serviceName + PORT_TYPE_SUFFIX,
                null);
        //adding message refs
        for (int i = 0; i < method.length; i++) {
            jmethod = method[i];
            operation = fac.createOMElement(OPERATION_LOCAL_NAME, wsdl);
            portType.addChild(operation);
            operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(),
                    null);

            message = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl);
            message.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix()
                    + COLON_SEPARATOR + jmethod.getSimpleName()
                    + MESSAGE_SUFFIX, null);
            operation.addChild(message);

            if (!jmethod.getReturnType().isVoidType()) {
                message = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl);
                message.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix()
                        + COLON_SEPARATOR + jmethod.getSimpleName()
                        + RESPONSE_MESSAGE, null);
                operation.addChild(message);
            }
        }

View Full Code Here


        addExtensionElement(fac, binding, soap, BINDING_LOCAL_NAME, TRANSPORT,
                TRANSPORT_URI, STYLE, style);

        for (int i = 0; i < method.length; i++) {
            JMethod jmethod = method[i];
            OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME,
                    wsdl);
            binding.addChild(operation);

            addExtensionElement(fac, operation, soap, OPERATION_LOCAL_NAME,
                    SOAP_ACTION, URN_PREFIX + COLON_SEPARATOR
                    + jmethod.getSimpleName(), STYLE, style);
            operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(),
                    null);

            OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl);
            addExtensionElement(fac, input, soap, SOAP_BODY, SOAP_USE, use,
                    "namespace", targetNamespace);
            operation.addChild(input);

            if (!jmethod.getReturnType().isVoidType()) {
                OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl);
                addExtensionElement(fac, output, soap, SOAP_BODY, SOAP_USE, use,
                        "namespace", targetNamespace);
                operation.addChild(output);
            }
View Full Code Here

        addExtensionElement(fac, binding, soap12, BINDING_LOCAL_NAME, TRANSPORT,
                TRANSPORT_URI, STYLE, style);

        for (int i = 0; i < method.length; i++) {
            JMethod jmethod = method[i];
            OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME,
                    wsdl);
            binding.addChild(operation);
            operation.declareNamespace(URI_WSDL12_SOAP, SOAP12_PREFIX);

            addExtensionElement(fac, operation, soap12, OPERATION_LOCAL_NAME,
                    SOAP_ACTION, URN_PREFIX + COLON_SEPARATOR
                    + jmethod.getSimpleName(), STYLE, style);
            operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(),
                    null);

            OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl);
            addExtensionElement(fac, input, soap12, SOAP_BODY, SOAP_USE, use,
                    "namespace", targetNamespace);
            operation.addChild(input);

            if (!jmethod.getReturnType().isVoidType()) {
            OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl);
                addExtensionElement(fac, output, soap12, SOAP_BODY, SOAP_USE, use,
                        "namespace", targetNamespace);
            operation.addChild(output);
        }
View Full Code Here

        TypeTable table = schemaGenerator.getTypeTable();

        PhasesInfo pinfo = axisConfiguration.getPhasesInfo();

        for (int i = 0; i < method.length; i++) {
            JMethod jmethod = method[i];
            JAnnotation methodAnnon = jmethod.getAnnotation(AnnotationConstants.WEB_METHOD);
            if (methodAnnon != null) {
                if (methodAnnon.getValue(AnnotationConstants.EXCLUDE).asBoolean()) {
                    continue;
                }
            }
            if (!jmethod.isPublic()) {
                // no need to expose , private and protected methods
                continue;
            } else if (excludeOpeartion.contains(jmethod.getSimpleName())) {
                continue;
            }
            AxisOperation operation = Utils.getAxisOperationforJmethod(jmethod, table);
            String mep = operation.getMessageExchangePattern();
            MessageReceiver mr;
View Full Code Here

        TypeTable table = schemaGenerator.getTypeTable();

        PhasesInfo pinfo = axisConfig.getPhasesInfo();

        for (int i = 0; i < method.length; i++) {
            JMethod jmethod = method[i];
            JAnnotation methodAnnon = jmethod.getAnnotation(AnnotationConstants.WEB_METHOD);
            if (methodAnnon != null) {
                if (methodAnnon.getValue(AnnotationConstants.EXCLUDE).asBoolean()) {
                    continue;
                }
            }
            if (!jmethod.isPublic()) {
                // no need to expose , private and protected methods
                continue;
            } else if (excludeOpeartion.contains(jmethod.getSimpleName())) {
                continue;
            }
            AxisOperation operation = Utils.getAxisOperationforJmethod(jmethod, table);

            // loading message receivers
View Full Code Here

        TypeTable table = schemaGenerator.getTypeTable();
        PhasesInfo pinfo = axisConfig.getPhasesInfo();


        for (int i = 0; i < method.length; i++) {
            JMethod jmethod = method[i];
            JAnnotation methodAnnon = jmethod.getAnnotation(AnnotationConstants.WEB_METHOD);
            if (methodAnnon != null) {
                if (methodAnnon.getValue(AnnotationConstants.EXCLUDE).asBoolean()) {
                    continue;
                }
            }
            if (!jmethod.isPublic()) {
                // no need to expose , private and protected methods
                continue;
            }
            if (excludeOperations != null && excludeOperations.contains(jmethod.getSimpleName())) {
                continue;
            }
            String opName = jmethod.getSimpleName();
            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(jmethod.getSimpleName());
                    inMessage.setElementQName(complexSchemaType);
                    if (complexSchemaType != null) {
                        axisService.addMessageElementQNameToOperationMapping(complexSchemaType,
                                                                             operation);
                    }
                }
                if (!jmethod.getReturnType().isVoidType()) {
                    AxisMessage outMessage = operation.getMessage(
                            WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                    QName qNamefortheType = table.getQNamefortheType(jmethod.getSimpleName() +
                            Java2WSDLConstants.RESPONSE);
                    outMessage.setElementQName(qNamefortheType);
                    if (qNamefortheType != null) {
                        axisService.addMessageElementQNameToOperationMapping(qNamefortheType,
                                                                             operation);
                    }
                    outMessage.setName(opName + Java2WSDLConstants.RESPONSE);
                }
                if (jmethod.getExceptionTypes().length > 0) {
                    JClass[] extypes = jmethod.getExceptionTypes() ;
                    for (int j= 0 ; j < extypes.length ; j++) {
                        AxisMessage faultMessage = new AxisMessage();
                        JClass extype = extypes[j] ;
                        String exname = extype.getSimpleName() ;
                        if(extypes.length>1){
                            faultMessage.setName(jmethod.getSimpleName() + "Fault" + j);
                        } else{
                            faultMessage.setName(jmethod.getSimpleName() + "Fault");
                        }
                        faultMessage.setElementQName(
                                table.getComplexSchemaType(exname + "Fault"));
                        operation.setFaultMessages(faultMessage);
                    }
View Full Code Here

        Hashtable namespaceMap = new Hashtable();
        String namespacePrefix;
        String namespaceURI;
        QName messagePartType;
        for (int i = 0; i < method.length; i++) {
            JMethod jmethod = method[i];
            if (!jmethod.isPublic()) {
                continue;
            }

            //Request Message
            OMElement requestMessge = fac.createOMElement(
                    MESSAGE_LOCAL_NAME, wsdl);
            requestMessge.addAttribute(ATTRIBUTE_NAME, jmethod
                    .getSimpleName()
                    + MESSAGE_SUFFIX, null);
            definitions.addChild(requestMessge);

            // only if a type for the message part has already been defined
            if ((messagePartType = typeTable.getComplexSchemaType(jmethod
                    .getSimpleName())) != null) {
                namespaceURI = messagePartType.getNamespaceURI();
                // avoid duplicate namespaces
                if ((namespacePrefix = (String) messagePartType.getPrefix()) == null &&
                        (namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) {
                    namespacePrefix = generatePrefix();
                    namespaceMap.put(namespaceURI, namespacePrefix);
                }

                OMElement requestPart = fac.createOMElement(
                        PART_ATTRIBUTE_NAME, wsdl);
                requestMessge.addChild(requestPart);
                requestPart.addAttribute(ATTRIBUTE_NAME, "part1", null);

                requestPart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
                        namespacePrefix + COLON_SEPARATOR
                                + jmethod.getSimpleName(), null);
            }

            // only if a type for the message part has already been defined
            if ((messagePartType = typeTable.getComplexSchemaType(jmethod
                    .getSimpleName()
                    + RESPONSE)) != null) {
                namespaceURI = messagePartType.getNamespaceURI();
                if ((namespacePrefix = messagePartType.getPrefix()) == null &&
                        (namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) {
                    namespacePrefix = generatePrefix();
                    namespaceMap.put(namespaceURI, namespacePrefix);
                }
                //Response Message
                OMElement responseMessge = fac.createOMElement(
                        MESSAGE_LOCAL_NAME, wsdl);
                responseMessge.addAttribute(ATTRIBUTE_NAME, jmethod
                        .getSimpleName()
                        + RESPONSE_MESSAGE, null);
                definitions.addChild(responseMessge);
                OMElement responsePart = fac.createOMElement(
                        PART_ATTRIBUTE_NAME, wsdl);
                responseMessge.addChild(responsePart);
                responsePart.addAttribute(ATTRIBUTE_NAME, "part1", null);

                responsePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
                        namespacePrefix + COLON_SEPARATOR
                                + jmethod.getSimpleName() + RESPONSE, null);
            }

            if (jmethod.getExceptionTypes().length > 0) {
                JClass[] extypes = jmethod.getExceptionTypes() ;
                for (int j= 0 ; j < extypes.length ; j++) {
                    JClass extype = extypes[j] ;
                    String exname = extype.getSimpleName() ;
                    String q_exname= extype.getQualifiedName() ;
                    if ((messagePartType = typeTable.getComplexSchemaType(q_exname)) != null) {
View Full Code Here

    /**
     * Generate the porttypes
     */
    private void generatePortType(OMFactory fac, OMElement defintions) {
        JMethod jmethod;
        OMElement operation;
        OMElement message;
        OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME, wsdl);
        defintions.addChild(portType);
        portType.addAttribute(ATTRIBUTE_NAME, serviceName + PORT_TYPE_SUFFIX,
                null);
        //adding message refs
        for (int i = 0; i < method.length; i++) {
            jmethod = method[i];
            if (!jmethod.isPublic()) {
                continue;
            }
            operation = fac.createOMElement(OPERATION_LOCAL_NAME, wsdl);
            portType.addChild(operation);
            operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(),
                    null);

            message = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl);
            OMNamespace namespace = message.declareNamespace(WSAD_NS,
                    "wsaw");
            message.addAttribute("Action", "urn:" + jmethod.getSimpleName(), namespace);
            message.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix()
                    + COLON_SEPARATOR + jmethod.getSimpleName()
                    + MESSAGE_SUFFIX, null);
            operation.addChild(message);

            if (!jmethod.getReturnType().isVoidType()) {
                message = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl);
                message.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix()
                        + COLON_SEPARATOR + jmethod.getSimpleName()
                        + RESPONSE_MESSAGE, null);
                namespace = message.declareNamespace(WSAD_NS,
                        "wsaw");
                message.addAttribute("Action", "urn:" + jmethod.getSimpleName(), namespace);
                operation.addChild(message);
            }
            if (jmethod.getExceptionTypes().length > 0) {
              JClass[] extypes = jmethod.getExceptionTypes() ;
                for (int j= 0 ; j < extypes.length ; j++) {
                JClass extype = extypes[j] ;
                String exname = extype.getSimpleName() ;

                message = fac.createOMElement(FAULT_LOCAL_NAME, wsdl);
View Full Code Here

        addExtensionElement(fac, binding, soap, BINDING_LOCAL_NAME, TRANSPORT,
                TRANSPORT_URI, STYLE, style);

        for (int i = 0; i < method.length; i++) {
            JMethod jmethod = method[i];
            if (!jmethod.isPublic()) {
                continue;
            }
            OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME,
                    wsdl);
            binding.addChild(operation);

            addExtensionElement(fac, operation, soap, OPERATION_LOCAL_NAME,
                    SOAP_ACTION, URN_PREFIX + COLON_SEPARATOR
                    + jmethod.getSimpleName(), STYLE, style);
            operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(),
                    null);

            OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl);
            addExtensionElement(fac, input, soap, SOAP_BODY, SOAP_USE, use);
            operation.addChild(input);

            if (!jmethod.getReturnType().isVoidType()) {
                OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl);
                addExtensionElement(fac, output, soap, SOAP_BODY, SOAP_USE, use);
                operation.addChild(output);
            }

            if (jmethod.getExceptionTypes().length > 0) {
              JClass[] extypes = jmethod.getExceptionTypes() ;
                for (int j= 0 ; j < extypes.length ; j++) {
                  JClass extype = extypes[j] ;
                  String exname = extype.getSimpleName() ;
                  OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME, wsdl);
                  fault.addAttribute(ATTRIBUTE_NAME, exname, null);
View Full Code Here

        addExtensionElement(fac, binding, soap12, BINDING_LOCAL_NAME, TRANSPORT,
                TRANSPORT_URI, STYLE, style);

        for (int i = 0; i < method.length; i++) {
            JMethod jmethod = method[i];
            if (!jmethod.isPublic()) {
                continue;
            }
            OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME,
                    wsdl);
            binding.addChild(operation);
            operation.declareNamespace(URI_WSDL12_SOAP, SOAP12_PREFIX);

            addExtensionElement(fac, operation, soap12, OPERATION_LOCAL_NAME,
                    SOAP_ACTION, URN_PREFIX + COLON_SEPARATOR
                    + jmethod.getSimpleName(), STYLE, style);
            operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(),
                    null);

            OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl);
            addExtensionElement(fac, input, soap12, SOAP_BODY, SOAP_USE, use);
            operation.addChild(input);

            if (!jmethod.getReturnType().isVoidType()) {
                OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl);
                addExtensionElement(fac, output, soap12, SOAP_BODY, SOAP_USE, use);
                operation.addChild(output);
            }
            if (jmethod.getExceptionTypes().length > 0) {
                JClass[] extypes = jmethod.getExceptionTypes() ;
                for (int j= 0 ; j < extypes.length ; j++) {
                    JClass extype = extypes[j] ;
                    String exname = extype.getSimpleName() ;
                    OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME, wsdl);
                    fault.addAttribute(ATTRIBUTE_NAME, exname, null);
View Full Code Here

TOP

Related Classes of org.codehaus.jam.JMethod

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.