summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/components/webservice
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-01-25 07:28:50 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-01-25 07:28:50 +0000
commitc4de801fcb55b6ca0c8c12777007948eeb7a9e79 (patch)
tree93865908d8c24ece181826b093c4cac343b9b042 /sca-cpp/trunk/components/webservice
parent0bb923d739f7c1e6f5bb9b1af1e2fad0253350d6 (diff)
Added skeletons and build options for a few more utility components. Minor refactoring of the web service component.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@902721 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/components/webservice')
-rw-r--r--sca-cpp/trunk/components/webservice/Makefile.am9
-rw-r--r--sca-cpp/trunk/components/webservice/axiom-test.cpp2
-rw-r--r--sca-cpp/trunk/components/webservice/axis2-test.cpp2
-rw-r--r--sca-cpp/trunk/components/webservice/axis2.hpp (renamed from sca-cpp/trunk/components/webservice/webservice.hpp)0
-rw-r--r--sca-cpp/trunk/components/webservice/client-test.cpp3
-rw-r--r--sca-cpp/trunk/components/webservice/webservice-client.cpp (renamed from sca-cpp/trunk/components/webservice/webservice.cpp)6
-rw-r--r--sca-cpp/trunk/components/webservice/webservice-listener.cpp63
-rw-r--r--sca-cpp/trunk/components/webservice/webservice.composite25
8 files changed, 95 insertions, 15 deletions
diff --git a/sca-cpp/trunk/components/webservice/Makefile.am b/sca-cpp/trunk/components/webservice/Makefile.am
index fd85cf4cb0..8d6a9a7879 100644
--- a/sca-cpp/trunk/components/webservice/Makefile.am
+++ b/sca-cpp/trunk/components/webservice/Makefile.am
@@ -22,10 +22,13 @@ noinst_PROGRAMS = axiom-test axis2-test client-test
INCLUDES = -I${AXIS2C_INCLUDE}
compdir=$(prefix)/components/webservice
-comp_LTLIBRARIES = libwebservice.la
+comp_LTLIBRARIES = libwebservice-client.la libwebservice-listener.la
-libwebservice_la_SOURCES = webservice.cpp
-libwebservice_la_LDFLAGS = -lxml2 -L${AXIS2C_LIB} -R${AXIS2C_LIB} -laxis2_engine
+libwebservice_client_la_SOURCES = webservice-client.cpp
+libwebservice_client_la_LDFLAGS = -lxml2 -L${AXIS2C_LIB} -R${AXIS2C_LIB} -laxis2_engine
+
+libwebservice_listener_la_SOURCES = webservice-listener.cpp
+libwebservice_listener_la_LDFLAGS = -lxml2 -L${AXIS2C_LIB} -R${AXIS2C_LIB} -laxis2_engine
axiom_test_SOURCES = axiom-test.cpp
axiom_test_LDFLAGS = -lxml2 -L${AXIS2C_LIB} -R${AXIS2C_LIB} -laxis2_engine
diff --git a/sca-cpp/trunk/components/webservice/axiom-test.cpp b/sca-cpp/trunk/components/webservice/axiom-test.cpp
index c52183ea9b..a3ab8e7e8f 100644
--- a/sca-cpp/trunk/components/webservice/axiom-test.cpp
+++ b/sca-cpp/trunk/components/webservice/axiom-test.cpp
@@ -31,7 +31,7 @@
#include "monad.hpp"
#include "value.hpp"
#include "perf.hpp"
-#include "webservice.hpp"
+#include "axis2.hpp"
namespace tuscany {
namespace webservice {
diff --git a/sca-cpp/trunk/components/webservice/axis2-test.cpp b/sca-cpp/trunk/components/webservice/axis2-test.cpp
index 8ab21bee29..d7c2f3b671 100644
--- a/sca-cpp/trunk/components/webservice/axis2-test.cpp
+++ b/sca-cpp/trunk/components/webservice/axis2-test.cpp
@@ -31,7 +31,7 @@
#include "monad.hpp"
#include "value.hpp"
#include "perf.hpp"
-#include "webservice.hpp"
+#include "axis2.hpp"
namespace tuscany {
namespace webservice {
diff --git a/sca-cpp/trunk/components/webservice/webservice.hpp b/sca-cpp/trunk/components/webservice/axis2.hpp
index ba13b9ad7f..ba13b9ad7f 100644
--- a/sca-cpp/trunk/components/webservice/webservice.hpp
+++ b/sca-cpp/trunk/components/webservice/axis2.hpp
diff --git a/sca-cpp/trunk/components/webservice/client-test.cpp b/sca-cpp/trunk/components/webservice/client-test.cpp
index 6e63c83ecb..7c1cd601e0 100644
--- a/sca-cpp/trunk/components/webservice/client-test.cpp
+++ b/sca-cpp/trunk/components/webservice/client-test.cpp
@@ -36,7 +36,6 @@
namespace tuscany {
namespace webservice {
-const string url("http://localhost:8090/webservice");
bool testEval() {
http::CURLSession cs;
@@ -47,7 +46,7 @@ bool testEval() {
+ (list<value>() + "@xmlns:ns1" + string("http://ws.apache.org/axis2/services/echo"))
+ (list<value>() + "text" + string("Hello World!")));
- const failable<value> rval = http::evalExpr(mklist<value>(func, arg), url, cs);
+ const failable<value> rval = http::evalExpr(mklist<value>(func, arg), "http://localhost:8090/echo-client", cs);
assert(hasContent(rval));
const list<value> r = mklist<value>(
diff --git a/sca-cpp/trunk/components/webservice/webservice.cpp b/sca-cpp/trunk/components/webservice/webservice-client.cpp
index 6427756b40..cc3a15c734 100644
--- a/sca-cpp/trunk/components/webservice/webservice.cpp
+++ b/sca-cpp/trunk/components/webservice/webservice-client.cpp
@@ -20,7 +20,7 @@
/* $Rev$ $Date$ */
/**
- * Web service component implementation.
+ * Web service client component implementation.
*/
#include "string.hpp"
@@ -28,13 +28,13 @@
#include "list.hpp"
#include "value.hpp"
#include "monad.hpp"
-#include "webservice.hpp"
+#include "axis2.hpp"
namespace tuscany {
namespace webservice {
/**
- * Apply a Web service function / operation using Axis2.
+ * Apply a function provided by a remote Web service using Axis2.
*/
const failable<value> apply(const value& func, const list<value>& params) {
const Axis2Context ax;
diff --git a/sca-cpp/trunk/components/webservice/webservice-listener.cpp b/sca-cpp/trunk/components/webservice/webservice-listener.cpp
new file mode 100644
index 0000000000..495eb3478c
--- /dev/null
+++ b/sca-cpp/trunk/components/webservice/webservice-listener.cpp
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+/**
+ * Web service listener component implementation.
+ */
+
+#include "string.hpp"
+#include "function.hpp"
+#include "list.hpp"
+#include "value.hpp"
+#include "monad.hpp"
+#include "../../modules/http/httpd.hpp"
+#include "axis2.hpp"
+
+namespace tuscany {
+namespace webservice {
+
+/**
+ * Handle an HTTP request.
+ */
+const failable<value> handle(const list<value>& params) {
+
+ // Extract HTTPD request and relay reference
+ unused request_rec* r = httpd::request(car(params));
+ const lambda<value(const list<value>&)> relay = cadr(params);
+
+ //TODO Hook Axis2/C server module here
+
+ return value(true);
+}
+
+}
+}
+
+extern "C" {
+
+const tuscany::value apply(const tuscany::list<tuscany::value>& params) {
+ const tuscany::value func(car(params));
+ if (func == "handle")
+ return tuscany::webservice::handle(cdr(params));
+ return tuscany::mkfailure<tuscany::value>(tuscany::string("Function not supported: ") + func);
+}
+
+}
diff --git a/sca-cpp/trunk/components/webservice/webservice.composite b/sca-cpp/trunk/components/webservice/webservice.composite
index ebb007b37e..bbfc926e2e 100644
--- a/sca-cpp/trunk/components/webservice/webservice.composite
+++ b/sca-cpp/trunk/components/webservice/webservice.composite
@@ -20,13 +20,28 @@
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"
targetNamespace="http://tuscany.apache.org/xmlns/sca/components"
- name="webservice">
+ name="webservice-client">
- <component name="webservice">
- <implementation.cpp path=".libs" library="libwebservice"/>
+ <component name="webservice-client">
+ <implementation.cpp path=".libs" library="libwebservice-client"/>
<property name="uri">http://localhost:9090/axis2/services/echo</property>
- <service name="webservice">
- <t:binding.http uri="webservice"/>
+ <service name="webservice-client">
+ <t:binding.jsonrpc uri="echo-client"/>
+ </service>
+ </component>
+
+ <component name="webservice-listener">
+ <implementation.cpp path=".libs" library="libwebservice-listener"/>
+ <service name="webservice-listener">
+ <t:binding.http uri="echo-listener"/>
+ </service>
+ <reference name="relay" target="echo"/>
+ </component>
+
+ <component name="echo">
+ <t:implementation.scheme script="echo.scm"/>
+ <service name="echo">
+ <t:binding.jsonrpc uri="echo"/>
</service>
</component>