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


Java SOAPMessageContext.setScope方法代碼示例

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


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

示例1: 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

示例2: handleOutbound

import javax.xml.ws.handler.soap.SOAPMessageContext; //導入方法依賴的package包/類
@Override
public boolean handleOutbound(SOAPMessageContext msgContext)
{
   log.info("handleResponse");

   MAPBuilder builder = MAPBuilderFactory.getInstance().getBuilderInstance();
   MAP inProps = builder.inboundMap(msgContext);
   MAP outProps = builder.newMap();
   outProps.initializeAsDestination(inProps.getReplyTo());

   outProps.installOutboundMapOnServerSide(msgContext, outProps);
   msgContext.setScope(builder.newConstants().getServerAddressingPropertiesOutbound(), Scope.APPLICATION);

   return true;
}
 
開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:16,代碼來源:ServerHandler.java

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