当前位置: 首页>>代码示例>>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;未经允许,请勿转载。