Hi Gunter,
Yeah this could totally be achieved and this is what I did.
The whole request and response can be modified and relayed and best part is no one would notice a difference that a proxy is sitting in between and doing these modifications! :D
Being a java developer , I feel more confident doing it in java and it gives more control to you.
So I provided a custom implementation of this method in my own class and This is how the function definition looks like for modifying/ playing with the request
public Outcome handleRequest(Exchange exchange) throws SOAPException, JAXBException, IOException {
// exchange object has all the details about request and response. you could easily get the request body here from exchange like this
exchange.getRequest().getBodyAsStreamDecoded()
// unmarshall it to a soap document and add your client and password and update the request in here
// setting the request
exchange.getRequest().setBodyContent(outputStream.toByteArray());
}
for sending the request, you will just need to configure the client address in the wsdl document or provide your own.
additional // If you want to modify the response you can do that
public Outcome handleResponse(
Exchange exchange)
throws IOException,
SOAPException,
JAXBException {
exchange.getResponse().getBodyAsStreamDecoded()
// basically do the same thing as you did in request modification
}
Hope this helps.
Best,
Neshant