How to get client Ip address from web service

Hello folks,
I am quite new to web service and developing a web service using netbeans6.0 IDE, where i have to know which client called/used the service, After googling i got code snippet like below
inject a WebServiceContext instance into your WebService class, and use it in each WebMethod to get the current request's MessageContext Map. Get the SERVLET_REQUEST item from that, cast as an HttpServletRequest. From that HttpServletRequest, you can invoke getRemoteAddr() to get the client's IP.
@WebService
public class MyService{
@Resource
WebServiceContext wsCtxt;
@WebMethod
public void myWebMethod(){
MessageContext msgCtxt = wsCtxt.getMessageContext();
HttpServletRequest req = (HttpServletRequest)msgCtxt.get(MessageContext.SERVLET_REQUEST);
String clientIP = req.getRemoteAddr();
}But it throws error in my PC like
Service invocation threw an exception with message : null; Refer to the server log for more details
Exceptions details : java.lang.reflect.InvocationTargetExceptionIs there any way that says client pc ip address using netbeans6.0 Or what went wrong in my code?
Largely Thanks in advance.
SRI.

I am afraid,
javax.servlet.ServletException: java.lang.reflect.InvocationTargetException
at com.sun.enterprise.webservice.monitoring.WebServiceTesterServlet.doPost(WebServiceTesterServlet.java:340)
at com.sun.enterprise.webservice.monitoring.WebServiceTesterServlet.invoke(WebServiceTesterServlet.java:121)
at com.sun.enterprise.webservice.JAXWSServlet.doPost(JAXWSServlet.java:148)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.webservice.monitoring.WebServiceTesterServlet.doPost(WebServiceTesterServlet.java:311) ... 35 more Caused by: javax.xml.ws.soap.SOAPFaultException: java.lang.NullPointerException at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:187) at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:117) at $Proxy102.processMessage999(Unknown Source) ... 40 more Caused by: java.lang.NullPointerException at org.shar.Handle.processMessage999(Handle.java:120) at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:361) ... 2 more

Similar Messages

  • Get client ip address from Web Service hosted on OAS 10.1.2

    Hi,
    Can anyone advice how to get the client IP from a web service (java) hosted on Oracle Application Server 10.1.2.
    The below code works if the web service is hosted on Tomcat.
    MessageContext msgCtxt = MessageContext.getCurrentMessageContext();
    String IP = (String)msgCtxt.getProperty("REMOTE_ADDR");
    This code is causes built errors on the OAS 10.1.2 since it needs Axis and many other Jars. I tried to insert the jars needed but unfortunately when i was able to compile it returned a java.lang.NullPointerException.
    Is there a way to get the IP address of the client that calls this web service ?
    Or is there a way to read the SOAP request maybe i can retrieve the client IP from it.
    Thanks for your support,
    regards

    http://forums.sun.com/thread.jspa?threadID=5371892&messageID=10636223
    Thank you!

  • How to get available fields list from web service

    hi,
    i'm using webservices to create ,update and deleting a alead.
    what i want is i want all the id of available fields in my account ?
    how acn i get those id's ?
    regards,
    praneeth

    hi,
    thank u for reply.
    i would like to create a servlet to insert alead to OCRM,
    but for that the user selects the fields he want to insert and provides corresponding values to those selected fields.
    so that i need to display all the fields available in my OCRM account.
    regards,
    Praneeth

  • How to get Client IP address in oracle apps. Are there any API's.

    hi,
    I have one query
    ->How to get Client IP address in oracle apps. Are there any API's.
    regards,
    krishna

    Hi,
    this is very usefull
    however are this data stored on the db or is only a temporary view?
    I would like to have to keep track of all client connected.
    Thanx a lot

  • How to get client IP in custom UCM Service

    how to get client IP in custom UCM Service ?

    have you tried
    binder.getLocal("REMOTE_ADDR");
    Let us know how you get on
    Tim

  • How to get up and run a Web Services/RESTful functionality?

    Hello there,
    The DBAs just completed the upgrade for the APEX 4.2 in our organization. I was asked to work with APEX and build some application. This morning I was asked by my boss to take a look at getting the Web Services/RESTful API Functionality up and running. I am new to this environment. When I check the RESTful Services I found out the are no RESTful Services. What do I do to get this running? as a Developer, I do not have access to any schema or web services. How do I go about making this work? can any one point me to some blog or site that will help me make this work?

    Hello,
    You can consume Web-Services from APEX, but you can't produce. So first ask your boss which web-service you want to implement.
    There are 2 types of web services in general, SOAP based and RESTful. APEX provides simplified API's to invoke both types web-service.
    Identify web-service you want to TEST
    Create ACL for APEX_XXXX schema to access web-service
    Create ACL for Proxy Server as-well, if required
    If web-service is SSL-enabled then configure wallet. See 17.7 Implementing Web Services
    Use APEX API's to invoke Web-Services. See APEX_WEB_SERVICE
    You can process XML response from Web-Service using Using XQuery with Oracle XML DB
    If Web-Service returns JSON data either you can use PL/JSON | Free software downloads at SourceForge.net to process response, or you can process response at client side using jQuery
    Regards,
    Hari

  • GET, Modify, POST XML from Web Service Requests (Webtests)

    I'm using load testing to exercise an API, so I'm creating many small webtests which mimic typical user operations.  One of my operations will be a GET of transaction data and a PUT of that same data, slightly modified.
    I'm able to capture the response from the GET in an extraction rule and resubmit to the API, the question is how to manipulate the XML so that there's a small typical edit.   What's the best way to do this?  
    I understand the nature of the web test plug-ins, as the "cartilage" around the bones of the webservice requests.  I would much rather angle towards a plugin than convert to a coded test and modify that way.  I like the normal non-coded
    test interface but I dont know that the webtest plugin nor webtest request gives me the granularity the coded webtest does.  Unfortunately, I dont like the fact I can't easily debug through the coded webtest.
    This seems like a straightforward operation. Do I understand all my options? How would you do this?

    On further review, I might have figured this out.  I misunderstood something I read online.  The web test request plug-ins can be associated with an individual service call and aren't automatically applied to all service calls in a web performance
    test collection.
    .. I can do something like this to access my captured context information and manipulate the XML via XDocument/XElement.   - This demonstrates how to get my captured {{ResponseDocument}} from the extraction rule.
        public class XmlModification : WebTestRequestPlugin
            public override void PreRequest(object sender, PreRequestEventArgs e)
                MessageBox.Show(e.WebTest.Context["ResponseDocument"].ToString());
    Difficile est tenere quae acceperis nisi exerceas

  • How to get the IP address from baking bean?

    Hi, Im new to the JSF technology and want to find out how can i get client related info in the baking bean, like IP Address, USER_AGENT and that kind of thinks, any guide you could give me would be great, thanks in advance.
    JM

    You can use javax.faces.context.ExternalContext object to get various raw request information
    including HTTP request headers. Also, you could call request.getRemoteAddr() method indirectly
    from the object.

  • How to find temp-Dir on client and how to fiend client IP adress from Web-Dynpro

    CL_GUI_FRONTEND_SERVICE cannot be used and there are some hints to use ACF-Excecute. Hope this is not the only choice.
    Thanks Volker

    Hi Volker,
    Regarding question 2 , how to find client IP from WDA.
    In the window of the application use the information that comes from the object wdr_task=>client_window, this contains the values for the IP of the remote address.
    *Reward points if useful
    Cheers,
    Nihar

  • How to view multiple output parameters from web services

    I have used the Labview tool to create a .NET assembly from a WSDL file.
    In the WSDL file the service has been defined to return 2 output parameters.
    In Labview, when I invoke the method for this service the first output parameter ends up as the return value of the method.  I can create an indicator for this and it gets updated properly when I run the VIS to use the web service..  The indicator is an integer value but recognizes the type defined within the WSDL file. 
    The second output parameter shows up as an output value.  When I right click on it and create an indicator for it I get a .NET icon on the front panel rather than an integer value. 
    How can I view the value for this second output parameter after running the web service?
    Is there a difference in how multiple output parameters handled in newer versions of Labview (I am using verison 7.1)?

    scrooge wrote:
    You can try this link .
    the link is dead... or i dont have access..

  • How to return List or Array from Web Service without using ADF?

    All,
    I would like to know how to do this before I use ADF. Sounds like a simple thing to do - common even - but I haven't found a solution in existing postings. My attempts have failed though I'm not sure exactly why.
    I have created a declarative WS that takes a single parameter and tries to return a List<Employees> resultset. My Sample Java Client works just fine. When I change the result type from List to String[], for example, it also works fine.
    What am I doing wrong??
    Thanks
    package wizard;
    (imports removed for readability)
    @WebService(name = "MyWebService1", serviceName = "MyWebService1", portName = "MyWebService1SoapHttpPort")
    @Deployment(restSupport = true)
    public class HelloWorld {
    List<Employees> employees = null;
    public HelloWorld() {
    public List<Employees> sayHello (String s) {
    try {
    final Context context = getInitialContext();
    ATOABPFacade aTOABPFacade = (ATOABPFacade)context.lookup("ATOABPFacade");
    employees = aTOABPFacade.queryEmployeesFindByName(s);
    return employees;
    } catch (Exception ex) {
    ex.printStackTrace();
    return employees;
    private static Context getInitialContext() throws NamingException {
    return new InitialContext();
    Trace:
    Ready message received from Oc4jNotifier.
    Embedded OC4J Server startup time: 24063 ms.
    Target URL -- http://localhost:8988/JPA-Wizard-context-root/mywebservice1soaphttpport
    Feb 18, 2008 7:42:49 PM com.evermind.server.ServerBase log
    WARNING: JPA-Wizard-webapp: Error preloading servlet
    javax.servlet.ServletException: java.lang.NullPointerException
         at oracle.j2ee.ws.server.provider.ProviderServlet.init(ProviderServlet.java:186)
         at javax.servlet.GenericServlet.init(GenericServlet.java:241)
         at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2674)
         at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5162)
         at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5085)
         at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:5275)
         at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1357)
         at com.evermind.server.http.HttpApplication.init(HttpApplication.java:873)
         at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:699)

    Gi,
    not sure what you are doing there, but you can build the J2EE WebService from your working POJO, and create a Web Service proxy class from the WSDL description (of the deployed or local WSDL file). Then, using the proxy class, you can access the output of the WebService.
    Frank

  • How to delete the Webservice entry from Web service navigator?

    Hi,
    My current issue is that, developers have created many webserivces and these web services are visible in web service navigator that i access by following link
    http://<host>:<port>/wsnavigator
    But now we have to remove the unwanted webservices i.e. i want that unwanted webservices should not be visible to anyone when we access WSNAVIGATOR.
    How should i go about it?
    Am i required to undeploy the web services that is deployed from SDM GUI?
    Please pour in your valuable inputs.
    Any help would be highly appreciated.
    Regards,
    Ameya

    I had to revove the entry from VA. Removing this entry also removes the web service from ws navigator.

  • How to get nested JSON structure from OData service result

    Hi all,
    This is what I have done :
    I have developed OData service where I am following below steps :
    1. Created Stored procedure for the logic
    2. Created scripted calculation view and call stored procedure from the view.
    3. Created OData Service where I am calling calculation view with multiple parameters.
    Every thing is working fine and I am getting proper JSON Result which all the attributes that I am returning from the view in flatten structure.
    Additional requirement:
    On top of this I have additional requirement where I want to get various aggregation or counts.
    For example : from view I am getting all the customers result as result set and I also want some summary level information along with that such as :
    1. Total Number of Records
    2. Total VIP Customers
    3. Total Individual Customers
    4. Total Business Customers
    Above counts can not be each records level information so I need this details in my OData Service result as separate summary section like nested JSON structure.
    For example :
    d: {
    results: [
    __metadata: {
    uri: "http://servername:8000/testmulti.xsodata/calmultiview1('123456')",
    type: "Cust.Multiview1.calmultiview1Type"
    aggregation: {
    totalrecords: "",
    totalVIPCustomers: "",
    totalIndividualCustomers:"",
    totalbusinesscutomers:""
    ID: "123456",
    ENT_ID: 1234,
    FIRST_NM: "ABC",
    LAST_NM: "XYZ",
    CITY: "DELHI",
    In above example like _metadata , I am asking how to get aggregation section also in the JSON result?
    aggregation: {
    totalrecords: "",
    totalVIPCustomers: "",
    totalIndividualCustomers:"",
    totalbusinesscutomers:""
    Please suggest best possible way to implement this kind of requirements.
    Thanks
    - Dharmesh

    Don't expect that OData can help you for this. Still you can try the following.
    Create a XSJS service where you can execute your procedure manually and get the aggregation as well. From the XSJS , you can loop over the result sets and build your corresponding JSON format. But, you can not implement the features of OData, as the return would be "just" a JSON.
    in any way you can establish an association with your main entity and aggregation entity(I am Sure, the worst case), you can get both in the same payload.
    Sreehari

  • How to display complex type result from web service?

    Hi,
    I am trying to invoke a web service with the following code
    but I can't display the result. Can someone help me how to display
    the result?
    <cfset randomID = CreateUUID()>
    <cfset today = Now()>
    <cfset args = StructNew()>
    <cfset args.login = "wanna">
    <cfset args.key = "#DateFormat(today, 'YYYY-MM-DD')#
    #TimeFormat(today, 'hh:mm:ss')#:#Left(randomID,12)#">
    <cfset args.hash= LCase(Hash("123456" & args.key,
    "SHA"))>
    <CFINVOKE webservice="
    http://sandbox.voxbone.com/ws/services/VoxService?wsdl"
    METHOD="getCountriesList"
    AuthenticationToken="#args#"
    RETURNVARIABLE="Result">
    <cfoutput>#Result#</cfoutput>

    I have tried using that that it display the following. I was
    expecting a list of coutries but it display the following text
    only. Can you guide me in displaying list of countries?
    "object of
    voxbone.webservices.services.containers.ArrayOfCountry"
    Methods hashCode (returns int)
    equals (returns boolean)
    getCountry (returns
    [Lvoxbone.webservices.services.containers.Country;)
    getCountry (returns
    voxbone.webservices.services.containers.Country)
    getSerializer (returns interface
    org.apache.axis.encoding.Serializer)
    getDeserializer (returns interface
    org.apache.axis.encoding.Deserializer)
    getTypeDesc (returns org.apache.axis.description.TypeDesc)
    setCountry (returns void)
    setCountry (returns void)
    getClass (returns java.lang.Class)
    wait (returns void)
    wait (returns void)
    wait (returns void)
    notify (returns void)
    notifyAll (returns void)
    toString (returns java.lang.String)

  • How to show all data returned from web service in a dashboard

    Hi I need  create a dashboard with conection with a web service  and  whitout  establish a range in excel,  so be displayed on the dashboard n rows returned by the web service.
    how can I do this?

    Hi Ezequiel,
    I agree with Alan.
    You might find it useful to read the Xcelsius 2008 Best Practices whitepaper: [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a084a11c-6564-2b10-79ac-cc1eb3f017ac]
    Regards,
    Matt

Maybe you are looking for

  • Cannot delete file from trash - tried EVERYTHING

    Wow. I have an incredibly stubborn file (named :VBL followed by a bunch of non English symbols) in the trash that I cannot get rid of. I have tried all the usual methods of deleting, secure deleting, using Cocktail, and literally _EVERY SINGLE METHOD

  • Cannot deploy EAR.  There are already active sessions

    Hi WebDyn Pro's, I'm running NW SP14 Sporadically, I cannot deploy my WebDynpro app to the NW server.  In NWDS, I indicate to Deploy and run.  I get an error in the console indicating: <b>"Cannot log in.  There are already active sessions.  Session i

  • How do I stop firefox from offering to remember my passwords?

    I do not want ANY program to offer to remember ANY of my passwords. Firefox REPEATEDLY asks to remember this information any time I log in to work or personal sites. I am quite capable of remembering my own passwords, and the pop-up key icon is reall

  • Solved! Fix / Repair Nova Button / One Key Recovery after replacing SSD - Walkthru! Yoga 2 Pro

    I created this full walkthru for people who upgrade / or replace their hard drive / SSD drive on the Lenovo Yoga 2 Pro or other Lenovo products that has the Nova button - One Key recovery solution. I did this on my Yoga 2 Pro. So it should work perfe

  • Gateway crashed after debug command - how to recover

    Hi - I was troubleshooting an issue out of hours and the voice gateway I was working on crashed after using a debug command Whats the best way to recover the gateway? I'm unable to ping it now - do I need someone to reboot it? Once it comes back up w