本文整理匯總了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;
}
示例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;
}
示例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;
}