Hi Marcio,

If you click on the link, you will see the Apache CXF interceptor from Glen
Mazza and the team:

https://cwiki.apache.org/CXF20DOC/interceptors.html

In it, they show the use of the CXF interceptor and specifically code
samples on how:

public class SoapActionInInterceptor extends AbstractSoapInterceptor {

    public SoapActionInInterceptor() {
        super(Phase.READ);
        addAfter(ReadHeadersInterceptor.class.getName());
        addAfter(EndpointSelectionInterceptor.class.getName());
    }

    public void handleMessage(SoapMessage message) throws Fault {
        if (message.getVersion() instanceof Soap11) {
            Map<String, List<String>> headers =
CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS));
            if (headers != null) {
                List<String> sa = headers.get("SOAPAction");
                if (sa != null && sa.size() > 0) {
                    String action = sa.get(0);
                    if (action.startsWith("\"")) {
                        action = action.substring(1, action.length() - 1);
                    }
                    getAndSetOperation(message, action);
                }
            }
        } else if (message.getVersion() instanceof Soap12) {
          ...........
        }
    }


On Fri, Feb 24, 2012 at 1:15 PM, Márcio Dantas <[email protected]> wrote:

> Hi Christopher, actually I'm using a cxf interceptor in a JAX-WS
> webservice.
>
> Do I really have to use a handler?
>
> thx
>
> 2012/2/24 Christopher Riley <[email protected]>
>
> > If you are using JAX-WS for you handler definition, you can access the
> > SOAPMessageContext and there are methods to get Body, Headers etc.
> >
> > The following is just a raw dump of the text values:
> >
> >    public boolean handleMessage(SOAPMessageContext smc) {
> >            System.out.println("In handleMessage");
> >            try{
> >            System.out.println("SOAP Body is" +
> > smc.getMessage().getSOAPBody().getTextContent());
> >            ....
> >
> > On Fri, Feb 24, 2012 at 11:05 AM, Márcio Dantas <[email protected]>
> > wrote:
> >
> > > Hi,
> > > I have an interceptor for soap messages and I want to log the entire
> > > incoming soap request as the original xml string.
> > >
> > > Is there a way to get it from the SoapMessage object? Even if the xml
> is
> > > not valid?
> > >
> > > Or do I have to read the body of the http request using
> > HttpServletRequest?
> > >
> > > Thanks
> > > Em 24/02/2012 10:28, "yebz" <[email protected]> escreveu:
> > >
> > > > Am trying to return a 201 http code with a Response.created() method,
> > but
> > > > the
> > > > response body is always empty. ...
> > > >
> > > > URI uri = new URI(uriInfo.getPath() + "/" + appID);
> > > > return Response.created(uri).entity(anyEntity).build();
> > > >
> > > > any help?, thanks.
> > > >
> > > > --
> > > > View this message in context:
> > > >
> > >
> >
> http://cxf.547215.n5.nabble.com/Response-created-is-not-returning-response-body-tp5512130p5512130.html
> > > > Sent from the cxf-user mailing list archive at Nabble.com.
> > > >
> > >
> >
> >
> >
> > --
> > Chris Riley, Partner
> > HKM Consulting LLC
> > (o)  774.553.5314
> > (m) 508.273.3102
> > (f)   774.553.5316
> >
>



-- 
Chris Riley, Partner
HKM Consulting LLC
(o)  774.553.5314
(m) 508.273.3102
(f)   774.553.5316

Reply via email to