Hello Eric, I think you are going to need a conduit which allows you to have a stateful OpenSRF session connection, and the OSRF gateway doesn't do that. You are going to want to use either osrf-websocket-translator (more modern) or osrf-http-translator to do what you are trying to do.
Unfortunately, good step-by-step documentation for those layers doesn't really exist, as they are embedded in various JS libraries and most devs just build on top of those. TADL has their PHP wrapper for the gateway, but I don't know if anything in the wild exists for PHP communication with the translators, but a really basic implementation wouldn't be a ton of work. Since you seem adept at following logs, one thing you could do is use the built-in browser dev tools to monitor the traffic from the web client to see exactly what is going on, then emulate from there. (Acquisitions interfaces use the http-translator heavily, and most other areas use the websockets variety.) In your situation, the osrf-http-translator may be a touch easier to talk to, as it is still just HTTP with some custom headers as the secret sauce. I wouldn't take it as gospel, but here is the original http-translator proposal, and I think the actual implementation is fairly close: https://wiki.evergreen-ils.org/doku.php?id=opensrf_over_http Also, here is a thread from a few years ago discussing some of the differences between the various options (and makes the most sense if you read the whole thing): https://markmail.org/thread/dskpqxf3ed24q33g Finally, I think I saw your name on the Hack-a-way page, so this would be a great thing to hack on in person if you are up for that :) Sincerely, Dan On Fri, Oct 26, 2018 at 11:58 AM Eric Klooster <[email protected]> wrote: > Hi all, > > We've been running our Evergreen install for almost ten months, with a > custom PHP API that uses the guzzle http client to make OpenSRF requests to > the http gateway. > > Our current project is to update MARC records programmatically, and by > viewing the gateway logs while using the staff client, I can see that a > call to open-ils.pcrud.update.bre is being made. I have been able to call > open-ils.pcrud.retrieve.bre successfully with an authentication token, > however when I try to call open-ils.pcrud.update.bre, I get this error: > "osrfMethodException : No active transaction -- required for UPDATE". > > I've tried calling open-ils.pcrud.transaction.begin first, which returns a > string which I assume is a transaction identifier, but my subsequent call > to open-ils.pcrud.update.bre still fails with the no active transaction > error. > > Is there a way to have a transaction span multiple OpenSRF calls using the > http gateway or do I need to try another strategy? I know there are > multiple gateways to try, but I've only gotten responses on the /gateway > and the /osrf-gateway-v1 paths. If we could get these pcrud calls working > it would open up a lot of future options for us as well. > > Thanks for any help or insight anyone may have to share. > > -Eric >
