0

I am trying to create a custom Valve for Apache Tomcat by extending the org.apache.catalina.valves.ValveBase class. It has the method public abstract void invoke(Request request,Response response). In my Tomcat, container I have Axis2 and it has a web service hosted. So my problem is to find a way to extract the SOAP message to that web service using this custom valve. So what is the way to get the SOAP message using the arguments org.apache.catalina.connector.Request and org.apache.connector.Response?

Christopher Schultz
  • 20,221
  • 9
  • 60
  • 77
andunslg
  • 781
  • 14
  • 38

2 Answers2

1

Since the custom valve is executed before Axis2 receives the request, you will not have access to the SOAP message parsed by Axis2. The only thing you can do is to parse the message yourself and then pass a copy of the original message to Axis2 (if your valve doesn't modify the message) or re-serialize the message (if your valve modifies the message).

Note that in contrast to what the other user said, there is nothing in the Axis2 documentation that will help you to do that. However, depending on your use case (which you didn't describe with sufficient detail), you may be able to use an Axis2 handler to achieve your goal. Of course, Axis2 handlers are described in the Axis2 documentation.

Andreas Veithen
  • 8,868
  • 3
  • 25
  • 28
0

You do this the same way you'd extract the SOAP message if you were writing a Servlet or a Filter: org.apache.catalina.connector.Request implements HttpServletRequest and org.apache.connector.Response implements HttpServletResponse, so use them like you usually do.

If you don't know how to extract a SOAP message from an HttpServletRequest, you'll have to read the Axis2 documentation.

Christopher Schultz
  • 20,221
  • 9
  • 60
  • 77