JAX WS中RequestContext和MessageContext之间的区别 [英] Difference between RequestContext and MessageContext in JAX WS

查看:60
本文介绍了JAX WS中RequestContext和MessageContext之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JAX-WS中RequestContext和MessageContext有什么区别?

What is the difference between RequestContext and MessageContext in JAX-WS?

推荐答案

MessageContext 提供对JAX-WS调用中当前入站或出站消息的访问,特别是对于JAX-WS处理程序.服务提供商的入站是请求消息,而出站是响应;对于JAX-WS客户端处理程序,出站是请求,入站是响应.

MessageContext provides access to the current inbound or outbound message in a JAX-WS call, specifically for JAX-WS handlers. Inbound to a service provider is the request message while outbound is the response; For a JAX-WS client handler, outbound is the request and inbound is the response.

我必须查找

I had to look up RequestContext - it isn't technically a JAX-WS class. It's a proprietary (read: implementation) class in the JAX-WS reference implementation. I don't think you'd want to couple/compile your code against this, but I do expect you'd see it during debugger sessions if you're using the JAX-WS RI.

如果您偶然是指

If by chance you're referring to BindingProvider.getRequestContext(), this is a Map<String, Object> that is a map that contains values for initializing the outbound request message for a JAX-WS client. For example, to programmatically set the endpoint URL:

Map<String, Object> requestContext = ((BindingProvider)port).getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, myCustomEndpointUrl);

这篇关于JAX WS中RequestContext和MessageContext之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆