Xebra XML RPC: Difference between revisions

From EiffelStudio: an EiffelSoftware project
Jump to navigation Jump to search
Fabioz (talk | contribs)
No edit summary
Fabioz (talk | contribs)
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Xebra]]
[[Xebra About|About]] | [[Xebra Installation|Installation]] |  [[Xebra Documentation|Documentation]] |  [[Xebra Tutorial|Tutorials]] | [[Xebra FAQ|Frequently Asked Questions]]
=How it works=
=How it works=


Line 8: Line 13:
===demo.xrpc===
===demo.xrpc===
<xml>
<xml>
<xrpc:api class="MY_XMLRPC_API" namespace="math">
<xrpc:api namespace="math">
  <page:controller class="MY_XMLRPC_API" />
   <xrpc:method name="sum" />
   <xrpc:method name="sum" />
   <xrpc:method name="product" />
   <xrpc:method name="product" />
Line 17: Line 23:
<e>
<e>
class
class
G_DEMO_XMLRPC_SERVLET
G_DEMO_XRPC_SERVLET


inherit
inherit
XWA_XMLRPC_SERVLET
XWA_XRPC_SERVLET [MY_XRPC_API]
redefine
redefine
make,
namespace
namespace
end
end
Line 28: Line 33:
create
create
make
make
feature-- Access
api: MY_XMLRPC_API
feature-- Implementation
make
--<Precursor>
do
Precursor
create api
                ensure
                        api_attached: api /= Void
end


feature -- Access
feature -- Access
Line 59: Line 49:
create Result.make (2)
create Result.make (2)
Result.put (agent api.sum, "sum")
Result.put (agent api.sum, "sum")
Result.put (agent api.sum_x, "sum_x")
Result.put (agent api.product, "product")
end
end
invariant
 
        api_attached: api /= Void
end
end
</e>
</e>

Latest revision as of 18:15, 11 July 2009

About | Installation | Documentation | Tutorials | Frequently Asked Questions


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 namespace="math">
  <page:controller class="MY_XMLRPC_API" />
  <xrpc:method name="sum" />
  <xrpc:method name="product" />
</xrpc:api>

g_demo_servlet.e

class
	G_DEMO_XRPC_SERVLET
 
inherit
	XWA_XRPC_SERVLET [MY_XRPC_API]
		redefine
			namespace
		 end
 
create
	make
 
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.product, "product")
		end
 
end