当前位置: 首页>>代码示例>>Java>>正文


Java SOAPMessageContext.put方法代码示例

本文整理汇总了Java中javax.xml.ws.handler.soap.SOAPMessageContext.put方法的典型用法代码示例。如果您正苦于以下问题:Java SOAPMessageContext.put方法的具体用法?Java SOAPMessageContext.put怎么用?Java SOAPMessageContext.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.xml.ws.handler.soap.SOAPMessageContext的用法示例。


在下文中一共展示了SOAPMessageContext.put方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleOutbound

import javax.xml.ws.handler.soap.SOAPMessageContext; //导入方法依赖的package包/类
@Override
protected boolean handleOutbound(SOAPMessageContext msgContext)
{
   log.info("handleOutbound");

   // legacy JBossWS-Native approach
   SOAPMessage soapMessage = msgContext.getMessage();
   MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
   mimeHeaders.setHeader("Cookie", "client-cookie=true");

   // proper approach through MessageContext.HTTP_REQUEST_HEADERS
   Map<String, List<String>> httpHeaders = new HashMap<String, List<String>>();
   httpHeaders.put("Cookie", Collections.singletonList("client-cookie=true"));
   msgContext.put(MessageContext.HTTP_REQUEST_HEADERS, httpHeaders);

   inboundCookie = null;

   return true;
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:20,代码来源:ClientMimeHandler.java

示例2: handleOutbound

import javax.xml.ws.handler.soap.SOAPMessageContext; //导入方法依赖的package包/类
@Override
protected boolean handleOutbound(SOAPMessageContext msgContext)
{
   log.info("handleOutbound");

   if (setCookieOnResponse)
   {
      // legacy JBossWS-Native approach
      SOAPMessage soapMessage = msgContext.getMessage();
      MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
      mimeHeaders.setHeader("Set-Cookie", "server-cookie=true");

      // proper approach through MessageContext.HTTP_REQUEST_HEADERS
      Map<String, List<String>> httpHeaders = new HashMap<String, List<String>>();
      httpHeaders.put("Set-Cookie", Collections.singletonList("server-cookie=true"));
      msgContext.put(MessageContext.HTTP_REQUEST_HEADERS, httpHeaders);

      setCookieOnResponse = false;
   }

   return true;
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:23,代码来源:ServerMimeHandler.java

示例3: handleMessage

import javax.xml.ws.handler.soap.SOAPMessageContext; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", })
@Override
public boolean handleMessage(SOAPMessageContext context) {

    boolean isOut = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);

    // outbound
    if (isOut == true) {
        Map<String, List<String>> headers = (Map<String, List<String>>) context
                .get(MessageContext.HTTP_REQUEST_HEADERS);

        List<String> ls = new ArrayList<String>();

        ls.add(MonitorServerUtil.getUAVClientSrc(appid));

        if (headers == null) {
            headers = new HashMap<String, List<String>>();
            context.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
        }

        // when service use axis 1.4, SOAPAction header is necessary
        if (!headers.containsKey("SOAPAction")) {
            List<String> soapActionHeader = new ArrayList<String>();
            soapActionHeader.add("\"\"");
            headers.put("SOAPAction", soapActionHeader);
        }

        headers.put("UAV-Client-Src", ls);
        for (String key : this.headerMeta.keySet()) {
            headers.remove(key);
        }
        headers.putAll(this.headerMeta);
    }
    // inbound
    else {

        getTargetServer(context);
    }
    return true;
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:41,代码来源:JaxWSHookIT.java

示例4: handleInbound

import javax.xml.ws.handler.soap.SOAPMessageContext; //导入方法依赖的package包/类
@Override
public boolean handleInbound(SOAPMessageContext msgContext)
{
   log.info("handleRequest");

   MAPBuilder builder = MAPBuilderFactory.getInstance().getBuilderInstance();
   MAP addrProps = builder.inboundMap(msgContext);

   if (addrProps == null)
      throw new IllegalStateException("Cannot obtain AddressingProperties");

   String clientid = null;
   MAPEndpoint replyTo = addrProps.getReplyTo();
   for (Object obj :replyTo.getReferenceParameters())
   {
      if (obj instanceof Element)
      {
         Element el = (Element)obj;
         QName qname = getElementQName(el);
         if (qname.equals(IDQN))
         {
            clientid = getTextContent(el);
         }
      }
      else
      {
         log.warn("Unsupported reference parameter found: " + obj);
      }
   }

   if (clientid == null)
      throw new IllegalStateException("Cannot obtain client id");

   // put the clientid in the message context
   msgContext.put("clientid", clientid);
   msgContext.setScope("clientid", Scope.APPLICATION);
   return true;
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:39,代码来源:ServerHandler.java

示例5: handleMessage

import javax.xml.ws.handler.soap.SOAPMessageContext; //导入方法依赖的package包/类
@Override
public boolean handleMessage(SOAPMessageContext context) {
    try {

        Boolean outbound = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
        if (outbound) {

            SOAPMessage message = context.getMessage();
            SOAPHeader header = message.getSOAPHeader();
            SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
            if (header == null) {
                header = envelope.addHeader();
            }

            for (Map.Entry<String, String> entry : headers.entrySet()) {
                header.addHeaderElement(new QName(namespaceURI, entry.getKey())).addTextNode(entry.getValue());
            }
        } else {
            String headerValue = getSpecificHeaderValue(context.getMessage().getSOAPHeader(), ServiceUtils.TRACKING_HEADER_NAME);
            if (headerValue != null) {
                context.put(ServiceUtils.TRACKING_KEY, headerValue);

                context.setScope(ServiceUtils.TRACKING_KEY, MessageContext.Scope.APPLICATION);
            }
        }

    } catch (Exception e) {
        throw new InternalException(e);
    }

    return true;

}
 
开发者ID:BingAds,项目名称:BingAds-Java-SDK,代码行数:34,代码来源:HeaderHandler.java


注:本文中的javax.xml.ws.handler.soap.SOAPMessageContext.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。