本文整理汇总了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);
}
}
}
示例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);
}
}