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


Java SOAPHeader.detachNode方法代碼示例

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


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

示例1: testProviderDispatch

import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testProviderDispatch() throws Exception
{
   Dispatch<SOAPMessage> dispatch = createDispatch("ProviderEndpoint");
   SOAPMessage reqMsg = getRequestMessage();

   SOAPMessage resMsg = dispatch.invoke(reqMsg);
   SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
   
   SOAPHeader soapHeader = resEnv.getHeader();
   if (soapHeader != null)
      soapHeader.detachNode();
   
   assertEquals(DOMUtils.parse(msgString), resEnv);
}
 
開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:17,代碼來源:ProviderMessageTestCase.java

示例2: testProviderMessage

import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testProviderMessage() throws Exception
{
   SOAPMessage reqMsg = getRequestMessage();
   SOAPEnvelope reqEnv = reqMsg.getSOAPPart().getEnvelope();

   URL epURL = baseURL;
   SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
   SOAPMessage resMsg = con.call(reqMsg, epURL);
   SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();

   SOAPHeader soapHeader = resEnv.getHeader();
   if (soapHeader != null)
      soapHeader.detachNode();
   
   assertEquals(reqEnv, resEnv);
}
 
開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:19,代碼來源:ProviderMessageTestCase.java

示例3: getStockQuote

import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
public String getStockQuote(String tickerSymbol) throws Exception {
    SOAPConnectionFactory scFactory = SOAPConnectionFactory.newInstance();
    SOAPConnection con = scFactory.createConnection();

    MessageFactory factory = MessageFactory.newInstance();
    SOAPMessage message = factory.createMessage();

    SOAPPart soapPart = message.getSOAPPart();
    SOAPEnvelope envelope = soapPart.getEnvelope();

    SOAPHeader header = envelope.getHeader();
    SOAPBody body = envelope.getBody();

    header.detachNode();

    Name bodyName = envelope.createName("getQuote", "n", "urn:xmethods-delayed-quotes");
    SOAPBodyElement gltp = body.addBodyElement(bodyName);

    Name name = envelope.createName("symbol");
    SOAPElement symbol = gltp.addChildElement(name);
    symbol.addTextNode(tickerSymbol);

    URLEndpoint endpoint = new URLEndpoint("http://64.124.140.30/soap");
    SOAPMessage response = con.call(message, endpoint);
    con.close();

    SOAPPart sp = response.getSOAPPart();
    SOAPEnvelope se = sp.getEnvelope();
    SOAPBody sb = se.getBody();
    Iterator it = sb.getChildElements();
    while (it.hasNext()) {
        SOAPBodyElement bodyElement = (SOAPBodyElement) it.next();
        Iterator it2 = bodyElement.getChildElements();
        while (it2.hasNext()) {
            SOAPElement element2 = (SOAPElement) it2.next();
            return element2.getValue();
        }
    }
    return null;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:41,代碼來源:DelayedStockQuote.java

示例4: testProviderMessage

import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testProviderMessage() throws Exception
{
   String reqEnvStr =
      "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
      "  <env:Body>" + reqString + "</env:Body>" +
      "</env:Envelope>";

   MessageFactory msgFactory = MessageFactory.newInstance();
   SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
   SOAPMessage reqMsg = msgFactory.createMessage(null, new ByteArrayInputStream(reqEnvStr.getBytes()));

   URL epURL = baseURL;
   SOAPMessage resMsg = con.call(reqMsg, epURL);
   SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();

   SOAPHeader soapHeader = resEnv.getHeader();
   if (soapHeader != null)
      soapHeader.detachNode();

   Node responseBody = DOMUtils.getFirstChildElement(resEnv.getBody());
   assertEquals("wrong namespace: " + responseBody.getNamespaceURI(), "http://org.jboss.ws/provider", responseBody.getNamespaceURI());
   assertEquals("wrong localPart: " + responseBody.getLocalName(), "somePayload", responseBody.getLocalName());
   String responseString = DOMUtils.getTextContent(responseBody);
   assertEquals("wrong content: " + responseString, "Hello:Inbound:LogicalSourceHandler:Outbound:LogicalSourceHandler", responseString);
}
 
開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:28,代碼來源:ProviderPayloadTestCase.java

示例5: replaceByJPlagException

import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
/**
 * Manually builds up a JPlagException SOAP message and replaces the
 * original one with it
 */
public void replaceByJPlagException(SOAPMessageContext smsg, String desc, String rep) {
	try {
		SOAPMessage msg = smsg.getMessage();
		SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();

		/*
		 * Remove old header andy body
		 */

		SOAPHeader oldheader = envelope.getHeader();
		if (oldheader != null)
			oldheader.detachNode();
		SOAPBody oldbody = envelope.getBody();
		if (oldbody != null)
			oldbody.detachNode();

		SOAPBody sb = envelope.addBody();
		SOAPFault sf = sb.addFault(envelope.createName("Server", "env", SOAPConstants.URI_NS_SOAP_ENVELOPE),
				"jplagWebService.server.JPlagException");
		Detail detail = sf.addDetail();
		DetailEntry de = detail.addDetailEntry(envelope.createName("JPlagException", "ns0", JPLAG_WEBSERVICE_BASE_URL + "types"));

		SOAPElement e = de.addChildElement("exceptionType");
		e.addTextNode("accessException");

		e = de.addChildElement("description");
		e.addTextNode(desc);

		e = de.addChildElement("repair");
		e.addTextNode(rep);
	} catch (SOAPException x) {
		x.printStackTrace();
	}
}
 
開發者ID:jplag,項目名稱:jplag,代碼行數:39,代碼來源:JPlagServerAccessHandler.java

示例6: testDetachHeader

import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
@Validated @Test
public void testDetachHeader() throws Exception {
    MessageFactory mf = MessageFactory.newInstance();
    SOAPMessage smsg =
            mf.createMessage(new MimeHeaders(),
                             new ByteArrayInputStream(XML_STRING.getBytes()));
    SOAPPart sp = smsg.getSOAPPart();
    SOAPEnvelope se = sp.getEnvelope();
    assertTrue(se != null);
    SOAPHeader header = se.getHeader();
    assertNotNull(header);
    header.detachNode();
    assertNull(se.getHeader());
    assertNull(smsg.getSOAPHeader());
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:16,代碼來源:SOAPEnvelopeTest.java


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