[Opensrf-commits] r1905 - in trunk/examples: . apache2 (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jan 27 22:10:25 EST 2010


Author: dbs
Date: 2010-01-27 22:10:23 -0500 (Wed, 27 Jan 2010)
New Revision: 1905

Added:
   trunk/examples/apache2/
   trunk/examples/apache2/opensrf
   trunk/examples/math_client_curl.sh
Log:
Add an example Apache virtual host configuration and curl script for testing the math service


Added: trunk/examples/apache2/opensrf
===================================================================
--- trunk/examples/apache2/opensrf	                        (rev 0)
+++ trunk/examples/apache2/opensrf	2010-01-28 03:10:23 UTC (rev 1905)
@@ -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>

Added: trunk/examples/math_client_curl.sh
===================================================================
--- trunk/examples/math_client_curl.sh	                        (rev 0)
+++ trunk/examples/math_client_curl.sh	2010-01-28 03:10:23 UTC (rev 1905)
@@ -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



More information about the opensrf-commits mailing list