Reputation: 1293
I am implementing many JAX-WS web services with a common Handler class to validate the correct structure of incoming SOAP messages.
Is there some way to obtain the URL to which is directed the current message so i could get the schema from this url automatically and get the message validated?
Upvotes: 6
Views: 9525
Reputation: 11
Neither JAXWSProperties.HTTP_REQUEST_URL nor BindingProvider.ENDPOINT_ADDRESS_PROPERTY worked for me.
This is how i got url in an outbound message on WildFly 10 (Java 7):
public boolean handleMessage(SOAPMessageContext context) {
String url = (String) context.get(MessageContext.PATH_INFO);
...
}
Upvotes: 0
Reputation: 1640
In my application smc.get(JAXWSProperties.HTTP_REQUEST_URL)
returns null.
I've fount another way, I hope this helps:
public class HeaderHandler implements SOAPHandler<SOAPMessageContext> {
public boolean handleMessage(SOAPMessageContext smc) {
String endpointAddress = (String) smc.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
log.debug("endpointAddress " +endpointAddress);
}
}
Upvotes: 10
Reputation: 1293
Found!!!
public class HeaderHandler implements SOAPHandler<SOAPMessageContext> {
public boolean handleMessage(SOAPMessageContext smc) {
System.out.println("URL of Endpoint" +smc.get(JAXWSProperties.HTTP_REQUEST_URL));
}
}
Upvotes: 1