Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMNamespace


                SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) o;
                headerBlock.detach();
            } else if (o instanceof OMElement) {
                // work around for a known addressing bug which sends non SOAPHeaderBlock objects
                OMElement om = (OMElement) o;
                OMNamespace ns = om.getNamespace();
                if (ns != null && (
                    AddressingConstants.Submission.WSA_NAMESPACE.equals(ns.getNamespaceURI()) ||
                        AddressingConstants.Final.WSA_NAMESPACE.equals(ns.getNamespaceURI()))) {
                    om.detach();
                }
            }
        }
    }
View Full Code Here


     * Return true if the SOAP header is an addressing header
     * @param headerBlock SOAP header block to be checked
     * @return true if the SOAP header is an addressing header
     */
    private static boolean isAddressingHeader(SOAPHeaderBlock headerBlock) {
        OMNamespace ns = headerBlock.getNamespace();
        return ns != null && (
                AddressingConstants.Submission.WSA_NAMESPACE.equals(ns.getNamespaceURI()) ||
                        AddressingConstants.Final.WSA_NAMESPACE.equals(ns.getNamespaceURI()));
    }
View Full Code Here

            proxyService.addOperation(mediateOperation);
        }

        // if a WSDL was found
        if (wsdlElement != null) {
            OMNamespace wsdlNamespace = wsdlElement.getNamespace();

            // serialize and create an input stream to read WSDL
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            try {
                if (trace()) trace.info("Serializing wsdlElement found to build an Axis2 service");
                wsdlElement.serialize(baos);
                wsdlInputStream = new ByteArrayInputStream(baos.toByteArray());
            } catch (XMLStreamException e) {
                handleException("Error converting to a StreamSource", e);
            }

            if (wsdlInputStream != null) {

                try {
                    // detect version of the WSDL 1.1 or 2.0
                    if (trace()) trace.info("WSDL Namespace is : "
                        + wsdlNamespace.getNamespaceURI());

                    if (wsdlNamespace != null) {
                        WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder = null;

                        if (WSDL2Constants.WSDL_NAMESPACE.
                                equals(wsdlNamespace.getNamespaceURI())) {
                            wsdlToAxisServiceBuilder =
                                    new WSDL20ToAxisServiceBuilder(wsdlInputStream, null, null);

                        } else if (org.apache.axis2.namespace.Constants.NS_URI_WSDL11.
                                equals(wsdlNamespace.getNamespaceURI())) {
                            wsdlToAxisServiceBuilder =
                                    new WSDL11ToAxisServiceBuilder(wsdlInputStream);
                        } else {
                            handleException("Unknown WSDL format.. not WSDL 1.1 or WSDL 2.0");
                        }
View Full Code Here

            {
                final OMFactory factory = OMAbstractFactory.getOMFactory();

                // - collect all the namespaces
                final Map<String, OMNamespace> namespaces = new HashMap<String, OMNamespace>();
                final OMNamespace xsiNamespace = factory.createOMNamespace(XSI_NS, XSI_PREFIX);
                namespaces.put(XSI_PREFIX, xsiNamespace);

                final Collection<Schema> schemas = getSchemas(definition);
                for (final Schema schema : schemas)
                {
View Full Code Here

            {
                schema = currentSchema;
            }
        }

        OMNamespace omNamespace = null;
        if (isQualified(schema))
        {
            final String namespace = Axis2ClientUtils.getTargetNamespace(schema);
            final String namespacePrefix = getNamespacePrefix(
                    definition,
                    namespace);
            omNamespace = namespaces.get(namespacePrefix);
        }

        final OMElement omElement =
            factory.createOMElement(
                elementName,
                omNamespace);
        if (bean != null && evaluatingBeans != null && !evaluatingBeans.contains(bean))
        {
            evaluatingBeans.add(bean);
            if (isSimpleType(bean, typeMapper))
            {
                omElement.addChild(factory.createOMText(typeMapper.getStringValue(bean)));
            }
            else if (bean instanceof byte[])
            {
                omElement.addChild(factory.createOMText(Base64.encode((byte[])bean)));
            }
            else
            {
                final Element currentComponentElement =
                    Axis2ClientUtils.getElementByAttribute(
                        definition,
                        NAME,
                        bean.getClass().getSimpleName());
                final Class beanType = bean.getClass();
                if (beanType.isArray())
                {
                    final Element arrayElement = Axis2ClientUtils.getRequiredElementByAttribute(
                            definition,
                            componentElement,
                            NAME,
                            elementName);
                    final Element arrayTypeElement =
                        Axis2ClientUtils.getElementByAttribute(
                            definition,
                            NAME,
                            stripPrefix(arrayElement.getAttribute(TYPE)));
                    final String arrayComponentName = Axis2ClientUtils.getAttributeValueFromChildElement(
                            arrayTypeElement,
                            NAME,
                            0);
                    for (int ctr = 0; ctr < Array.getLength(bean); ctr++)
                    {
                        omElement.addChild(
                            getOMElement(
                                definition,
                                schema,
                                currentComponentElement,
                                Array.get(
                                    bean,
                                    ctr),
                                arrayComponentName,
                                factory,
                                namespaces,
                                typeMapper,
                                evaluatingBeans));
                    }
                }
                else
                {


                    final String attributeValue = omNamespace != null ?
                        omNamespace.getPrefix() + NS_SEPARATOR + beanType.getSimpleName() : beanType.getSimpleName();
                    // - add the xsi:type attribute for complex types
                    omElement.addAttribute(TYPE, attributeValue, namespaces.get(XSI_PREFIX));
                }
                try
                {
View Full Code Here

    }

    private static OMElement commodityPayload() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace businessNS =
                fac.createOMNamespace("http://business.org", "ns");
        OMNamespace emptyNS = fac.createOMNamespace("", "");
        OMElement commodityEle = fac.createOMElement("commodity", businessNS);

        OMElement realCommodity = fac.createOMElement("commodity", emptyNS);
        realCommodity.setText("W");
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("Start building the hessian message in to a HessianDataSource");
        }

        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace ns = factory.createOMNamespace(HessianConstants.HESSIAN_NAMESPACE_URI,
                HessianConstants.HESSIAN_NS_PREFIX);
        OMElement element = factory.createOMElement(
                HessianConstants.HESSIAN_ELEMENT_LOCAL_NAME, ns);

        try {
View Full Code Here

                    OMNode wsdlOM = SynapseConfigUtils.getOMElementFromURL(new URL(wsdlURI)
                            .toString(), properties.get(SynapseConstants.SYNAPSE_HOME) != null ?
                            properties.get(SynapseConstants.SYNAPSE_HOME).toString() : "");
                    if (wsdlOM != null && wsdlOM instanceof OMElement) {
                        OMElement omElement = (OMElement) wsdlOM;
                        OMNamespace ns = omElement.getNamespace();
                        if (ns != null) {
                            String nsUri = omElement.getNamespace().getNamespaceURI();
                            if (org.apache.axis2.namespace.Constants.NS_URI_WSDL11.equals(nsUri)) {

                                endpoint = new WSDL11EndpointBuilder().
View Full Code Here

    }

    public void testHeaderRelativeXPath() throws Exception {
        MessageContext ctx =  TestUtils.getTestContext("<test>" + message + "</test>");
        OMFactory fac = ctx.getEnvelope().getOMFactory();
        OMNamespace ns = fac.createOMNamespace("http://test", "t");
        ctx.getEnvelope().getHeader().addHeaderBlock("test", ns).setText(message);
        ctx.getEnvelope().getHeader().addHeaderBlock("test2", ns);
       
        SynapseXPath xpath = new SynapseXPath("$header/t:test");
        xpath.addNamespace(ns);
View Full Code Here

    private static final Log log = LogFactory.getLog(SynapseXPathSerializer.class);

    public static OMElement serializeXPath(SynapseXPath xpath, OMElement elem, String attribName) {

        OMNamespace nullNS = elem.getOMFactory()
            .createOMNamespace(XMLConfigConstants.NULL_NAMESPACE, "");

        if (xpath != null) {
           
            elem.addAttribute(elem.getOMFactory().createOMAttribute(
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.OMNamespace

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.