Get the client (caller) IP in a RESTFul web service resource

Hello,
How i can get the client (caller) IP inside a RESTFul web service resource?
Something like for SOAP Web Services
          MessageContext msgCtxt = wsCtxt.getMessageContext();
          HttpServletRequest req = (HttpServletRequest) msgCtxt.get(MessageContext.SERVLET_REQUEST);
          String clientIP = req.getRemoteAddr();
Thank You

1) Are you trying to create a RESTful web service in LabVIEW?
or
2) Are you wondering about creating a thin client to consume the web service?
A1) Web Services in LabVIEW
A2) LabVIEW WebUI Builder  You can create a VI to act as a client for your web services, but not a thin client (i.e. running in the browser)
Chris
Certified LabVIEW Architect
Certified TestStand Architect

Similar Messages

  • How to call Jive Search methods using REST Web Services from ADF

    Hi
    Can someone provide me an example to call JIVE Search using REST web services from Webcenter ADF.
    As we have the similar facility to call UCM Search from WebServices DataControl.
    Do we have anything similar like this for JIVE Search?
    JIVE 5.1 is deprecating SOAP style web services and so I am planning to use REST.
    Any suggestions on this is much appreciated.
    Many Thanks
    Khad

    so what exactly is the problem here?
    what is not working?

  • Need to auto-generate SDK for REST web service.

    My company has developed a REST API for some web services, and we'd like to provide users with a Java SDK for consuming those services.
    Our services are described by an XSD schema. On the backend, we are using JAXB to create Java classes corresponding to the schema. We create the request objects based on the parameters in the REST url, and JAXB converts our response objects from Java to XML.
    We'd like to provide our users with similar Java classes on the client side. They should be able to create the object corresponding to the request, fill in various parameters, and submit it to our web service. The SDK should automatically convert the object into a REST URL, hit the URL with a Get, read the XML response, and convert that response into Java objects.
    It seems like we should be able to auto-generate such an SDK based on our schema.
    It seems like there are several tools for doing this for SOAP web services. For example, Apache Axis has Java2WSDL and WSDL2Java.
    Can anyone recommend tools for creating client-side libraries for consuming RESTful web services? Does anyone have advice on products to avoid?

    Replying to my own post here. The WADL2Java project on java.dev seems to be more like what I need. The only user-experience I've seen on the 'net is in this forum post:
    http://forum.java.sun.com/thread.jspa?threadID=5239123&tstart=0
    Anyone else used it?

  • Problem in tutorial "Integrating RESTFul Web Services"

    JDeveloper/ADF downloaded March 2012, JDeveloper Studio Edition Version 11.1.2.1.0 and full ADF download bundle.
    I have run through the JDeveloper/ADF tutorial titled, "Integrating RESTFul Web Services". When I get to Step 3, "Test the Web Service" the application fails to deploy. The essential error is, "Caused by: java.lang.ClassNotFoundException: javax.ws.rs.ext.RuntimeDelegate". I done it from scratch 3 times to make sure I was not missing any steps.
    An clues would be appreciated.
    Thank you,
    Russ Ryan

    Thanks for the suggestions. I tried both of them:
    - including JAR files under lib directly
    - including the JAX-RS libraries from the Libraries selection.
    Still getting the error about not finding javax.ws.rs.ext.RuntimeDelegate.
    I downloaded the finished project from the tutorial (http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_53/labs/restsolution.zip), did a rebuild and tried the "Test Web Service". I got the same error. I'm wondering if it is a problem with my environment.
    Thanks,
    Russ Ryan

  • Composite Application with RESTful Web Services

    Hello!
    Is it possible to build Composite Application with RESTful Web Services only. I use Glassfishe 2.1 and OpenESB 2.1.
    Can you point me on some tutorials on the net to read about using RESTful Web Services in BPEL?

    Hi Gabriel,
    Let me try to answer some of your questions:
    1) The "Requires Secure Access" attribute of a resource handler controls whether this handler must be accessed/consumed only over SSL (HTTPS). Oracle Database Cloud Schema Service is only offered over SSL, so this attribute does not have any effect on RESTful services deployed in this environment (because secure access is always required and there is no other way). That said, if you want to access such web service from your own APEX instance, your instance must have Oracle Wallet configured with appropriate SSL certificate.
    2) The URI parameters are not required. If your web service returns data for many entities (for example, list of employees in employees/), you may not need a parameter. If your web service returns data for one specific entity (for example, details of one employee in employees/{id}), you may want to identify that entity with a URI parameter.
    3) You can have many URI parameters, for example: customers/{id}/orders/{order_id}.
    4) Yes, these are the same HTTP methods/verbs you would use from PHP.
    5) If you are trying this POST example from your own APEX instance (not Oracle Database Cloud Schema Service) and you are trying to access a web service over SSL, then it is likely that the Oracle Wallet used by your instance does not include the required SSL certificate(s), or the Oracle Wallet is not configured at all.
    6) I recommend to check RESTful Web Services for the Oracle Database Cloud white paper and Oracle REST Data Services Developers Guide. Oracle REST Data Services is the technology that enables RESTful services in the Oracle Database Cloud Schema Service.
    You can certainly create your own web services in the Oracle Database Cloud Schema Service and consume them from the same environment.
    Vlad

  • How  to Hold the client ip from the client calls made to the ejbweb servic?

    Hi
    I am working on Ejb3 web services.I want to hold the client ip from the client calls made to the web service.I deployed this service in jboss AS 4.2.1
    In the service implementation i started using
    @Resource
    SessionContext sessionCtx;
    My idea is to get the MessageContext from this SessionContext and finally to get the HttpServletRequest.
    I got the sessionCtx(BaseSessionContext) object.When i am trying to access the MessageContect using the below syntax
    System.out.println(sessionCtx.getMessageContext());
    I got ---ERROR [SOAPFaultHelperJAXWS] SOAP request exception
    javax.ejb.EJBException: java.lang.IllegalStateException: No message context found
    Please provide me with correct solution to this problem.Please also suggest if there is any alternate approach to get the client ip in the service implementation.
    Thanks
    Adinarayana

    Hi,
    Assuming that you are using Form 6i or greater, one way to do is to embedd a java bean in the form, this bean would get you the ip address and in the form you can get_custom_property( ) to get the value from the bean to the oracle form.
    There is one demo example in OTN site to get the ClientIP address, check out if that helps you.
    Regards,
    Dinesh

  • How to get the client date and time ?

    Dear Sirs...
    Using jdeveloper 10.1.2.0
    How can i get the client date and time using the HttpServletRequest ?
    thanks for any help in advance
    best regards

    If your code is running on the client pc you can just create a new instance of the java.util.Date class. That class automatically defaults to the current time of the client machine. Otherwise if you're running the code on the server, you could insert/post the client date/time by adding its string representation as a parameter to the HTTP request object.
    Ronald

  • How to get the client identity from the certificate at server side

    hi, this is ravi kiran,
    I am working on a project which requires, receiving a signed file from the client side and verify whether the file is signed by a valid certificate that is there in the servers keystore.
    How can i get the client certificate at server side and check with the certificates already present in the servers keystore.
    i have no idea how to do this
    can any one help me
    thanx in advance

    Hi Ravi, did you get any answer to your question ?
    I'm also after a similar problem, please share your solution, if you have any.

  • How to get the CLIENT OS USER NAME using Apex

    Dear All,
    I know there are many other posts (some of them are very old) discuss about this issue. But unfortunately most of the posts endup with NO PROPER ANSWER. But still I believe that tehre has to be some way to do this. So this is my requirement.
    I am using custom authentication module and I want to get the CLIENT MACHINE OS USER NAME for that. But I do not want to do any authentication against the client user domain.
    How can I get this?
    * There are some other way to get this using VB Scripts. But thats not a real solution for this due to followings
    01. User has to manually allow to run VB scripts. So if user dissable that then we canot get the required info
    02. Its working only with specific browsers(Mainly in IE and also we can get that thing work after installing plugins to Firefox.). So this is also depends with the bvrowser and plugings.
    What I want to do is to get this info using a common way which is not depends with the browser or any thirdparty plugins.
    Thanks,
    Alex

    Its good that you did some searching in the forums before you posted the question.
    Most modern browsers would consider what you require as a security/privacy issue and prevents such information from being transmitted available(easily). IE might let you pull out this using a VB script or activex control. Browser specific addons/extension could work but they need some kind of installation to start with. Java could be a way to do it with all browsers, but the end user still has to grant access before it can do any such thing.
    Lets say you were able to pull out such information from an end user, what would be next, get his mail id from outlook ? , access his browsing history, steal credit card information or read cookies?
    Add to that , what if the end user accesses it using any other OS(linux,macintosh or even a smartphone) ? what about windows vista and windows 7 OS's , are you going to write code to handle all those cases too ?
    Here's a blog posting which explains using NTLM authentication with Apex(it still needs configuration from the end user)
    What I want to do is to get this info using a common way which is not depends with the browser or any thirdparty plugins.I guess if this is the question, then the answer would have to be no. I don't think you will be able to find a method that passes this information from the client side without any modification/configuration at their side

  • Get the client IP address

    Hello everybody, I'm a student new with java, I'm developing a little server application - running standalone, and I'm trying to get the client Ip address, have a look on my code snippet:
    InetAddress fromcli;
    while(true){
    welcomeSKT.accept()
    fromcli = welcomeSKT.getInetAddress();
    System.out.println("The client Ip Address is: " + fromcli.getHostAddress() + '\n');
    The sysout println returns the 0.0.0.0 that is the server address, mapped to more than one interface eg:(loopback and eth0) - But if with the getInetAddress() method I get the server address where is the difference with the getLocalHost()? - By the way, anyone has a suggestion to print out the client remote address.
    Thank you in advance....
    Jeppojeps
    Edited by: jeppojeps on Mar 24, 2008 3:36 AM

    Oh, sorry of course welcomeSKT is a ServerSocket, actually the snippet that I put is a part of the code, here below I put the complete program, in order to clarify my question, however I would like to know if it's possible to understand from the server side the client IP address, and if yes how...
    Thank you in advance...
    * THIS simple TCP server receives some numbers in input by the client and give back the sum - actually the exceptions are managed in a uncomplete way....but this is my first java program...be patient with me...
    * @jeppojeps
    * @0.1
    import java.io.*;
    import java.net.*;
    public class ServerTCP
    // instance variables - replace the example below with your own
    public static void main(String[] args) throws Exception
    String clientSentence;
    String capitalized;
    InetAddress fromcli;
    String clientIp;
    String portIp;
    int z=0;
    int port=0;
    if (args.length == 0 ){
    System.out.println("Usage: ServerTCP lport" + '\n');
    System.exit(-1);
    else
    port = Integer.parseInt(args[0]);
    if(port <= 1024) {
    System.out.println("Remember dude, only root can use a portnumber < 1024" + '\n');
    else{
    ServerSocket welcomeSKT = new ServerSocket(port);
    System.out.println("Server instance started:" + '\n');
    while(true){
    Socket connectionSocket = welcomeSKT.accept();
    BufferedReader InfromClient = new BufferedReader (new
    InputStreamReader(connectionSocket.getInputStream()));
    DataOutputStream outToClient =
    new DataOutputStream(connectionSocket.getOutputStream());
    outToClient.writeBytes("Hello give me some numbers and I'll give you the sum" + '\n');
    fromcli = welcomeSKT.getInetAddress();
    System.out.println("The client Ip Address is: " + fromcli.getHostAddress() + '\n');
    clientSentence = InfromClient.readLine();
    for(int i = 0 ; i < clientSentence.length() ; i++) {
    try {
    Character c = new Character(clientSentence.charAt(i));
    capitalized = c.toString();
    int x = Integer.parseInt(capitalized);
    System.out.println("Number digited from the client: " + x + '\n');
    z+=x;
    catch(NumberFormatException nfe) {
    System.out.println("Text: " + clientSentence.charAt(i));
    capitalized = Integer.toString(z);
    outToClient.writeBytes("The sum of the given number is: " + capitalized + '\n');
    welcomeSKT.close();
    }

  • FileStatsAgent Metadata.framework [Error]: couldn't get the client port

    11/7/13 6:13:42.507 PM FileStatsAgent[75343]: Metadata.framework [Error]: couldn't get the client port
    11/7/13 6:13:55.026 PM FileStatsAgent[75347]: Metadata.framework [Error]: couldn't get the client port
    11/7/13 6:14:09.915 PM FileStatsAgent[75348]: Metadata.framework [Error]: couldn't get the client port
    11/7/13 6:14:22.726 PM FileStatsAgent[75349]: Metadata.framework [Error]: couldn't get the client port
    11/7/13 6:14:37.792 PM FileStatsAgent[75350]: Metadata.framework [Error]: couldn't get the client port
    11/7/13 6:14:52.650 PM FileStatsAgent[75352]: Metadata.framework [Error]: couldn't get the client port
    11/7/13 6:15:06.098 PM FileStatsAgent[75353]: Metadata.framework [Error]: couldn't get the client port
    This console message is repeating, non-stop, every 15 seconds.
    Anyone have any suggestions to make it stop?

    It seems the problem was a broken database Spotlight.
    That's what helped me:
    sudo rm -rf /.Spotlight-V100
    cd /System/Library/LaunchDaemons
    sudo launchctl load -w com.apple.metadata.mds.plist
    That will start the re-indexing your hard drive to Spotlight.
    From https://discussions.apple.com/thread/2760349

  • Want to get the Client Machine name from Oracle Forms

    Hi,
    I want to get the Client machine name from the Oracle Forms.
    I have attached web_util.pll.
    I use user_name := webutil_clientinfo.get_host_name;
    but i am getting following error - WebUtil Error:WUC-015: Your form must contain the following Bean for this function to be available: oracle.forms.webutil.clientinfo.GetClientInfo.
    Can any one help me in this!
    Thanks & Regards,
    Avinash Bhamare.
    Pune.

    Hi,
    I have written the code on when-button-pressed trigger of a push button -
    DECLARE
         user_name VARCHAR2(50);
    BEGIN
    user_name := client_win_api_environment.get_computer_name;
    message('user_name is :'||user_name);
    message('user_name is :'||user_name);
    END;
    And on clicking on this button i am getting error -
    frm-40734:Internal Error:PL/SQL error occurred
    Can any one help in this asap please!
    Thanks & Regards,
    Avinash.

  • Can a pl sql cartridge get the client certificate through ssl in OAS

    I am In a web publishing system project, I use SSL and client certificate to verify the user, the environment is OAS4.0.6 and Oracle 8i, and I use PL SQL cartridge to proceed the http request , Now the problem is how can I get the client certificate infomation in my pl sql scripts, I do not know where should i post this problem, So I post it here, If you have any experience in using SSL of OAS, pls help me!
    tsailiang
    [email protected]
    thank you very much!

    Sorry wrong forum.....
    This forum is for the Internet File Server (ifs) not the oracle application server (oas), sometimes known as iAS or Oracle9i Applicaiton Server.
    null

  • GSS-API How to get the client-to-service ticket

    In Kerberos when requesting services, the client sends the following two messages to the TGS: A composed message of the Ticket-Granting Ticket and the ID of the requested serviceand authenticator (which is composed of the client ID and the timestamp), all encrypted using the client/TGS session key.
    Then upon receiving these messages the TGS sends the followings to the client:
    A: Client-to-server ticket (which includes the client ID, client network address, validity period and Client/server session key) encrypted using the service's secret key.
    B: Client/server session key encrypted with the client/TGS session key.
    Now I'm wondering how to obtain A and B throught the kerberos login in GSS-API . I have the following code that I use to request a kerberized service but it returns only a KerberosTicket in PrivateCredentialsSet for the Subject. A sessionKey can also be obtained form this KerberosTicket ! Which session key is this ? the session key B described above? and Where to get the Client-to-server ticket (A) described above ?
    Thanks for any help !
    Alex
    lc = new LoginContext("login-client", new TextCallbackHandler());
    lc.login();
    mysubject = lc.getSubject();
    java.util.Set principals = lc.getSubject().getPrincipals();
    java.util.Iterator iterador = principals.iterator();
    if (iterador.hasNext()){
    KerberosPrincipal principal = (KerberosPrincipal) iterador.next();
    clientName =principal.getName();
    PrivilegedAction generateServiceTicket = new ClientAction(clientName,"[email protected]");
    Subject.doAs(mysubject, generateServiceTicket);
    Set prvCredentials = lc.getSubject().getPrivateCredentials();
    for (Iterator i = prvCredentials.iterator(); i.hasNext(); j++) {
    KerberosTicket ticket = (KerberosTicket) i.next();
    prvKrbCrds = (KerberosTicket[]) mysubject.getPrivateCredentials().toArray(new KerberosTicket[0]);
    public Object run() {
    try{
    GSSManager manager = GSSManager.getInstance();
    Oid krb5Mechanism = new Oid("1.2.840.113554.1.2.2");
    Oid krb5PrincipalNameType = new Oid("1.2.840.113554.1.2.2.1");
    GSSName userName = manager.createName(pn,GSSName.NT_USER_NAME);
    GSSCredential cred = manager.createCredential(usr,
    GSSCredential.DEFAULT_LIFETIME,
    krb5Mechanism,
    GSSCredential.INITIATE_ONLY);
    GSSName peerName = manager.createName(servicename,
    GSSName.NT_HOSTBASED_SERVICE, krb5Mechanism);
    GSSContext setContext = manager.createContext(peerName, krb5Mechanism, cred,
    GSSContext.DEFAULT_LIFETIME);
    setContext.requestInteg(false);
    setContext.requestConf(false);
    byte[] inputBuf = new byte[0];
    byte[] tkt = setContext.initSecContext(inputBuf, 0, 0);
    }catch(GSSException gsse){
    gsse.printStackTrace();
    }

    In Kerberos when requesting services, the client sends the following two messages to the TGS: A composed message of the Ticket-Granting Ticket and the ID of the requested serviceand authenticator (which is composed of the client ID and the timestamp), all encrypted using the client/TGS session key.
    Then upon receiving these messages the TGS sends the followings to the client:
    A: Client-to-server ticket (which includes the client ID, client network address, validity period and Client/server session key) encrypted using the service's secret key.
    B: Client/server session key encrypted with the client/TGS session key.
    Now I'm wondering how to obtain A and B throught the kerberos login in GSS-API . I have the following code that I use to request a kerberized service but it returns only a KerberosTicket in PrivateCredentialsSet for the Subject. A sessionKey can also be obtained form this KerberosTicket ! Which session key is this ? the session key B described above? and Where to get the Client-to-server ticket (A) described above ?
    Thanks for any help !
    Alex
    lc = new LoginContext("login-client", new TextCallbackHandler());
    lc.login();
    mysubject = lc.getSubject();
    java.util.Set principals = lc.getSubject().getPrincipals();
    java.util.Iterator iterador = principals.iterator();
    if (iterador.hasNext()){
    KerberosPrincipal principal = (KerberosPrincipal) iterador.next();
    clientName =principal.getName();
    PrivilegedAction generateServiceTicket = new ClientAction(clientName,"[email protected]");
    Subject.doAs(mysubject, generateServiceTicket);
    Set prvCredentials = lc.getSubject().getPrivateCredentials();
    for (Iterator i = prvCredentials.iterator(); i.hasNext(); j++) {
    KerberosTicket ticket = (KerberosTicket) i.next();
    prvKrbCrds = (KerberosTicket[]) mysubject.getPrivateCredentials().toArray(new KerberosTicket[0]);
    public Object run() {
    try{
    GSSManager manager = GSSManager.getInstance();
    Oid krb5Mechanism = new Oid("1.2.840.113554.1.2.2");
    Oid krb5PrincipalNameType = new Oid("1.2.840.113554.1.2.2.1");
    GSSName userName = manager.createName(pn,GSSName.NT_USER_NAME);
    GSSCredential cred = manager.createCredential(usr,
    GSSCredential.DEFAULT_LIFETIME,
    krb5Mechanism,
    GSSCredential.INITIATE_ONLY);
    GSSName peerName = manager.createName(servicename,
    GSSName.NT_HOSTBASED_SERVICE, krb5Mechanism);
    GSSContext setContext = manager.createContext(peerName, krb5Mechanism, cred,
    GSSContext.DEFAULT_LIFETIME);
    setContext.requestInteg(false);
    setContext.requestConf(false);
    byte[] inputBuf = new byte[0];
    byte[] tkt = setContext.initSecContext(inputBuf, 0, 0);
    }catch(GSSException gsse){
    gsse.printStackTrace();
    }

  • How can I get the client IP address correctly?

    Hi,
    I am having a problem with getting the client ip address correctly using jsp. I am currently using the method request.getRemoteAddr() (JSP)to get the remote client IP. This method works fine with intranet addresses.
    However, when I am using a dial-up connection through a ISP (internet service provider), it could not detect the actual IP that is assigned to my client PC, but instead got another IP address.
    Could anyone advise me on that? And could anyone advise me on how to obtain the correct client ip address correctly using any of the java technologies?
    Thanks,
    Damien

    >
    I don't believe so. You can't establish aconnection
    over the internet using a private IP. As far as I
    know most, if not all routers, block them so itwon't
    even move over the backbone.Well with port-mapping it is definately possible to
    allow an external ip to "connect" to an internal ip, i
    have done this very thing myself...Not the same.
    You are addressing the external server with a public IP address. That is then translated into the internal connection.
    That is not the same as using a private IP on the internet.
    As I said, the backbone will not let a private IP through.
    >
    >
    Yes, but my point is that at any given time, in the
    world, many boxes might have one address. Even ifit
    is a private IP is it still that IP for aparticular
    box. So if you use java to get its IP that is theIP
    that it gets. And that IP is useless for anything
    unless that IP is meaningful for the othercomputer.
    But all ips must be unique in a designated "internet"
    be it an "intranet" or whatever, there cannot be a
    situation where two identical ips in the same
    "internet", such that an ip that is achieved from a
    page-hit is valid and meangingful in order to send the
    data it is requesting back to it, or find out more
    about that computer, or log and report it if it is
    doing something illegal; i don't think its that
    meangingless is it?Yes it is. You can't use an IP to uniquely identify a box, and that is the sole criteria, when there might be two boxes with the same IP.
    When you use java on a client box to get the IP of the box, it doesn't necessarily return an IP that it meaningful to the anyone outside the lan on which the box lives.
    Because of this internet systems must do one of the following:
    -Do not use the IP as an identifier.
    -Require that the client has a public IP. This is often static. At least some security systems use this to validate users.

Maybe you are looking for

  • Sharing an iTunes library on a single dual-boot machine

    Hello, I was wondering if someone would be able to help me. I run both Snow Leopard and Windows 7 on the same machine. I also have my iTunes account that I would be able to access through both of these OS' on the same USB hard disk? At the moment, my

  • How do I get subscribed calendar events to show on my iPhone 4?

    I have a subscribed calendar in iCal on my desktop that shows up in the list of iCloud calendars on my iPhone, but none of the events actually show up on my iPhone even though that calendar is selected to show its events.  How can I fix this?  It's r

  • Webutil upload is holding the file that it uploads

    Hi am creating n application using a lot of webutil commands to upload files that were scanned onto the users machine. I am having the following problem - after a call the webutil upload I try to call the webutil delete file to delete the file that w

  • Shutting down 'tuxedo daemons' (or servers with long-time svc)

    eLink brings 'tuxedo daemon' idiom (in short: to have some client application booted and run from tmboot, restared on error etc, one should move 'main' contents to some service body, give it unique name and tpacall it from tpsvrinit). This is nice re

  • SIA restart loop and infinite hprof files

    Hello BO Experts, Im having a problem with SIA, its just not starting(it never appears as stopped but it continues initializing and starting and then intializing), and generating hprof files in the logging folder until the disk is full. What I have d