Difference between revisions of "Xebra XML RPC"

(demo.xrpc)
Line 2: Line 2:
  
 
The file ''demo.xrpc'' is translated into ''g_demo_servlet.e''.
 
The file ''demo.xrpc'' is translated into ''g_demo_servlet.e''.
 +
 +
See [[Xebra Tutorial|tutorials]] for a guide about how to create a xml-rpc servlet.
  
  
 
===demo.xrpc===
 
===demo.xrpc===
 
<xml>
 
<xml>
<xrpc:api class="MY_XMLRPC" namespace="math">
+
<xrpc:api class="MY_XMLRPC_API" namespace="math">
 
   <xrpc:method name="sum" />
 
   <xrpc:method name="sum" />
 
   <xrpc:method name="product" />
 
   <xrpc:method name="product" />
Line 13: Line 15:
  
 
===g_demo_servlet.e===
 
===g_demo_servlet.e===
<code>
+
<e>
...
+
class
</code>
+
G_DEMO_XMLRPC_SERVLET
 +
 
 +
inherit
 +
XWA_XMLRPC_SERVLET
 +
redefine
 +
make,
 +
namespace
 +
end
 +
 
 +
create
 +
make
 +
 
 +
feature-- Access
 +
 
 +
api: MY_XMLRPC_API
 +
 
 +
feature-- Implementation
 +
 
 +
make
 +
--<Precursor>
 +
do
 +
Precursor
 +
create api
 +
                ensure
 +
                        api_attached: api /= Void
 +
end
 +
 
 +
feature -- Access
 +
 
 +
namespace: IMMUTABLE_STRING_8
 +
-- <Precursor>
 +
once
 +
Result := "math"
 +
end
 +
 
 +
feature {NONE} -- Factory
 +
 
 +
new_method_agents: HASH_TABLE [ROUTINE [ANY, TUPLE], READABLE_STRING_8]
 +
-- <Precursor>
 +
do
 +
create Result.make (2)
 +
Result.put (agent api.sum, "sum")
 +
Result.put (agent api.sum_x, "sum_x")
 +
end
 +
invariant
 +
        api_attached: api /= Void
 +
end
 +
</e>

Revision as of 10:48, 1 July 2009

How it works

The file demo.xrpc is translated into g_demo_servlet.e.

See tutorials for a guide about how to create a xml-rpc servlet.


demo.xrpc

<xrpc:api class="MY_XMLRPC_API" namespace="math">
  <xrpc:method name="sum" />
  <xrpc:method name="product" />
</xrpc:api>

g_demo_servlet.e

class
	G_DEMO_XMLRPC_SERVLET
 
inherit
	XWA_XMLRPC_SERVLET
		redefine
			make,
			namespace
		 end
 
create
	make
 
feature-- Access
 
	api: MY_XMLRPC_API
 
feature-- Implementation
 
	make
			--<Precursor>
		do
			Precursor
			create api
                ensure
                        api_attached: api /= Void
		end
 
feature -- Access
 
	namespace: IMMUTABLE_STRING_8
			-- <Precursor>
		once
			Result := "math"
		end
 
feature {NONE} -- Factory
 
	new_method_agents: HASH_TABLE [ROUTINE [ANY, TUPLE], READABLE_STRING_8]
			-- <Precursor>
		do
			create Result.make (2)
			Result.put (agent api.sum, "sum")
			Result.put (agent api.sum_x, "sum_x")
		end
invariant
        api_attached: api /= Void
end