本文整理匯總了Java中javax.xml.soap.SOAPHeader.getElementsByTagNameNS方法的典型用法代碼示例。如果您正苦於以下問題:Java SOAPHeader.getElementsByTagNameNS方法的具體用法?Java SOAPHeader.getElementsByTagNameNS怎麽用?Java SOAPHeader.getElementsByTagNameNS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.xml.soap.SOAPHeader
的用法示例。
在下文中一共展示了SOAPHeader.getElementsByTagNameNS方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deserializeConsumer
import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
/**
* Deserializes the client element of the SOAP header to a ConsumerMember
* object.
*
* @param header SOAP header to be deserialized
* @return ConsumerMember object
* @throws XRd4JException if there's a XRd4J error
* @throws XRd4JMissingMemberException if ConsumerMember is missing
*/
protected final ConsumerMember deserializeConsumer(final SOAPHeader header)
throws XRd4JException, XRd4JMissingMemberException {
LOGGER.debug("Deserialize \"{}\".", Constants.NS_XRD_ELEM_CLIENT);
// Client headers
Map<String, String> client;
// Client object type
ObjectType clientObjectType;
NodeList list = header.getElementsByTagNameNS(Constants.NS_XRD_URL, Constants.NS_XRD_ELEM_CLIENT);
if (list.getLength() == 1) {
clientObjectType = this.deserializeObjectType((Node) list.item(0));
client = SOAPHelper.nodesToMap(list.item(0).getChildNodes());
LOGGER.trace(ELEMENT_FOUND_LOG_PATTERN, Constants.NS_XRD_ELEM_CLIENT);
return this.getConsumerMember(client, clientObjectType);
}
LOGGER.warn("\"{}\" element missing from SOAP header.", Constants.NS_XRD_ELEM_CLIENT);
throw new XRd4JMissingMemberException("Client element is missing from SOAP header.");
}
示例2: deserializeProducer
import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
/**
* Deserializes the service element of the SOAP header to a ProducerMember
* object.
*
* @param header SOAP header to be deserialized
* @return ProducerMember object
* @throws XRd4JException if there's a XRd4J error
* @throws XRd4JMissingMemberException if ProducerMember is missing
*/
protected final ProducerMember deserializeProducer(final SOAPHeader header)
throws XRd4JException, XRd4JMissingMemberException {
LOGGER.debug(DESERIALIZE_LOG_PATTERN, Constants.NS_XRD_ELEM_SERVICE);
// Service headers
Map<String, String> service;
// Service object type
ObjectType serviceObjectType;
NodeList list = header.getElementsByTagNameNS(Constants.NS_XRD_URL, Constants.NS_XRD_ELEM_SERVICE);
if (list.getLength() == 1) {
serviceObjectType = this.deserializeObjectType((Node) list.item(0));
service = SOAPHelper.nodesToMap(list.item(0).getChildNodes());
LOGGER.trace(ELEMENT_FOUND_LOG_PATTERN, Constants.NS_XRD_ELEM_SERVICE);
return this.getProducerMember(service, serviceObjectType);
}
LOGGER.warn("\"{}\" element missing from SOAP header.", Constants.NS_XRD_ELEM_SERVICE);
throw new XRd4JMissingMemberException("Service element is missing from SOAP header.");
}
示例3: invoke
import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
public SOAPMessage invoke(SOAPMessage request)
{
try
{
SOAPHeader headers = request.getSOAPHeader();
if (headers != null)
{
NodeList nl = headers.getElementsByTagNameNS("http://org.jboss.ws/foo", "returnNullResponse");
if (nl != null && nl.getLength() > 0)
{
return null;
}
}
}
catch (Exception e)
{
throw new RuntimeException(e);
}
return request;
}
示例4: deserializeSecurityServer
import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
/**
* Deserializes the service element of the SOAP header to a SecurityServer
* object.
*
* @param header SOAP header to be deserialized
* @return SecurityServer object or null
* @throws XRd4JException if there's a XRd4J error
*/
protected final SecurityServer deserializeSecurityServer(final SOAPHeader header)
throws XRd4JException {
LOGGER.debug(DESERIALIZE_LOG_PATTERN, Constants.NS_XRD_ELEM_SECURITY_SERVER);
// Security server headers
Map<String, String> server;
NodeList list = header.getElementsByTagNameNS(Constants.NS_XRD_URL, Constants.NS_XRD_ELEM_SECURITY_SERVER);
if (list.getLength() == 1) {
server = SOAPHelper.nodesToMap(list.item(0).getChildNodes());
LOGGER.trace(ELEMENT_FOUND_LOG_PATTERN, Constants.NS_XRD_ELEM_SECURITY_SERVER);
return this.getSecurityServer(server);
}
return null;
}
示例5: deserializeId
import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
/**
* Deserializes the id element of the SOAP header to a String.
*
* @param header SOAP header to be deserialized
* @return id represented as a String
*/
protected final String deserializeId(final SOAPHeader header) {
LOGGER.debug(DESERIALIZE_LOG_PATTERN, Constants.NS_XRD_ELEM_ID);
String id = null;
NodeList list = header.getElementsByTagNameNS(Constants.NS_XRD_URL, Constants.NS_XRD_ELEM_ID);
if (list.getLength() == 1) {
id = list.item(0).getTextContent();
LOGGER.trace(ELEMENT_FOUND_LOG_PATTERN, Constants.NS_XRD_ELEM_ID);
}
return id;
}
示例6: deserializeUserId
import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
/**
* Deserializes the userId element of the SOAP header to a String.
*
* @param header SOAP header to be deserialized
* @return userId represented as a String
*/
protected final String deserializeUserId(final SOAPHeader header) {
LOGGER.debug(DESERIALIZE_LOG_PATTERN, Constants.NS_XRD_ELEM_USER_ID);
String userId = null;
NodeList list = header.getElementsByTagNameNS(Constants.NS_XRD_URL, Constants.NS_XRD_ELEM_USER_ID);
if (list.getLength() == 1) {
userId = list.item(0).getTextContent();
LOGGER.trace(ELEMENT_FOUND_LOG_PATTERN, Constants.NS_XRD_ELEM_USER_ID);
}
return userId;
}
示例7: deserializeIssue
import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
/**
* Deserializes the issue element of the SOAP header to a String.
*
* @param header SOAP header to be deserialized
* @return issue represented as a String
*/
protected final String deserializeIssue(final SOAPHeader header) {
LOGGER.debug(DESERIALIZE_LOG_PATTERN, Constants.NS_XRD_ELEM_ISSUE);
String issue = null;
NodeList list = header.getElementsByTagNameNS(Constants.NS_XRD_URL, Constants.NS_XRD_ELEM_ISSUE);
if (list.getLength() == 1) {
issue = list.item(0).getTextContent();
LOGGER.trace(ELEMENT_FOUND_LOG_PATTERN, Constants.NS_XRD_ELEM_ISSUE);
}
return issue;
}
示例8: deserializeRequestHash
import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
/**
* Deserializes the requestHash element of the SOAP header to a String.
*
* @param header SOAP header to be deserialized
* @return requestHash represented as a String
*/
protected final String deserializeRequestHash(final SOAPHeader header) {
LOGGER.debug(DESERIALIZE_LOG_PATTERN, Constants.NS_XRD_ELEM_REQUEST_HASH);
String requestHash = null;
NodeList list = header.getElementsByTagNameNS(Constants.NS_XRD_URL, Constants.NS_XRD_ELEM_REQUEST_HASH);
if (list.getLength() == 1) {
requestHash = list.item(0).getTextContent();
LOGGER.trace(ELEMENT_FOUND_LOG_PATTERN, Constants.NS_XRD_ELEM_REQUEST_HASH);
}
return requestHash;
}
示例9: deserializeAlgorithmId
import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
/**
* Deserializes the algorithmId element of the SOAP header to a String.
*
* @param header SOAP header to be deserialized
* @return algorithmId represented as a String
*/
protected final String deserializeAlgorithmId(final SOAPHeader header) {
LOGGER.debug(DESERIALIZE_LOG_PATTERN, Constants.ATTR_ALGORITHM_ID);
String algorithmId = null;
NodeList list = header.getElementsByTagNameNS(Constants.NS_XRD_URL, Constants.NS_XRD_ELEM_REQUEST_HASH);
if (list.getLength() == 1) {
algorithmId = list.item(0).getAttributes().getNamedItem(Constants.ATTR_ALGORITHM_ID).getNodeValue();
LOGGER.trace("Attribute found : \"{}\"", Constants.ATTR_ALGORITHM_ID);
}
return algorithmId;
}
示例10: deserializeProtocolVersion
import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
/**
* Deserializes the protocol version element of the SOAP header to a String.
*
* @param header SOAP header to be deserialized
* @return id represented as a String
*/
protected final String deserializeProtocolVersion(final SOAPHeader header) {
LOGGER.debug(DESERIALIZE_LOG_PATTERN, Constants.NS_XRD_ELEM_PROTOCOL_VERSION);
String protocolVersion = null;
NodeList list = header.getElementsByTagNameNS(Constants.NS_XRD_URL, Constants.NS_XRD_ELEM_PROTOCOL_VERSION);
if (list.getLength() == 1) {
protocolVersion = list.item(0).getTextContent();
LOGGER.trace(ELEMENT_FOUND_LOG_PATTERN, Constants.NS_XRD_ELEM_PROTOCOL_VERSION);
}
return protocolVersion;
}
示例11: getHeaderValue
import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
public static String getHeaderValue(SOAPMessage message, String tagName) {
String value = null;
try {
SOAPHeader header = message.getSOAPPart().getEnvelope().getHeader();
NodeList elements = header.getElementsByTagNameNS("*", tagName);
if (elements.getLength() > 0)
value = elements.item(0).getChildNodes().item(0).getNodeValue();
} catch (SOAPException e) {
logger.warn("getHeaderValue() failed", e);
}
return value;
}
示例12: getSecurityElement
import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
/**
* Finds the Security element from the header. If not found then creates one
* and returns the same
*
* @param header
* @return
*/
public static Node getSecurityElement(SOAPHeader header) {
NodeList targetElement = header.getElementsByTagNameNS(Constants.WSS_NS,
Constants.SECURITY_ELEMENT_NAME);
if (targetElement == null || targetElement.getLength() == 0) {
JAXBElement<SecurityHeaderType> value = wsseObjFactory
.createSecurity(wsseObjFactory.createSecurityHeaderType());
Node headerNode = marshallJaxbElement(value).getDocumentElement();
return header.appendChild(header.getOwnerDocument().importNode(
headerNode, true));
} else if (targetElement.getLength() > 1) {
throw new RuntimeException(Constants.ERR_INSERTING_SECURITY_HEADER);
}
return targetElement.item(0);
}