[OPEN-ILS-DEV] Help:opensrf over http using java

Bill Erickson erickson at esilibrary.com
Mon Mar 28 09:27:17 EDT 2011


Hi,

What you are describing is basically correct.  For further reference, see
the login() function at

http://svn.open-ils.org/trac/ILS/browser/trunk/Open-ILS/src/java/org/open_ils/util/Utils.java#L11

For your purposes, you would change the ClientSession.atomicRequest() calls
(which communicate via XMPP) to analogous HTTP requests.  As you've probably
discovered, there is no gateway/translator code in Java yet, so the HTTP
handling would be new code.

Hope this helps.

-b


On Sat, Mar 26, 2011 at 1:44 AM, chiwe123456 at gmail.com <
chiragahuja.nsit at gmail.com> wrote:

> *Forgot to put my information over previous mail..*
>
>
> I want to login through a java application
>
>
>
> Is my Approach correct??
>
>
>
> First I will create json object in java which is like this
>
>
>
> (
>
> but I don’t know how to use curl –H over here as it is a command line tool
>
> )
>
>
>
> curl -H "X-OpenSRF-service: open-ils.auth" --data 'osrf-msg=
>
> [
>
>   {  "__c" : "osrfMessage",
>
>      "__p" : {
>
>         "threadTrace" : 0,
>
>         "payload" : {
>
>            "__c" : "osrfMethod","__p" : { "params" : ["admin"],
>
>               "method" : "open-ils.auth.authenticate.init"
>
>
>
>
>            }
>
>         },
>
>         "locale" : "en-US",
>
>         "type" : "REQUEST"
>
>      }
>
>   }
>
> ]
>
>
>
> and then send it to url=*http://192.168.56.102/osrf-http-translator *(192.168.56.102 is the ip address of virtual machine because I’m accessing virtual machine services from host machine in which java application is running)
>
>
>
>
>
>
>
> *Response*
>
>
>
> [
>
>   {
>
>      "__c" : "osrfMessage",
>
>      "__p" : {
>
>
>
>         "threadTrace" : 0,
>
>         "payload" : {
>
>            "__c" : "osrfResult",
>
>            "__p" : {
>
>               "status" : "OK",
>
>
>
>
>               "content" : “6ba0510ab42e028e57755bf0151655ed”
>
>               "statusCode" : 200
>
>            }
>
>         },
>
>         "locale" : "en-US",
>
>
>
>
>         "type" : "RESULT"
>
>      }
>
>   },
>
>   {
>
>      "__c" : "osrfMessage",
>
>      "__p" : {
>
>         "threadTrace" : 0,
>
>
>
>
>         "payload" : {
>
>            "__c" : "osrfConnectStatus",
>
>            "__p" : {
>
>               "status" : "Request Complete",
>
>
>
>
>               "statusCode" : 205
>
>            }
>
>         },
>
>         "locale" : "en-US",
>
>         "type" : "STATUS"
>
>      }
>
>   }
>
> ]
>
>
>
> From response I take out 6ba0510ab42e028e57755bf0151655ed and md5hash of “open-ils”  which I’ll use in next request
>
>
>
> *Next Request*
>
>
>
>
>
> curl -H "X-OpenSRF-service: open-ils.auth" --data 'osrf-msg=
>
>
> [
>
>   {
>
>      "__c" : "osrfMessage",
>
>      "__p" : {
>
>         "threadTrace" : 0,
>
>         "payload" : {
>
>            "__c" : "osrfMethod",
>
>
>
>
>            "__p" : {
>
>               "params" : {
>
>                        “username”: "admin"
>
>                        “Password”: 92df31e9869a256203560124ea5319ec
>
>                        "type": "opac"
>
>
>
>               },"method" : " open-ils.auth.authenticate.complete"
>
>
>
>
>            }
>
>         },
>
>         "locale" : "en-US",
>
>         "type" : "REQUEST"
>
>      }
>
>   }
>
> ]
>
>
>
>
>
> And then the response...
>
> please help me with this.
>
>
>
>
>
>
>
> *Chirag Ahuja
>
> (irc name :chirag)*
>
>
>
>
>


-- 
Bill Erickson
| VP, Software Development & Integration
| Equinox Software, Inc. / Your Library's Guide to Open Source
| phone: 877-OPEN-ILS (673-6457)
| email: erickson at esilibrary.com
| web: http://esilibrary.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://libmail.georgialibraries.org/pipermail/open-ils-dev/attachments/20110328/421eaba2/attachment.htm 


More information about the Open-ils-dev mailing list