Package org.apache.ws.commons.om

Examples of org.apache.ws.commons.om.OMAttribute


    protected HandlerDescription processHandler(OMElement handler_element, ParameterInclude parent)
            throws DeploymentException {
        HandlerDescription handler = new HandlerDescription();

        // Setting Handler name
        OMAttribute name_attribute = handler_element.getAttribute(new QName(ATTRIBUTE_NAME));

        if (name_attribute == null) {
            throw new DeploymentException(Messages.getMessage(DeploymentErrorMsgs.INVALID_HANDLER,
                    "Name missing"));
        } else {
            handler.setName(new QName(name_attribute.getAttributeValue()));
        }

        // Setting Handler Class name
        OMAttribute class_attribute = handler_element.getAttribute(new QName(TAG_CLASS_NAME));

        if (class_attribute == null) {
            throw new DeploymentException((Messages.getMessage(DeploymentErrorMsgs.INVALID_HANDLER,
                    "class name is missing")));
        } else {
            handler.setClassName(class_attribute.getAttributeValue());
        }

        // processing phase Rules (order)
        OMElement order_element = handler_element.getFirstChildWithName(new QName(TAG_ORDER));

        if (order_element == null) {
            throw new DeploymentException((Messages.getMessage(DeploymentErrorMsgs.INVALID_HANDLER,
                    "phase rule has not been specified")));
        } else {
            Iterator order_itr = order_element.getAllAttributes();

            while (order_itr.hasNext()) {
                OMAttribute orderAttribute = (OMAttribute) order_itr.next();
                String name = orderAttribute.getQName().getLocalPart();
                String value = orderAttribute.getAttributeValue();

                if (TAG_AFTER.equals(name)) {
                    handler.getRules().setAfter(value);
                } else if (TAG_BEFORE.equals(name)) {
                    handler.getRules().setBefore(value);
View Full Code Here


    protected void processOperationModuleRefs(Iterator moduleRefs, AxisOperation operation)
            throws DeploymentException {
        try {
            while (moduleRefs.hasNext()) {
                OMElement moduleref = (OMElement) moduleRefs.next();
                OMAttribute moduleRefAttribute = moduleref.getAttribute(new QName(TAG_REFERENCE));

                if (moduleRefAttribute != null) {
                    String refName = moduleRefAttribute.getAttributeValue();

                    if (axisConfig.getModule(new QName(refName)) == null) {
                        throw new DeploymentException(
                                Messages.getMessage(DeploymentErrorMsgs.MODULE_NOT_FOUND, refName));
                    } else {
View Full Code Here

            OMElement parameterElement = (OMElement) parameters.next();
            Parameter parameter = new Parameter();
            // setting parameterElement
            parameter.setParameterElement(parameterElement);
            // setting parameter Name
            OMAttribute paramName = parameterElement.getAttribute(new QName(ATTRIBUTE_NAME));
            if (paramName == null) {
                throw new DeploymentException(
                        Messages.getMessage(DeploymentErrorMsgs.BAD_PARAMETER_ARGUMENT,
                                parameterElement.toString()));
            }
            parameter.setName(paramName.getAttributeValue());
            // setting parameter Value (the chiled elemnt of the parameter)
            OMElement paramValue = parameterElement.getFirstElement();
            if (paramValue != null) {
                parameter.setValue(parameterElement);
                parameter.setParameterType(Parameter.OM_PARAMETER);
            } else {
                String paratextValue = parameterElement.getText();

                parameter.setValue(paratextValue);
                parameter.setParameterType(Parameter.TEXT_PARAMETER);
            }
            // setting locking attribute
            OMAttribute paramLocked = parameterElement.getAttribute(new QName(ATTRIBUTE_LOCKED));
            Parameter parentParam = null;
            if (parent != null) {
                parentParam = parent.getParameter(parameter.getName());
            }
            if (paramLocked != null) {
                String lockedValue = paramLocked.getAttributeValue();
                if (BOOLEAN_TRUE.equals(lockedValue)) {
                    // if the parameter is locked at some level parameter value replace by that
                    if ((parent != null) && parent.isParameterLocked(parameter.getName())) {
                        throw new DeploymentException(
                                Messages.getMessage(
View Full Code Here

    public void testSOAP11SetLang() {
        soap11FaultText.setLang("en");
        assertTrue(
                "SOAP 1.1 Fault Text Test : - After calling setLang method, Lang attribute value mismatch",
                soap11FaultText.getLang().equals("en"));
        OMAttribute langAttribute = (OMAttribute) soap11FaultText.getAllAttributes()
                .next();
        assertTrue(
                "SOAP 1.1 Fault Text Test : - After calling setLang method, Lang attribute local name mismaatch",
                langAttribute.getLocalName().equals(
                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME));
        assertTrue(
                "SOAP 1.1 Fault Text Test : - After calling setLang method, Lang attribute namespace prefix mismatch",
                langAttribute.getNamespace().getPrefix().equals(
                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX));
        assertTrue(
                "SOAP 1.1 Fault Text Test : - After calling setLang method, Lang attribute namespace uri mismatch",
                langAttribute.getNamespace().getName().equals(
                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI));
    }
View Full Code Here

    public void testSOAP12SetLang() {
        soap12FaultText.setLang("en");
        assertTrue(
                "SOAP 1.2 Fault Text Test : - After calling setLang method, Lang attribute value mismatch",
                soap12FaultText.getLang().equals("en"));
        OMAttribute langAttribute = (OMAttribute) soap12FaultText.getAllAttributes()
                .next();
        assertTrue(
                "SOAP 1.2 Fault Text Test : - After calling setLang method, Lang attribute local name mismaatch",
                langAttribute.getLocalName().equals(
                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME));
        assertTrue(
                "SOAP 1.2 Fault Text Test : - After calling setLang method, Lang attribute namespace prefix mismatch",
                langAttribute.getNamespace().getPrefix().equals(
                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX));
        assertTrue(
                "SOAP 1.2 Fault Text Test : - After calling setLang method, Lang attribute namespace uri mismatch",
                langAttribute.getNamespace().getName().equals(
                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI));
    }
View Full Code Here

    //SOAP 1.2 Fault Text Test (With Parser)
    public void testSOAP12GetLangWithParser() {
        assertTrue(
                "SOAP 1.2 Fault Text Test With Parser : - getLang method returns incorrect string",
                soap12FaultTextWithParser.getLang().equals("en"));
        OMAttribute langAttribute = (OMAttribute) soap12FaultTextWithParser.getAllAttributes()
                .next();
        assertTrue(
                "SOAP 1.2 Fault Text Test With Parser : - Lang attribute local name mismaatch",
                langAttribute.getLocalName().equals(
                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME));
        assertTrue(
                "SOAP 1.2 Fault Text Test With Parser : - Lang attribute namespace prefix mismatch",
                langAttribute.getNamespace().getPrefix().equals(
                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX));
        assertTrue(
                "SOAP 1.2 Fault Text Test With Parser : - Lang attribute namespace uri mismatch",
                langAttribute.getNamespace().getName().equals(
                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI));
    }
View Full Code Here

     * @param soapEnvelopeNamespaceURI    
     */
    protected void setAttribute(String attributeName,
                                String attrValue,
                                String soapEnvelopeNamespaceURI) {
        OMAttribute omAttribute = this.getAttribute(
                new QName(soapEnvelopeNamespaceURI, attributeName));
        if (omAttribute != null) {
            omAttribute.setAttributeValue(attrValue);
        } else {
            OMAttribute attribute = new OMAttributeImpl(attributeName,
                    new OMNamespaceImpl(soapEnvelopeNamespaceURI,
                            SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX,
                            this.factory),
                    attrValue, this.factory);
            this.addAttribute(attribute);
View Full Code Here

     * @param soapEnvelopeNamespaceURI    
     * @return Returns String.
     */
    protected String getAttribute(String attrName,
                                  String soapEnvelopeNamespaceURI) {
        OMAttribute omAttribute = this.getAttribute(
                new QName(soapEnvelopeNamespaceURI, attrName));
        return (omAttribute != null)
                ? omAttribute.getAttributeValue()
                : null;
    }
View Full Code Here

        OMNamespaceImpl mime = new OMNamespaceImpl(
                "http://www.w3.org/2003/06/xmlmime", "m", fac);

        OMElement text = new OMElementImpl("name", dataName, fac);
        OMAttribute cType1 = new OMAttributeImpl("contentType", mime,
                "text/plain", fac);
        text.addAttribute(cType1);
        byte[] byteArray = new byte[]{13, 56, 65, 32, 12, 12, 7, -3, -2, -1,
                                      98};
        dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));
View Full Code Here

    private void compareAttibutes(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {
        int elementOneAtribCount = 0;
        int elementTwoAtribCount = 0;
        Iterator attributes = elementOne.getAllAttributes();
        while (attributes.hasNext()) {
            OMAttribute omAttribute = (OMAttribute) attributes.next();
            OMAttribute attr = elementTwo.getAttribute(
                    omAttribute.getQName());
            if (attr == null) {
                throw new XMLComparisonException(
                        "Attributes are not the same in two elements. Attribute " +
                        omAttribute.getLocalName() +
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.om.OMAttribute

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.