6 Ocak 2011 Perşembe

Retrieving Soap Input Message in JAX-WS

This article will show you how to retrieve soap input message by JAX-WS in a simple way.

First you have to add an instance variable with annotation of @Resource .

@Resource
WebServiceContext webServiceContext;


Then you can get soap input message like this .

ByteArrayOutputStream bout = new ByteArrayOutputStream();
((SOAPMessageContext)webServiceContext.getMessageContext()).getMessage().writeTo(bout);
String inputXML = new String(bout.toByteArray());

And you can also get header values via webServiceContext .

Hiç yorum yok:

Yorum Gönder