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


Java SOAPVersion.fromNsUri方法代码示例

本文整理汇总了Java中com.sun.xml.internal.ws.api.SOAPVersion.fromNsUri方法的典型用法代码示例。如果您正苦于以下问题:Java SOAPVersion.fromNsUri方法的具体用法?Java SOAPVersion.fromNsUri怎么用?Java SOAPVersion.fromNsUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.xml.internal.ws.api.SOAPVersion的用法示例。


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

示例1: access

import com.sun.xml.internal.ws.api.SOAPVersion; //导入方法依赖的package包/类
protected void access() {
    if (!accessedMessage) {
        try {
            envelopeAttrs = sm.getSOAPPart().getEnvelope().getAttributes();
            Node body = sm.getSOAPBody();
            bodyAttrs = body.getAttributes();
            soapVersion = SOAPVersion.fromNsUri(body.getNamespaceURI());
            //cature all the body elements
            bodyParts = DOMUtil.getChildElements(body);
            //we treat payload as the first body part
            payload = bodyParts.size() > 0 ? bodyParts.get(0) : null;
            // hope this is correct. Caching the localname and namespace of the payload should be fine
            // but what about if a Handler replaces the payload with something else? Weel, may be it
            // will be error condition anyway
            if (payload != null) {
                payloadLocalName = payload.getLocalName();
                payloadNamespace = payload.getNamespaceURI();
            }
            accessedMessage = true;
        } catch (SOAPException e) {
            throw new WebServiceException(e);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:SAAJMessage.java

示例2: create

import com.sun.xml.internal.ws.api.SOAPVersion; //导入方法依赖的package包/类
/**
 * Creates a {@link Message} from an {@link Element} that represents
 * the whole SOAP message.
 *
 * @param soapEnvelope
 *      The SOAP envelope element.
 */
public static Message create(Element soapEnvelope) {
    SOAPVersion ver = SOAPVersion.fromNsUri(soapEnvelope.getNamespaceURI());
    // find the headers
    Element header = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Header");
    HeaderList headers = null;
    if(header!=null) {
        for( Node n=header.getFirstChild(); n!=null; n=n.getNextSibling() ) {
            if(n.getNodeType()==Node.ELEMENT_NODE) {
                if(headers==null)
                    headers = new HeaderList(ver);
                headers.add(Headers.create((Element)n));
            }
        }
    }

    // find the payload
    Element body = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");
    if(body==null)
        throw new WebServiceException("Message doesn't have <S:Body> "+soapEnvelope);
    Element payload = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");

    if(payload==null) {
        return new EmptyMessageImpl(headers, new AttachmentSetImpl(), ver);
    } else {
        return new DOMMessage(ver,headers,payload);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:Messages.java


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