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


Java SOAPHeader.extractHeaderElements方法代碼示例

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


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

示例1: testHeaderElements

import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
@Validated @Test
public void testHeaderElements() throws Exception {
    SOAPEnvelope envelope = getSOAPEnvelope();
    SOAPHeader header = envelope.getHeader();

    SOAPHeaderElement headerEle = header.addHeaderElement(envelope.createName("foo1",
                                                                              "f1",
                                                                              "foo1-URI"));
    headerEle.setActor("actor-URI");
    headerEle.setMustUnderstand(true);

    Iterator iterator = header.extractHeaderElements("actor-URI");
    int cnt = 0;
    while (iterator.hasNext()) {
        cnt++;
        SOAPHeaderElement resultHeaderEle = (SOAPHeaderElement)iterator.next();

        assertEquals(headerEle.getActor(), resultHeaderEle.getActor());
        assertEquals(resultHeaderEle.getMustUnderstand(), headerEle.getMustUnderstand());
    }
    assertTrue(cnt == 1);
    iterator = header.extractHeaderElements("actor-URI");
    assertTrue(!iterator.hasNext());
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:25,代碼來源:SOAPEnvelopeTest.java

示例2: parseApiVersion

import javax.xml.soap.SOAPHeader; //導入方法依賴的package包/類
public static String parseApiVersion(SOAPMessageContext context)
        throws SOAPException {

    SOAPMessage soapMessage = context.getMessage();

    SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
    SOAPHeader soapHeader = soapEnvelope.getHeader();
    if (soapHeader == null) {
        return "";
    }

    Iterator<?> it = null;
    Iterator<?> itCm = soapHeader.extractHeaderElements(VERSION_CM);
    if (itCm == null || !itCm.hasNext()) {
        Iterator<?> itCtmg = soapHeader.extractHeaderElements(VERSION_CTMG);
        if (itCtmg == null || !itCtmg.hasNext()) {
            return "";
        } else {
            it = itCtmg;
        }
    } else {
        it = itCm;
    }

    Node node = (Node) it.next();
    String value = node == null ? null : node.getValue();

    return value;
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:30,代碼來源:SoapRequestParser.java


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