Add an example Apache virtual host configuration and curl script for testing the...
authordbs <dbs@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 28 Jan 2010 03:10:23 +0000 (03:10 +0000)
committerdbs <dbs@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 28 Jan 2010 03:10:23 +0000 (03:10 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1905 9efc2488-bf62-4759-914b-345cdb29e865

examples/apache2/opensrf [new file with mode: 0644]
examples/math_client_curl.sh [new file with mode: 0644]

diff --git a/examples/apache2/opensrf b/examples/apache2/opensrf
new file mode 100644 (file)
index 0000000..2989dc0
--- /dev/null
@@ -0,0 +1,49 @@
+# This is a barebones Apache virtual host configuration, suitable
+# for testing out the OpenSRF gateway and HTTP translator, and
+# that's about it.
+
+NameVirtualHost *:80
+<VirtualHost *:80>
+       ServerName localhost:80
+       ServerAlias 127.0.0.1:80
+       #DocumentRoot /openils/var/web/
+       #DirectoryIndex index.xml index.html index.xhtml
+
+       # ----------------------------------------------------------------------------------
+       # Configure the gateway
+       # ----------------------------------------------------------------------------------
+       OSRFGatewayConfig /openils/conf/opensrf_core.xml
+       # Translator memcache server.  Default is localhost
+       # OSRFTranslatorCacheServer 127.0.0.1:11211
+
+       # ----------------------------------------------------------------------------------
+       # XXX Note, it's important to explicitly set the JSON encoding style 
+       # (OSRFGatewayLegacyJSON), since the default encoding style will likely change 
+       # with OpenSRF 1.0
+       # ----------------------------------------------------------------------------------
+       # OpenSRF JSON legacy gateway
+       # ----------------------------------------------------------------------------------
+       <Location /gateway>
+               SetHandler osrf_json_gateway_module
+               OSRFGatewayLegacyJSON "true"
+               allow from all
+       </Location>
+       # ----------------------------------------------------------------------------------
+       # New-style OpenSRF JSON gateway
+       # ----------------------------------------------------------------------------------
+       <Location /osrf-gateway-v1>
+               SetHandler osrf_json_gateway_module
+               OSRFGatewayLegacyJSON "false"
+               allow from all
+       </Location>
+
+       # ----------------------------------------------------------------------------------
+       # OpenSRF-over-HTTP translator
+       # (http://open-ils.org/dokuwiki/doku.php?id=opensrf_over_http)
+       # ----------------------------------------------------------------------------------
+       <Location /osrf-http-translator>
+               SetHandler osrf_http_translator_module
+               allow from all
+       </Location>
+
+</VirtualHost>
diff --git a/examples/math_client_curl.sh b/examples/math_client_curl.sh
new file mode 100644 (file)
index 0000000..3f3fb6e
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# Simple demonstration of invoking a public OpenSRF method via curl
+
+# Expected output will be something like:
+# [{"__c":"osrfMessage","__p":{"threadTrace":"0","locale":"en-CA","type":"RESULT","payload":{"__c":"osrfResult","__p":{"status":"OK","statusCode":"200","content":4}}}},{"__c":"osrfMessage","__p":{"threadTrace":"0","locale":"en-CA","type":"STATUS","payload":{"__c":"osrfConnectStatus","__p":{"status":"Request Complete","statusCode":"205"}}}}]
+
+curl -H "X-OpenSRF-service: opensrf.math" --data 'osrf-msg=[{"__c":"osrfMessage","__p":{"threadTrace":0,"type":"REQUEST","payload":{"__c":"osrfMethod","__p":{"method":"add","params":[2,2]}},"locale":"en-CA"}}]' http://localhost/osrf-http-translator