本文整理汇总了Java中javax.xml.soap.SOAPElement类的典型用法代码示例。如果您正苦于以下问题:Java SOAPElement类的具体用法?Java SOAPElement怎么用?Java SOAPElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SOAPElement类属于javax.xml.soap包,在下文中一共展示了SOAPElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendFaultSubcode
import javax.xml.soap.SOAPElement; //导入依赖的package包/类
@Override
public void appendFaultSubcode(QName subcode) throws SOAPException {
if (subcode == null) {
return;
}
if (subcode.getNamespaceURI() == null ||
"".equals(subcode.getNamespaceURI())) {
log.severe("SAAJ0432.ver1_2.subcode.not.ns.qualified");
throw new SOAPExceptionImpl("A Subcode must be namespace-qualified");
}
if (innermostSubCodeElement == null) {
if (faultCodeElement == null)
findFaultCodeElement();
innermostSubCodeElement = faultCodeElement;
}
String prefix = null;
if (subcode.getPrefix() == null || "".equals(subcode.getPrefix())) {
prefix =
((ElementImpl) innermostSubCodeElement).getNamespacePrefix(
subcode.getNamespaceURI());
} else
prefix = subcode.getPrefix();
if (prefix == null || "".equals(prefix)) {
prefix = "ns1";
}
innermostSubCodeElement =
innermostSubCodeElement.addChildElement(subcodeName);
SOAPElement subcodeValueElement =
innermostSubCodeElement.addChildElement(valueName);
((ElementImpl) subcodeValueElement).ensureNamespaceIsDeclared(
prefix,
subcode.getNamespaceURI());
subcodeValueElement.addTextNode(prefix + ":" + subcode.getLocalPart());
}
示例2: serializeClient
import javax.xml.soap.SOAPElement; //导入依赖的package包/类
private void serializeClient(final SOAPHeader header, final AbstractMessage message, final SOAPEnvelope envelope) throws SOAPException {
LOGGER.debug("Generate \"Client\" element.");
ObjectType clientObjectType = MessageHelper.getObjectType(message.getConsumer());
SOAPElement clientHeader = header.addChildElement(Constants.NS_XRD_ELEM_CLIENT, Constants.NS_XRD_PREFIX);
clientHeader.addAttribute(envelope.createQName(Constants.NS_ID_ATTR_OBJECT_TYPE, Constants.NS_ID_PREFIX), clientObjectType.toString());
SOAPElement xRoadInstance = clientHeader.addChildElement(Constants.NS_ID_ELEM_XROAD_INSTANCE, Constants.NS_ID_PREFIX);
xRoadInstance.addTextNode(message.getConsumer().getXRoadInstance());
SOAPElement memberClass = clientHeader.addChildElement(Constants.NS_ID_ELEM_MEMBER_CLASS, Constants.NS_ID_PREFIX);
memberClass.addTextNode(message.getConsumer().getMemberClass());
SOAPElement memberCode = clientHeader.addChildElement(Constants.NS_ID_ELEM_MEMBER_CODE, Constants.NS_ID_PREFIX);
memberCode.addTextNode(message.getConsumer().getMemberCode());
if (clientObjectType == ObjectType.SUBSYSTEM) {
SOAPElement subsystem = clientHeader.addChildElement(Constants.NS_ID_ELEM_SUBSYSTEM_CODE, Constants.NS_ID_PREFIX);
subsystem.addTextNode(message.getConsumer().getSubsystemCode());
}
LOGGER.debug("\"Client\" element was succesfully generated.");
}
示例3: getUniqueID
import javax.xml.soap.SOAPElement; //导入依赖的package包/类
public static String getUniqueID(SOAPElement itinerary) {
String uniqueID = "";
NodeList nodeList = itinerary.getChildNodes();
try {
for(int index1=0; index1<nodeList.getLength() ; index1++) {
Node node1 = nodeList.item(index1);
if(node1.getNodeName().endsWith("ItineraryRef")) {
for (int index2=0 ; index2<node1.getChildNodes().getLength() ; index2++) {
Node node2 = node1.getChildNodes().item(index2);
if(node2.getNodeName().endsWith("UniqueID")) {
uniqueID = node2.getTextContent();
break;
}
}
}
}
} catch (Exception ex) {
}
return uniqueID;
}
示例4: addChildElement
import javax.xml.soap.SOAPElement; //导入依赖的package包/类
@Override
public SOAPElement addChildElement(SOAPElement element)
throws SOAPException {
String localName = element.getLocalName();
if ("Detail".equalsIgnoreCase(localName)) {
if (hasDetail()) {
log.severe("SAAJ0436.ver1_2.detail.exists.error");
throw new SOAPExceptionImpl("Cannot add Detail, Detail already exists");
}
String uri = element.getElementQName().getNamespaceURI();
if (!uri.equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE)) {
log.severe("SAAJ0437.ver1_2.version.mismatch.error");
throw new SOAPExceptionImpl("Cannot add Detail, Incorrect SOAP version specified for Detail element");
}
}
if (element instanceof Detail1_2Impl) {
Element importedElement = importElement(element);
addNode(importedElement);
return convertToSoapElement(importedElement);
} else
return super.addChildElement(element);
}
示例5: getFaultReasonTextElement
import javax.xml.soap.SOAPElement; //导入依赖的package包/类
private SOAPElement getFaultReasonTextElement(Locale locale)
throws SOAPException {
// Fault Reason has similar semantics as faultstring
Iterator eachTextElement =
this.faultStringElement.getChildElements(textName);
while (eachTextElement.hasNext()) {
SOAPElement textElement = (SOAPElement) eachTextElement.next();
Locale thisLocale = getLocale(textElement);
if (thisLocale == null) {
log.severe("SAAJ0431.ver1_2.xml.lang.missing");
throw new SOAPExceptionImpl("\"xml:lang\" attribute is not present on the Text element");
}
if (thisLocale.equals(locale)) {
return textElement;
}
}
return null;
}
示例6: serializeResponse
import javax.xml.soap.SOAPElement; //导入依赖的package包/类
@Override
/**
* Serializes the response data.
*
* @param response ServiceResponse holding the application specific
* response object
* @param soapResponse SOAPMessage's response object where the response
* element is added
* @param envelope SOAPMessage's SOAPEnvelope object
*/
public void serializeResponse(ServiceResponse response, SOAPElement soapResponse, SOAPEnvelope envelope) throws SOAPException {
// Add "message" element
SOAPElement data = soapResponse.addChildElement(envelope.createName("message"));
// Put response data inside the "message" element
data.addTextNode((String) response.getResponseData());
}
示例7: test14
import javax.xml.soap.SOAPElement; //导入依赖的package包/类
/**
* Subsystem level service call. No NS on request. Multiple NSs prefix on
* response.
* @throws XRd4JException
* @throws SOAPException
*/
public void test14() throws XRd4JException, SOAPException {
String requestStr = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:id=\"http://x-road.eu/xsd/identifiers\" xmlns:xrd=\"http://x-road.eu/xsd/xroad.xsd\"><SOAP-ENV:Header><xrd:client id:objectType=\"SUBSYSTEM\"><id:xRoadInstance>FI</id:xRoadInstance><id:memberClass>GOV</id:memberClass><id:memberCode>MEMBER1</id:memberCode><id:subsystemCode>subsystem</id:subsystemCode></xrd:client><xrd:service id:objectType=\"SERVICE\"><id:xRoadInstance>FI</id:xRoadInstance><id:memberClass>COM</id:memberClass><id:memberCode>MEMBER2</id:memberCode><id:subsystemCode>subsystem</id:subsystemCode><id:serviceCode>getRandom</id:serviceCode><id:serviceVersion>v1</id:serviceVersion></xrd:service><xrd:userId>EE1234567890</xrd:userId><xrd:id>1234567890</xrd:id><xrd:protocolVersion>4.0</xrd:protocolVersion></SOAP-ENV:Header><SOAP-ENV:Body><ns1:getRandom xmlns:ns1=\"http://consumer.x-road.ee\"><request><data>Request data</data></request></ns1:getRandom></SOAP-ENV:Body></SOAP-ENV:Envelope>";
String correctResponse = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:id=\"http://x-road.eu/xsd/identifiers\" xmlns:xrd=\"http://x-road.eu/xsd/xroad.xsd\"><SOAP-ENV:Header><xrd:client id:objectType=\"SUBSYSTEM\"><id:xRoadInstance>FI</id:xRoadInstance><id:memberClass>GOV</id:memberClass><id:memberCode>MEMBER1</id:memberCode><id:subsystemCode>subsystem</id:subsystemCode></xrd:client><xrd:service id:objectType=\"SERVICE\"><id:xRoadInstance>FI</id:xRoadInstance><id:memberClass>COM</id:memberClass><id:memberCode>MEMBER2</id:memberCode><id:subsystemCode>subsystem</id:subsystemCode><id:serviceCode>getRandom</id:serviceCode><id:serviceVersion>v1</id:serviceVersion></xrd:service><xrd:userId>EE1234567890</xrd:userId><xrd:id>1234567890</xrd:id><xrd:protocolVersion>4.0</xrd:protocolVersion></SOAP-ENV:Header><SOAP-ENV:Body><xxprod:getRandomResponse xmlns:xxprod=\"http://foobar.x-road.ee/producer\"><xxprod:request><xxprod:data>Request data</xxprod:data></xxprod:request><xxprod:response><ns1:responseData xmlns:ns1=\"http://ns1.com\" xmlns:ns2=\"http://ns2.com\"><ns1:data>Response data</ns1:data><ns2:data2>Response data 2</ns2:data2></ns1:responseData></xxprod:response></xxprod:getRandomResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>";
ConsumerMember consumer = new ConsumerMember("FI", "GOV", "MEMBER1", "subsystem");
ProducerMember producer = new ProducerMember("FI", "COM", "MEMBER2", "subsystem", "getRandom", "v1");
ServiceRequest<String> request = new ServiceRequest<String>(consumer, producer, "1234567890");
request.setUserId("EE1234567890");
request.setRequestData("Request data");
request.setSoapMessage(SOAPHelper.toSOAP(requestStr));
request.getProducer().setNamespacePrefix("xxprod");
request.getProducer().setNamespaceUrl("http://foobar.x-road.ee/producer");
ServiceResponse<String, SOAPElement> response = new ServiceResponse<String, SOAPElement>(request.getConsumer(), request.getProducer(), request.getId());
response.setResponseData(SOAPHelper.xmlStrToSOAPElement(
"<ns1:responseData xmlns:ns1=\"http://ns1.com\" xmlns:ns2=\"http://ns2.com\"><ns1:data>Response data</ns1:data><ns2:data2>Response data 2</ns2:data2></ns1:responseData>"));
response.setForceNamespaceToResponseChildren(false);
ServiceResponseSerializer serializer = new XMLServiceResponseSerializer();
SOAPMessage msg = serializer.serialize(response, request);
assertEquals(correctResponse, SOAPHelper.toString(msg));
}
示例8: setFaultNode
import javax.xml.soap.SOAPElement; //导入依赖的package包/类
@Override
public void setFaultNode(String uri) throws SOAPException {
SOAPElement faultNode = findAndConvertChildElement(getFaultNodeName());
if (faultNode != null) {
faultNode.detachNode();
}
faultNode = createSOAPFaultElement(getFaultNodeName());
faultNode = faultNode.addTextNode(uri);
if (getFaultRole() != null) {
insertBefore(faultNode, this.faultActorElement);
return;
}
if (hasDetail()) {
insertBefore(faultNode, this.detail);
return;
}
addNode(faultNode);
}
示例9: serializeService
import javax.xml.soap.SOAPElement; //导入依赖的package包/类
private void serializeService(final SOAPHeader header, final AbstractMessage message, final SOAPEnvelope envelope) throws SOAPException {
LOGGER.debug("Generate \"Service\" element.");
ObjectType serviceObjectType = MessageHelper.getObjectType(message.getProducer());
SOAPElement serviceHeader = header.addChildElement(Constants.NS_XRD_ELEM_SERVICE, Constants.NS_XRD_PREFIX);
serviceHeader.addAttribute(envelope.createQName(Constants.NS_ID_ATTR_OBJECT_TYPE, Constants.NS_ID_PREFIX), serviceObjectType.toString());
SOAPElement xRoadInstance = serviceHeader.addChildElement(Constants.NS_ID_ELEM_XROAD_INSTANCE, Constants.NS_ID_PREFIX);
xRoadInstance.addTextNode(message.getProducer().getXRoadInstance());
if (serviceObjectType == ObjectType.SERVICE) {
SOAPElement memberClass = serviceHeader.addChildElement(Constants.NS_ID_ELEM_MEMBER_CLASS, Constants.NS_ID_PREFIX);
memberClass.addTextNode(message.getProducer().getMemberClass());
SOAPElement memberCode = serviceHeader.addChildElement(Constants.NS_ID_ELEM_MEMBER_CODE, Constants.NS_ID_PREFIX);
memberCode.addTextNode(message.getProducer().getMemberCode());
}
if (message.getProducer().getSubsystemCode() != null && !message.getProducer().getSubsystemCode().isEmpty()) {
SOAPElement subsystem = serviceHeader.addChildElement(Constants.NS_ID_ELEM_SUBSYSTEM_CODE, Constants.NS_ID_PREFIX);
subsystem.addTextNode(message.getProducer().getSubsystemCode());
}
SOAPElement serviceCode = serviceHeader.addChildElement(Constants.NS_ID_ELEM_SERVICE_CODE, Constants.NS_ID_PREFIX);
serviceCode.addTextNode(message.getProducer().getServiceCode());
if (message.getProducer().getServiceVersion() != null && !message.getProducer().getServiceVersion().isEmpty()) {
SOAPElement serviceVersion = serviceHeader.addChildElement(Constants.NS_ID_ELEM_SERVICE_VERSION, Constants.NS_ID_PREFIX);
serviceVersion.addTextNode(message.getProducer().getServiceVersion());
}
LOGGER.debug("\"Service\" element was succesfully generated.");
}
示例10: testNodesToMap1
import javax.xml.soap.SOAPElement; //导入依赖的package包/类
/**
* Multiple parameters with the same name.
*/
public void testNodesToMap1() {
String xml = "<request><param1>value1</param1><param1>value2</param1><param1>value3</param1><param2>value1</param2><param2>value2</param2><param3></param3><param4>\n</param4></request>";
SOAPElement soap = SOAPHelper.xmlStrToSOAPElement(xml);
Map<String, String> nodes = SOAPHelper.nodesToMap(soap.getChildNodes());
if (nodes.keySet().size() != 3) {
fail("Too many keys found: " + nodes.keySet().size() + ". The right key count is 3.");
}
if (!nodes.get("param1").equals("value3")) {
fail("\"param1\" invalid value: " + nodes.get("param1"));
}
if (!nodes.get("param2").equals("value2")) {
fail("\"param2\" invalid value: " + nodes.get("param2"));
}
if (!nodes.get("param3").equals("")) {
fail("\"param3\" invalid value: " + nodes.get("param3"));
}
}
示例11: testNodesToMap2
import javax.xml.soap.SOAPElement; //导入依赖的package包/类
/**
* Unique parameter names with tabs and line breaks.
*/
public void testNodesToMap2() {
String xml = "<test:request xmlns:test=\"http://test.com\">\n<test:param1>\tvalue1\n</test:param1><test:param2>value2</test:param2>\r\n<test:param3>value3</test:param3></test:request>";
SOAPElement soap = SOAPHelper.xmlStrToSOAPElement(xml);
Map<String, String> nodes = SOAPHelper.nodesToMap(soap.getChildNodes());
if (nodes.keySet().size() != 3) {
fail("Too many keys found: " + nodes.keySet().size() + ". The right key count is 3.");
}
if (!nodes.get("param1").equals("value1")) {
fail("\"param1\" invalid value: " + nodes.get("param1"));
}
if (!nodes.get("param2").equals("value2")) {
fail("\"param2\" invalid value: " + nodes.get("param2"));
}
if (!nodes.get("param3").equals("value3")) {
fail("\"param3\" invalid value: " + nodes.get("param3"));
}
}
示例12: testNodesToMap3
import javax.xml.soap.SOAPElement; //导入依赖的package包/类
/**
* Multiple parameters with the same name inside en extra wrapper element.
*/
public void testNodesToMap3() {
String xml = "<request><wrapper><param1>value1</param1><param2>value2</param2><param3>value3</param3></wrapper></request>";
SOAPElement soap = SOAPHelper.xmlStrToSOAPElement(xml);
Map<String, String> nodes = SOAPHelper.nodesToMap(soap.getChildNodes());
if (nodes.keySet().size() != 3) {
fail("Too many keys found: " + nodes.keySet().size() + ". The right key count is 3.");
}
if (!nodes.get("param1").equals("value1")) {
fail("\"param1\" invalid value: " + nodes.get("param1"));
}
if (!nodes.get("param2").equals("value2")) {
fail("\"param2\" invalid value: " + nodes.get("param2"));
}
if (!nodes.get("param3").equals("value3")) {
fail("\"param3\" invalid value: " + nodes.get("param3"));
}
}
示例13: testNodesToMap4
import javax.xml.soap.SOAPElement; //导入依赖的package包/类
/**
* Multiple parameters with the same name inside two extra wrapper elements
* with tabs and line breaks.
*/
public void testNodesToMap4() {
String xml = "<request><wrapperext>\n<wrapper>\n\t<param1>value1</param1>\r\n<param2>value2</param2><param3>value3</param3></wrapper></wrapperext></request>";
SOAPElement soap = SOAPHelper.xmlStrToSOAPElement(xml);
Map<String, String> nodes = SOAPHelper.nodesToMap(soap.getChildNodes());
if (nodes.keySet().size() != 3) {
fail("Too many keys found: " + nodes.keySet().size() + ". The right key count is 3.");
}
if (!nodes.get("param1").equals("value1")) {
fail("\"param1\" invalid value: " + nodes.get("param1"));
}
if (!nodes.get("param2").equals("value2")) {
fail("\"param2\" invalid value: " + nodes.get("param2"));
}
if (!nodes.get("param3").equals("value3")) {
fail("\"param3\" invalid value: " + nodes.get("param3"));
}
}
示例14: testGetXRdVersionInfo1
import javax.xml.soap.SOAPElement; //导入依赖的package包/类
/**
* Test reading version information
*/
public void testGetXRdVersionInfo1() {
String xml = "<m:getSecurityServerMetricsResponse xmlns:m=\"http://x-road.eu/xsd/monitoring\"><m:metricSet><m:name>SERVER:FI/GOV/MEMBER1/server1</m:name><m:stringMetric><m:name>proxyVersion</m:name><m:value>6.9.0-1.20170104084337gitb8fe14a</m:value></m:stringMetric><m:metricSet><m:name>systemMetrics</m:name><m:histogramMetric><m:name>CommittedVirtualMemory</m:name><m:updated>2017-02-18T05:13:54.864Z</m:updated><m:min>2331078656</m:min><m:max>2331078656</m:max><m:mean>2331078656</m:mean><m:median>2331078656</m:median><m:stddev>0.0</m:stddev></m:histogramMetric><m:numericMetric><m:name>DiskSpaceFree_/</m:name><m:value>4594552832</m:value></m:numericMetric><m:stringMetric><m:name>OperatingSystem</m:name><m:value>Linux version 3.13.0-106-generic ([email protected]) (gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) ) #153-Ubuntu SMP Tue Dec 6 15:44:32 UTC 2016</m:value></m:stringMetric><m:metricSet><m:name>Processes</m:name><m:metricSet><m:name>1</m:name><m:stringMetric><m:name>processId</m:name><m:value>1</m:value></m:stringMetric><m:stringMetric><m:name>command</m:name><m:value>init</m:value></m:stringMetric><m:stringMetric><m:name>cpuLoad</m:name><m:value>5.1</m:value></m:stringMetric><m:stringMetric><m:name>memUsed</m:name><m:value>0.0</m:value></m:stringMetric><m:stringMetric><m:name>startTime</m:name><m:value>11:21</m:value></m:stringMetric><m:stringMetric><m:name>userId</m:name><m:value>root</m:value></m:stringMetric></m:metricSet> </m:metricSet><m:metricSet><m:name>Xroad Processes</m:name><m:metricSet><m:name>1161</m:name><m:stringMetric><m:name>processId</m:name><m:value>1161</m:value></m:stringMetric><m:stringMetric><m:name>command</m:name><m:value>/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java -Xmx192m -XX:MaxMetaspaceSize=100m -Djruby.compile.mode=OFF -Djna.tmpdir=/var/lib/xroad -Djetty.admin.port=8083 -Djetty.public.port=8084 -Daddon.extraClasspath= -Dlogback.configurationFile=/etc/xroad/conf.d/jetty-logback.xml -XX:+UseG1GC -Dfile.encoding=UTF-8 -Xshare:auto -Djdk.tls.ephemeralDHKeySize=2048 -cp /usr/share/xroad/jetty9/start.jar org.eclipse.jetty.start.Main jetty.home=/usr/share/xroad/jetty9</m:value></m:stringMetric><m:stringMetric><m:name>cpuLoad</m:name><m:value>9.3</m:value></m:stringMetric><m:stringMetric><m:name>memUsed</m:name><m:value>2.6</m:value></m:stringMetric><m:stringMetric><m:name>startTime</m:name><m:value>11:22</m:value></m:stringMetric><m:stringMetric><m:name>userId</m:name><m:value>xroad</m:value></m:stringMetric></m:metricSet><m:metricSet><m:name>1162</m:name><m:stringMetric><m:name>processId</m:name><m:value>1162</m:value></m:stringMetric><m:stringMetric><m:name>command</m:name><m:value>/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java -Xmx50m -XX:MaxMetaspaceSize=30m -Dlogback.configurationFile=/etc/xroad/conf.d/confclient-logback-service.xml -XX:+UseG1GC -Dfile.encoding=UTF-8 -Xshare:auto -Djdk.tls.ephemeralDHKeySize=2048 -cp /usr/share/xroad/jlib/configuration-client.jar ee.ria.xroad.common.conf.globalconf.ConfigurationClientMain</m:value></m:stringMetric><m:stringMetric><m:name>cpuLoad</m:name><m:value>11.0</m:value></m:stringMetric><m:stringMetric><m:name>memUsed</m:name><m:value>2.7</m:value></m:stringMetric><m:stringMetric><m:name>startTime</m:name><m:value>11:22</m:value></m:stringMetric><m:stringMetric><m:name>userId</m:name><m:value>xroad</m:value></m:stringMetric></m:metricSet></m:metricSet><m:metricSet><m:name>Packages</m:name><m:stringMetric><m:name>accountsservice</m:name><m:value>0.6.35-0ubuntu7.3</m:value></m:stringMetric><m:stringMetric><m:name>acpid</m:name><m:value>1:2.0.21-1ubuntu2</m:value></m:stringMetric><m:stringMetric><m:name>xroad-addon-messagelog</m:name><m:value>6.9.0-1.20170104084337gitb8fe14a</m:value></m:stringMetric><m:stringMetric><m:name>xroad-addon-metaservices</m:name><m:value>6.9.0-1.20170104084337gitb8fe14a</m:value></m:stringMetric><m:stringMetric><m:name>xroad-addon-proxymonitor</m:name><m:value>6.9.0-1.20170104084337gitb8fe14a</m:value></m:stringMetric><m:stringMetric><m:name>xroad-addon-wsdlvalidator</m:name><m:value>6.9.0-1.20170104084337gitb8fe14a</m:value></m:stringMetric><m:stringMetric><m:name>xroad-common</m:name><m:value>6.9.0-1.20170104084337gitb8fe14a</m:value></m:stringMetric><m:stringMetric><m:name>xroad-jetty9</m:name><m:value>6.9.0-1.20170104084337gitb8fe14a</m:value></m:stringMetric><m:stringMetric><m:name>xroad-monitor</m:name><m:value>6.9.0-1.20170104084337gitb8fe14a</m:value></m:stringMetric><m:stringMetric><m:name>xroad-proxy</m:name><m:value>6.9.0-1.20170104084337gitb8fe14a</m:value></m:stringMetric><m:stringMetric><m:name>xroad-securityserver</m:name><m:value>6.9.0-1.20170104084337gitb8fe14a</m:value></m:stringMetric><m:stringMetric><m:name>xroad-securityserver-fi</m:name><m:value>6.9.0-1.20170104084337gitb8fe14a</m:value></m:stringMetric><m:stringMetric><m:name>xz-utils</m:name><m:value>5.1.1alpha+20120614-2ubuntu2</m:value></m:stringMetric><m:stringMetric><m:name>zerofree</m:name><m:value>1.0.2-1ubuntu1</m:value></m:stringMetric><m:stringMetric><m:name>zlib1g</m:name><m:value>1:1.2.8.dfsg-1ubuntu1</m:value></m:stringMetric></m:metricSet></m:metricSet></m:metricSet></m:getSecurityServerMetricsResponse>";
SOAPElement message = SOAPHelper.xmlStrToSOAPElement(xml);
NodeList list = message.getElementsByTagNameNS(Constants.NS_ENV_MONITORING_URL, Constants.NS_ENV_MONITORING_ELEM_METRIC_SET);
Map<String, String> results = SOAPHelper.getXRdVersionInfo(list);
assertEquals("6.9.0-1.20170104084337gitb8fe14a", results.get("xroad-addon-messagelog"));
assertEquals("6.9.0-1.20170104084337gitb8fe14a", results.get("xroad-addon-metaservices"));
assertEquals("6.9.0-1.20170104084337gitb8fe14a", results.get("xroad-addon-proxymonitor"));
assertEquals("6.9.0-1.20170104084337gitb8fe14a", results.get("xroad-addon-wsdlvalidator"));
assertEquals("6.9.0-1.20170104084337gitb8fe14a", results.get("xroad-common"));
assertEquals("6.9.0-1.20170104084337gitb8fe14a", results.get("xroad-jetty9"));
assertEquals("6.9.0-1.20170104084337gitb8fe14a", results.get("xroad-monitor"));
assertEquals("6.9.0-1.20170104084337gitb8fe14a", results.get("xroad-proxy"));
assertEquals("6.9.0-1.20170104084337gitb8fe14a", results.get("xroad-securityserver"));
assertEquals("6.9.0-1.20170104084337gitb8fe14a", results.get("xroad-securityserver-fi"));
}
示例15: testAddElementToGlobalNs
import javax.xml.soap.SOAPElement; //导入依赖的package包/类
@Test
public void testAddElementToGlobalNs() throws Exception {
// Create empty SOAP message
SOAPMessage msg = createSoapMessage();
SOAPBody body = msg.getSOAPPart().getEnvelope().getBody();
// Add elements
SOAPElement parentExplicitNS = body.addChildElement("content", "", TEST_NS);
parentExplicitNS.addNamespaceDeclaration("", TEST_NS);
SOAPElement childGlobalNS = parentExplicitNS.addChildElement("global-child", "", "");
childGlobalNS.addNamespaceDeclaration("", "");
SOAPElement grandChildGlobalNS = childGlobalNS.addChildElement("global-grand-child");
SOAPElement childDefaultNS = parentExplicitNS.addChildElement("default-child");
// Check namespace URIs
Assert.assertNull(childGlobalNS.getNamespaceURI());
Assert.assertNull(grandChildGlobalNS.getNamespaceURI());
Assert.assertEquals(childDefaultNS.getNamespaceURI(), TEST_NS);
}