Get HTTP response code from JAX-WS asynchronous we

2019-06-08 22:50发布

I have an asynchronous JAX-WS web service (@WebService and @WebMethod annotations). I am invoking it in Java. and I would like to know how to get HTTP response code from that service in Java code.

1条回答
三岁会撩人
2楼-- · 2019-06-08 23:30

I couldn't find anything on that subject, but I deduced solution based on how my request context is built, because I needed response context so I thought they may be similar. Request context:

((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint)

So I thought that this may work:

int responseCode = (int)((BindingProvider) port).getResponseContext().get(MessageContext.HTTP_RESPONSE_CODE);

And it works. ; )

查看更多
登录 后发表回答