Note that there are some explanatory texts on larger screens.

plurals
  1. POwsContext.getMessageContext().get(MessageContext.SERVLET_REQUEST) returns null on Jetty?
    primarykey
    data
    text
    <p>I have an extension of <a href="https://stackoverflow.com/questions/1641594/geting-the-ip-address-of-a-client-for-a-webservice">this question</a>. I have that exact code running on a <strong>Jetty Server</strong>, and other <strong>SOAP</strong> web services work perfectly. However, on this line: </p> <pre><code>HttpServletRequest req = (HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST); System.out.println("Client IP = " + req.getRemoteAddr()); </code></pre> <p>The server crashes with a null pointer exception. <code>mc.get(MessageContext.SERVLET_REQUEST)</code> is returning null.</p> <p>By comparison, <code>mc.get(MessageContext.HTTP_REQUEST_METHOD</code>) returns "POST", so I assume that's working.</p> <p>What can I do to fix this?</p> <p>EDIT: I've tried <a href="https://stackoverflow.com/questions/133436/how-can-i-get-access-to-the-httpservletrequest-object-when-using-java-web-servic">this</a> fix to no avail.</p> <p>I've also tried using the @Context annotation instead and got the same issue.</p> <p>A System.out.println(mc) yields this:</p> <pre><code>{javax.xml.ws.wsdl.port={http://my.test.namespace.com/}testWSDLPort, javax.xml.ws.soap.http.soapaction.uri="", com.sun.xml.internal.ws.server.OneWayOperation=null, javax.xml.ws.http.request.pathinfo=null, ... ... </code></pre> <p>and so on, and the list of values does NOT include javax.xml.ws.servlet.request, which is the value of MessageContext.SERVLET_REQUEST. What do I need to do to make sure the MessageContext has this value?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload