當前位置: 首頁>>代碼示例>>Java>>正文


Java SOAPEnvelope.createName方法代碼示例

本文整理匯總了Java中javax.xml.soap.SOAPEnvelope.createName方法的典型用法代碼示例。如果您正苦於以下問題:Java SOAPEnvelope.createName方法的具體用法?Java SOAPEnvelope.createName怎麽用?Java SOAPEnvelope.createName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.xml.soap.SOAPEnvelope的用法示例。


在下文中一共展示了SOAPEnvelope.createName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createMessage

import javax.xml.soap.SOAPEnvelope; //導入方法依賴的package包/類
private SOAPMessage createMessage(MessageFactory mf) throws SOAPException, IOException {
    SOAPMessage msg = mf.createMessage();
    SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
    Name name = envelope.createName("hello", "ex", "http://example.com");
    envelope.getBody().addChildElement(name).addTextNode("THERE!");

    String s = "<root><hello>THERE!</hello></root>";

    AttachmentPart ap = msg.createAttachmentPart(
            new StreamSource(new ByteArrayInputStream(s.getBytes())),
            "text/xml"
    );
    msg.addAttachmentPart(ap);
    msg.saveChanges();

    return msg;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:XmlTest.java

示例2: createSimpleSOAPPart

import javax.xml.soap.SOAPEnvelope; //導入方法依賴的package包/類
private void createSimpleSOAPPart(SOAPMessage message) throws SOAPException {
    SOAPPart sPart = message.getSOAPPart();
    SOAPEnvelope env = sPart.getEnvelope();
    SOAPBody body = env.getBody();
    SOAPHeader header = env.getHeader();
    header.addHeaderElement(env.createName("Header1",
                                           "pref",
                                           "http://test.apach.org/test"))
            .addTextNode("This is header1");

    Name ns = env.createName("echo", "swa2", "http://fakeNamespace2.org");
    final SOAPBodyElement bodyElement = body.addBodyElement(ns);
    Name ns2 = env.createName("something");
    final SOAPElement ele1 = bodyElement.addChildElement(ns2);
    ele1.addTextNode("This is some text");

    Name ns3 = env.createName("ping", "swa3", "http://fakeNamespace3.org");
    final SOAPBodyElement bodyElement2 = body.addBodyElement(ns3);
    Name ns4 = env.createName("another");
    final SOAPElement ele2 = bodyElement2.addChildElement(ns4);
    ele2.addTextNode("This is another text");
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:23,代碼來源:IntegrationTest.java

示例3: writeTerminalResponse

import javax.xml.soap.SOAPEnvelope; //導入方法依賴的package包/類
/**
 * Gets the terminal response.
 * 
 * @param message
 * @throws SOAPException
 */
private void writeTerminalResponse(SOAPMessage message) throws SOAPException {
    SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
    Name terminalResponseName = envelope.createName("EditTerminalResponse", PREFIX, NAMESPACE_URI);
    SOAPBodyElement terminalResponseElement = (SOAPBodyElement) message.getSOAPBody().getChildElements(terminalResponseName).next();

    NodeList list = terminalResponseElement.getChildNodes();
    Node n = null;
    for (int i = 0; i < list.getLength(); i++) {
        n = list.item(i);
        if ("status".equalsIgnoreCase(n.getLocalName()))
            break;
    }

    logger.info("status of device = " + n.getNodeValue());

}
 
開發者ID:booleguo,項目名稱:sam-elle,代碼行數:23,代碼來源:EditTerminalClient.java

示例4: createTerminalRequest

import javax.xml.soap.SOAPEnvelope; //導入方法依賴的package包/類
/**
 * This method creates a Terminal Request and sends back the SOAPMessage.
 * MSISDN value is passed into this method
 * 
 * @param msisdn
 * @return
 * @throws SOAPException
 */
private SOAPMessage createTerminalRequest(String msisdn) throws SOAPException {
    SOAPMessage message = messageFactory.createMessage();
    message.getMimeHeaders().addHeader("SOAPAction", "http://api.jasperwireless.com/ws/service/terminal/GetTerminalsByMsisdn");
    SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
    Name terminalRequestName = envelope.createName("GetTerminalsByMsisdnRequest", PREFIX, NAMESPACE_URI);
    SOAPBodyElement terminalRequestElement = message.getSOAPBody().addBodyElement(terminalRequestName);
    Name msgId = envelope.createName("messageId", PREFIX, NAMESPACE_URI);
    SOAPElement msgElement = terminalRequestElement.addChildElement(msgId);
    msgElement.setValue("TCE-100-ABC-34084");
    Name version = envelope.createName("version", PREFIX, NAMESPACE_URI);
    SOAPElement versionElement = terminalRequestElement.addChildElement(version);
    versionElement.setValue("1.0");
    Name license = envelope.createName("licenseKey", PREFIX, NAMESPACE_URI);
    SOAPElement licenseElement = terminalRequestElement.addChildElement(license);
    licenseElement.setValue(apiKey);
    Name msisdns = envelope.createName("msisdns", PREFIX, NAMESPACE_URI);
    SOAPElement msisdnsElement = terminalRequestElement.addChildElement(msisdns);
    Name msisdnName = envelope.createName("msisdn", PREFIX, NAMESPACE_URI);
    SOAPElement msisdnElement = msisdnsElement.addChildElement(msisdnName);
    msisdnElement.setValue(msisdn);
    return message;
}
 
開發者ID:booleguo,項目名稱:sam-elle,代碼行數:31,代碼來源:GetTerminalsByMsisdnClient.java

示例5: writeTerminalResponse

import javax.xml.soap.SOAPEnvelope; //導入方法依賴的package包/類
/**
 * Gets the terminal response.
 * 
 * @param message
 * @throws SOAPException
 */
private String writeTerminalResponse(SOAPMessage message) throws SOAPException {
    SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
    Name terminalResponseName = envelope.createName("GetTerminalsByMsisdnResponse", PREFIX, NAMESPACE_URI);
    SOAPBodyElement terminalResponseElement = (SOAPBodyElement) message.getSOAPBody().getChildElements(terminalResponseName).next();
    Name terminals = envelope.createName("terminals", PREFIX, NAMESPACE_URI);
    Name terminal = envelope.createName("terminal", PREFIX, NAMESPACE_URI);
    SOAPBodyElement terminalsElement = (SOAPBodyElement) terminalResponseElement.getChildElements(terminals).next();
    SOAPBodyElement terminalElement = (SOAPBodyElement) terminalsElement.getChildElements(terminal).next();
    NodeList list = terminalElement.getChildNodes();
    Node n = null, node = null;
    for (int i = 0; i < list.getLength(); i++) {
        node = list.item(i);
        logger.info(node.getLocalName() + ":" + node.getFirstChild().getNodeValue());
        if ("iccid".equalsIgnoreCase(node.getLocalName())) {
            n = node;
        }
    }

    return n.getFirstChild().getNodeValue();

}
 
開發者ID:booleguo,項目名稱:sam-elle,代碼行數:28,代碼來源:GetTerminalsByMsisdnClient.java

示例6: addParameterList

import javax.xml.soap.SOAPEnvelope; //導入方法依賴的package包/類
protected void addParameterList(SOAPEnvelope envelope, SOAPElement eParent, String typeName, String listName, Map<String, String> params) throws SOAPException
{
	Name nPara = envelope.createName(typeName, "", XMLA_URI);
	SOAPElement eType = eParent.addChildElement(nPara);
	nPara = envelope.createName(listName, "", XMLA_URI);
	SOAPElement eList = eType.addChildElement(nPara);
	if (params == null)
	{
		return;
	}
	for (Iterator<Map.Entry<String, String>> entryIt = params.entrySet().iterator(); entryIt.hasNext();)
	{
		Map.Entry<String, String> entry = entryIt.next();
		String tag = entry.getKey();
		String value = entry.getValue();
		nPara = envelope.createName(tag, "", XMLA_URI);
		SOAPElement eTag = eList.addChildElement(nPara);
		eTag.addTextNode(value);
	}
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:21,代碼來源:JRXmlaQueryExecuter.java

示例7: onMessage

import javax.xml.soap.SOAPEnvelope; //導入方法依賴的package包/類
public SOAPMessage onMessage(SOAPMessage msg){
    //handles the response back from the registry
    PrintStream orig = System.out;
    
    try {
        SOAPEnvelope env = msg.getSOAPPart().getEnvelope();
        Name response = env.createName("response");
        env.getBody().getChildElements(response);
        
    } catch (SOAPException ex) {
        ByteArrayOutputStream logarray = new ByteArrayOutputStream();
        ex.printStackTrace(writeErrorlog(logarray));
        logstring = logarray.toString();
        setlogmsg(logstring);  
    }
    
    return msg;
}
 
開發者ID:jembi,項目名稱:openxds,代碼行數:19,代碼來源:SoapRequestBean.java

示例8: addParameterList

import javax.xml.soap.SOAPEnvelope; //導入方法依賴的package包/類
/**
 * Add the all the specified parameters to the discover request message
 *   
 * @param envelope the envelope of the message 
 * @param eParent the discover query content
 * @param typeName the type of the parameter list (essentially can be or Properties or Restrictions)
 * @param listName the name of the list parameter tag (essentially can be or PropertyList or RestrictionList)
 * @param params parameters map where the key is the name of the parameter and the value is the value of the parameter
 * @throws SOAPException
 */
protected void addParameterList(SOAPEnvelope envelope, SOAPElement eParent, String typeName, String listName, Map<String, String> params) throws SOAPException
{
	Name nPara = envelope.createName(typeName, "", XMLA_URI);
	SOAPElement eType = eParent.addChildElement(nPara);
	nPara = envelope.createName(listName, "", XMLA_URI);
	SOAPElement eList = eType.addChildElement(nPara);
	if (params == null)
		return;

	Iterator<String> it = params.keySet().iterator();
	while (it.hasNext())
	{
		String tag = (String) it.next();
		String value = (String) params.get(tag);
		nPara = envelope.createName(tag, "", XMLA_URI);
		SOAPElement eTag = eList.addChildElement(nPara);
		eTag.addTextNode(value);
	}
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:30,代碼來源:MetadataDiscover.java

示例9: getDatasources

import javax.xml.soap.SOAPEnvelope; //導入方法依賴的package包/類
/**
 * Return an array of the datasources in the server, could be null
 * @return array of datasources
 */
public DataSourceTreeElement[] getDatasources() {
	setRequestType("DISCOVER_DATASOURCES");
	SOAPMessage response = executeDiscover(new HashMap<String, String>());
	SOAPPart soapPart = response.getSOAPPart();
	SOAPEnvelope soapEnvelope;
	try {			 
		soapEnvelope = soapPart.getEnvelope();
		SOAPElement rowSet = getRowsSet(response, soapEnvelope);
		List<DataSourceTreeElement> result = new ArrayList<DataSourceTreeElement>();
		Name rowElement = soapEnvelope.createName("row", "", ROW_URI);
		Iterator<?> rowValuesElement = rowSet.getChildElements(rowElement);
		while (rowValuesElement.hasNext())
		{
			SOAPElement cellElement = (SOAPElement)rowValuesElement.next();
			result.add(new DataSourceElement(this, cellElement));
		}
		return result.toArray(new DataSourceTreeElement[result.size()]);
	} catch (SOAPException e) {
		e.printStackTrace();
	}
	return null;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:27,代碼來源:MetadataDiscover.java

示例10: getCatalogList

import javax.xml.soap.SOAPEnvelope; //導入方法依賴的package包/類
/**
 * Return an array of the catalogs in the server for a specific datasource, could be null
 * @param datasourceName the name of the datasource
 * @return array of catalogs
 */
public DataSourceTreeElement[] getCatalogList(String datasourceName) {
    setRequestType("DBSCHEMA_CATALOGS");
    HashMap<String, String> param = new HashMap<String, String>();
    param.put("DataSourceInfo", datasourceName);
	SOAPMessage response = executeDiscover(param);
	SOAPPart soapPart = response.getSOAPPart();
	SOAPEnvelope soapEnvelope;
	try {
		soapEnvelope = soapPart.getEnvelope();
		SOAPElement rowSet = getRowsSet(response, soapEnvelope);
		List<DataSourceTreeElement> result = new ArrayList<DataSourceTreeElement>();
		Name rowElement = soapEnvelope.createName("row", "", ROW_URI);
		Iterator<?> rowValuesElement = rowSet.getChildElements(rowElement);
		while (rowValuesElement.hasNext())
		{
			SOAPElement cellElement = (SOAPElement)rowValuesElement.next();
			result.add(new CatalogElement(this, cellElement, datasourceName));
		}
		return result.toArray(new DataSourceTreeElement[result.size()]);
	} catch (SOAPException e) {
		e.printStackTrace();
	}
	return null;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:30,代碼來源:MetadataDiscover.java

示例11: getCubeList

import javax.xml.soap.SOAPEnvelope; //導入方法依賴的package包/類
/**
 * Return an array of the cubes in the server for a specific datasource and catalog, could be null
 * @param datasourceName the name of the datasource
 * @param catalogName the name of the catalog
 * @return array of cubes
 */
public DataSourceTreeElement[] getCubeList(String datasourceName, String catalogName) {
    setRequestType("MDSCHEMA_CUBES");
    HashMap<String, String> param = new HashMap<String, String>();
    param.put("DataSourceInfo", datasourceName);
    param.put("Catalog", catalogName);
	SOAPMessage response = executeDiscover(param);
	SOAPPart soapPart = response.getSOAPPart();
	SOAPEnvelope soapEnvelope;
	try {
		soapEnvelope = soapPart.getEnvelope();
		SOAPElement rowSet = getRowsSet(response, soapEnvelope);
		List<DataSourceTreeElement> result = new ArrayList<DataSourceTreeElement>();
		Name rowElement = soapEnvelope.createName("row", "", ROW_URI);
		Iterator<?> rowValuesElement = rowSet.getChildElements(rowElement);
		while (rowValuesElement.hasNext())
		{
			SOAPElement cellElement = (SOAPElement)rowValuesElement.next();
			result.add(new CubeElement(this, cellElement, datasourceName));
		}
		return result.toArray(new DataSourceTreeElement[result.size()]);
	} catch (SOAPException e) {
		e.printStackTrace();
	}
	return null;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:32,代碼來源:MetadataDiscover.java

示例12: addParameterList

import javax.xml.soap.SOAPEnvelope; //導入方法依賴的package包/類
protected void addParameterList(SOAPEnvelope envelope, SOAPElement eParent, String typeName, String listName, Map params) throws SOAPException
{
	Name nPara = envelope.createName(typeName, "", XMLA_URI);
	SOAPElement eType = eParent.addChildElement(nPara);
	nPara = envelope.createName(listName, "", XMLA_URI);
	SOAPElement eList = eType.addChildElement(nPara);
	if (params == null)
		return;

	Iterator it = params.keySet().iterator();
	while (it.hasNext())
	{
		String tag = (String) it.next();
		String value = (String) params.get(tag);
		nPara = envelope.createName(tag, "", XMLA_URI);
		SOAPElement eTag = eList.addChildElement(nPara);
		eTag.addTextNode(value);
	}
}
 
開發者ID:JockiHendry,項目名稱:ireport-fork,代碼行數:20,代碼來源:OLAPQueryExecuter.java

示例13: _testFaults2

import javax.xml.soap.SOAPEnvelope; //導入方法依賴的package包/類
public void _testFaults2() throws Exception {
    SOAPEnvelope envelope = getSOAPEnvelope();
    SOAPBody body = envelope.getBody();
    SOAPFault fault = body.addFault();

    assertTrue(body.getFault() != null);

    Detail d1 = fault.addDetail();
    Name name = envelope.createName("GetLastTradePrice", "WOMBAT",
                                    "http://www.wombat.org/trader");
    d1.addDetailEntry(name);

    Detail d2 = fault.getDetail();
    assertTrue(d2 != null);
    Iterator i = d2.getDetailEntries();
    assertTrue(getIteratorCount(i) == 1);
    i = d2.getDetailEntries();
    while (i.hasNext()) {
        DetailEntry de = (DetailEntry)i.next();
        assertEquals(de.getElementName(), name);
    }
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:23,代碼來源:SOAPEnvelopeTest.java

示例14: testRemoveAttributeName

import javax.xml.soap.SOAPEnvelope; //導入方法依賴的package包/類
@Validated @Test
public void testRemoveAttributeName() throws Exception {
    SOAPMessage msg = MessageFactory.newInstance().createMessage();
    SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
    SOAPBody body = envelope.getBody();

    Name name = envelope.createName("MyAttr1");
    String value = "MyValue1";
    body.addAttribute(name, value);
    boolean b = body.removeAttribute(name);
    assertTrue(b);

    b = body.removeAttribute(name);
    assertTrue(!b);

    String s = body.getAttributeValue(name);
    assertNull(s);
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:19,代碼來源:SOAPElementTest.java

示例15: testGetChildElements2

import javax.xml.soap.SOAPEnvelope; //導入方法依賴的package包/類
@Validated @Test
public void testGetChildElements2() throws Exception {
    MessageFactory fact = MessageFactory.newInstance();
    SOAPMessage message = fact.createMessage();
    SOAPPart soapPart = message.getSOAPPart();
    SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
    SOAPBody soapBody = soapEnvelope.getBody();

    Name name = soapEnvelope.createName("MyChild1");
    SOAPElement se = soapBody.addChildElement(name);
    Iterator childElementsCount = soapBody.getChildElements();
    Iterator childElements = soapBody.getChildElements();

    int childCount = 0;
    while (childElementsCount.hasNext()) {
        Node node = (Node)childElementsCount.next();
        childCount++;
    }
    assertEquals(childCount, 1);
    SOAPElement se2 = (SOAPElement)childElements.next();
    if (!se.equals(se2)) {
        fail();
    } else {
        System.out.println("SOAPElement se = se2 (expected)");
    }

    Name n = se.getElementName();
    assertEquals(n, name);
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:30,代碼來源:SOAPElementTest.java


注:本文中的javax.xml.soap.SOAPEnvelope.createName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。