当前位置: 首页>>代码示例>>Java>>正文


Java OMAttribute.getQName方法代码示例

本文整理汇总了Java中org.apache.axiom.om.OMAttribute.getQName方法的典型用法代码示例。如果您正苦于以下问题:Java OMAttribute.getQName方法的具体用法?Java OMAttribute.getQName怎么用?Java OMAttribute.getQName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.axiom.om.OMAttribute的用法示例。


在下文中一共展示了OMAttribute.getQName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fromOM

import org.apache.axiom.om.OMAttribute; //导入方法依赖的package包/类
/**
 * Convenience method for converting an OMAttribute to an instance of either of these types.
 * <p>
 * &lt;... xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" wsdli:wsdlLocation="targetNamespace wsdlURL" ...&gt
 * </p>
 * <p>
 * &lt;... xmlns:wsdli="http://www.w3.org/ns/wsdl-instance" wsdli:wsdlLocation="targetNamespace wsdlURL" ...&gt
 * </p>
 * @param omAttribute the <code>OMAttribute</code> that holds the wsdl location.
 * @throws AxisFault
 */
public void fromOM(OMAttribute omAttribute) throws AxisFault {
    QName qname = omAttribute.getQName();
    if (WSDLI.equals(qname) || FINAL_WSDLI.equals(qname)) {
       String value = omAttribute.getAttributeValue().trim();
       String[] values = value.split("\\s", 2);
       
       //Don't set any values if split doesn't
       //give us the correct number of elements.
       if (values.length != 2)
           return;
       
       targetNamespace = values[0];
       wsdlURL = values[1];
       
       if (log.isDebugEnabled()) {
           log.debug("fromOM: Extracted WSDLLocation targetNamespace = " + targetNamespace + " and wsdlURL = " + wsdlURL + " from an OMAttribute with QName = " + qname);
       }
    }
    else {
        throw new AxisFault("Unrecognized element.");
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:34,代码来源:WSDLLocation.java

示例2: isWSDLLocationAttribute

import org.apache.axiom.om.OMAttribute; //导入方法依赖的package包/类
/**
 * Static method to test whether an <code>OMElement</code> is recognized
 * as a ServiceName element. If this method returns <code>true</code> then
 * {@link #fromOM(OMAttribute)} is guaranteed not to throw an exception.
 * 
 * @param omAttribute the <code>OMElement</code> to test.
 * @return <code>true</code> if the element is a ServiceName element,
 * <code>false</code> otherwise.
 */
public static boolean isWSDLLocationAttribute(OMAttribute omAttribute) {
    boolean result = false;
    QName qname = omAttribute.getQName();
    
    if (WSDLI.equals(qname) || FINAL_WSDLI.equals(qname))
        result = true;

    if (log.isDebugEnabled()) {
        log.debug("isWSDLLocationAttribute: OMAttribute QName = " + qname + ", result = " + result);
    }
    
    return result;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:23,代码来源:WSDLLocation.java

示例3: getSOAPMessage

import org.apache.axiom.om.OMAttribute; //导入方法依赖的package包/类
/**
 * This method handles the conversion of an OM SOAP Envelope to a SAAJ SOAPMessage
 *
 * @param respOMSoapEnv
 * @return the SAAJ SOAPMessage
 * @throws SOAPException If an exception occurs during this conversion
 */
private SOAPMessage getSOAPMessage(org.apache.axiom.soap.SOAPEnvelope respOMSoapEnv)
        throws SOAPException {

    // Create the basic SOAP Message
    MessageFactory mf = MessageFactory.newInstance();
    SOAPMessage response = mf.createMessage();
    SOAPPart sPart = response.getSOAPPart();
    javax.xml.soap.SOAPEnvelope env = sPart.getEnvelope();
    SOAPBody body = env.getBody();
    SOAPHeader header = env.getHeader();

    // Convert all header blocks
    org.apache.axiom.soap.SOAPHeader header2 = respOMSoapEnv.getHeader();
    if (header2 != null) {
        for (Iterator hbIter = header2.examineAllHeaderBlocks(); hbIter.hasNext();) {
            // Converting a single OM SOAP HeaderBlock to a SAAJ SOAP
            // HeaderBlock
            org.apache.axiom.soap.SOAPHeaderBlock hb = (org.apache.axiom.soap.SOAPHeaderBlock)
                    hbIter.next();
            final QName hbQName = hb.getQName();
            final SOAPHeaderElement headerEle = header.addHeaderElement(env.createName(hbQName
                    .getLocalPart(), hbQName.getPrefix(), hbQName.getNamespaceURI()));
            for (Iterator attribIter = hb.getAllAttributes(); attribIter.hasNext();) {
                OMAttribute attr = (OMAttribute)attribIter.next();
                final QName attrQName = attr.getQName();
                headerEle.addAttribute(env.createName(attrQName.getLocalPart(), attrQName
                        .getPrefix(), attrQName.getNamespaceURI()), attr.getAttributeValue());
            }
            final String role = hb.getRole();
            if (role != null) {
                headerEle.setActor(role);
            }
            headerEle.setMustUnderstand(hb.getMustUnderstand());

            toSAAJElement(headerEle, hb, response);
        }
    }

    // Convert the body
    toSAAJElement(body, respOMSoapEnv.getBody(), response);

    return response;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:51,代码来源:SOAPConnectionImpl.java

示例4: toSAAJElement

import org.apache.axiom.om.OMAttribute; //导入方法依赖的package包/类
/**
 * Converts an OMNode into a SAAJ SOAPElement
 *
 * @param saajEle
 * @param omNode
 * @param saajSOAPMsg
 * @throws SOAPException If conversion fails
 */
private void toSAAJElement(SOAPElement saajEle,
                           OMNode omNode,
                           javax.xml.soap.SOAPMessage saajSOAPMsg) throws SOAPException {

    if (omNode instanceof OMText) {
        return; // simply return since the text has already been added to saajEle
    }

    if (omNode instanceof OMElement) {
        OMElement omEle = (OMElement)omNode;
        for (Iterator childIter = omEle.getChildren(); childIter.hasNext();) {
            OMNode omChildNode = (OMNode)childIter.next();
            SOAPElement saajChildEle = null;

            if (omChildNode instanceof OMText) {
                // check whether the omtext refers to an attachment

                final OMText omText = (OMText)omChildNode;
                if (omText.isOptimized()) { // is this an attachment?
                    final DataHandler datahandler = (DataHandler)omText.getDataHandler();
                    AttachmentPart attachment = saajSOAPMsg.createAttachmentPart(datahandler);
                    final String id = IDGenerator.generateID();
                    attachment.setContentId("<" + id + ">");
                    attachment.setContentType(datahandler.getContentType());
                    saajSOAPMsg.addAttachmentPart(attachment);

                    SOAPElement xopInclude = saajEle.addChildElement(MTOMConstants.XOP_INCLUDE,
                            "xop", MTOMConstants.XOP_NAMESPACE_URI);
                    xopInclude.addAttribute(
                            saajSOAPMsg.getSOAPPart().getEnvelope().createName("href"),
                            "cid:" + id);
                } else {
                    saajChildEle = saajEle.addTextNode(omText.getText());
                }
            } else if (omChildNode instanceof OMElement) {
                OMElement omChildEle = (OMElement)omChildNode;
                final QName omChildQName = omChildEle.getQName();
                saajChildEle =
                        saajEle.addChildElement(omChildQName.getLocalPart(),
                                                omChildQName.getPrefix(),
                                                omChildQName.getNamespaceURI());
                for (Iterator attribIter = omChildEle.getAllAttributes();
                     attribIter.hasNext();) {
                    OMAttribute attr = (OMAttribute)attribIter.next();
                    final QName attrQName = attr.getQName();
                    saajChildEle.addAttribute(saajSOAPMsg.getSOAPPart().getEnvelope().
                            createName(attrQName.getLocalPart(),
                                       attrQName.getPrefix(),
                                       attrQName.getNamespaceURI()),
                                              attr.getAttributeValue());
                }
            }

            // go down the tree adding child elements, till u reach a leaf(i.e. text element)
            toSAAJElement(saajChildEle, omChildNode, saajSOAPMsg);
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:67,代码来源:SOAPConnectionImpl.java


注:本文中的org.apache.axiom.om.OMAttribute.getQName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。