perrohunter perrohunter - 1 year ago 137
Java Question

Getting Method Signature Name form a SOAPMessage on JAX-WS

I'm using JAX-WS to consume SOAP web services and I'm looking for an easy way to find the method that's being called via SOAP which generated my current SOAPMessage

I believe one way would be to check the SOAP Body first node (that's the name of the method called) but I don't have a clue on how to parse the SOAP Body from this SOAPMessage

As of now I can output the message to my console

thanks in advance

Answer Source

I'm not sure that I understand your question, however:

if you're processing the soap message as part of a handler, you can get the service and operation being invoked from the SOAPMessageContext:

    QName svcn = (QName) context.get(MessageContext.WSDL_SERVICE);
    QName opn = (QName) context.get(MessageContext.WSDL_OPERATION);

if you just want to deal with SOAPMessage in your client code, and want to know what element is contained in the SOAP Body:


The SOAPMessage exposes each part of the envilope as a DOM object, so you can do normal "DOM"ish things with it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download