Using JAX-WS: How can I set the user agent property

前端 未结 3 791
渐次进展
渐次进展 2021-01-04 10:23

I\'ve searched on this and found a few near misses. I\'ve created a java client to consume a web service using JAX-WS. Is there a way when using JAX to set the HTTP_USER_A

3条回答
  •  一个人的身影
    2021-01-04 11:16

    Let me question the idea of having HTTP header first.

    A more correct (WS-centric) approach is to set SOAP Header, not HTTP header. Consider this: SOAP messages can be delivered not only by HTTP, but by JMS, SMTP or custom transports. By requiring to have user-agent HTTP Header, you unnecessary tie you code to only one transport, albeit currently prevailing.

    This is the reason BTW why JAX-WS have no notion of HTTP headers except in handlers.

    And (of course) StackOverlow knows how to create SOAP headers.

提交回复
热议问题