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