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


Java SOAPMessage.getMimeHeaders方法代碼示例

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


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

示例1: getResponse

import javax.xml.soap.SOAPMessage; //導入方法依賴的package包/類
@Override
protected Packet getResponse(Packet request, @Nullable SOAPMessage returnValue, WSDLPort port, WSBinding binding) {
    Packet response = super.getResponse(request, returnValue, port, binding);
    // Populate SOAPMessage's transport headers
    if (returnValue != null && response.supports(Packet.OUTBOUND_TRANSPORT_HEADERS)) {
        MimeHeaders hdrs = returnValue.getMimeHeaders();
        Map<String, List<String>> headers = new HashMap<String, List<String>>();
        Iterator i = hdrs.getAllHeaders();
        while(i.hasNext()) {
            MimeHeader header = (MimeHeader)i.next();
            if(header.getName().equalsIgnoreCase("SOAPAction"))
                // SAAJ sets this header automatically, but it interferes with the correct operation of JAX-WS.
                // so ignore this header.
                continue;

            List<String> list = headers.get(header.getName());
            if (list == null) {
                list = new ArrayList<String>();
                headers.put(header.getName(), list);
            }
            list.add(header.getValue());
        }
        response.put(Packet.OUTBOUND_TRANSPORT_HEADERS, headers);
    }
    return response;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:27,代碼來源:SOAPProviderArgumentBuilder.java

示例2: addAuthorization

import javax.xml.soap.SOAPMessage; //導入方法依賴的package包/類
/**
 * Adds 'Authorization' to the input message's header, provided the userId property has been defined.
 * @param message the SOAP message.
 */
protected void addAuthorization(SOAPMessage message) {
    if (getUserId() != null) {
        StringBuilder userPwd = new StringBuilder(getUserId());
        if (getPassword() != null) {
            userPwd.append(':').append(getPassword());
        }

        // @todo: Do not use SUN's class. Find an alternative or write our own function
        // @todo: Change the password property from String to byte[]
        String authorization = new sun.misc.BASE64Encoder().encode(userPwd.toString().getBytes());
        MimeHeaders headers = message.getMimeHeaders();
        headers.addHeader("Authorization", "Basic " + authorization);
    }
}
 
開發者ID:jaffa-projects,項目名稱:jaffa-framework,代碼行數:19,代碼來源:WebServiceInvoker.java


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