Hi,
o Jason Penton [11/07/2009 07:53 AM]:
Hi All,
I would like to add web service support to SEMS. I would like to be able
to call web services from any SEMS application. What I would like to
know is where best to implemnt this functionality. I am assuming as a
SEMS plug-in?? If I create a SEMS plugin, how will I make sure that all
applications will have access to the scope of the plugin.
Any pointers would be appreciated
p.s. I will be using the gsoap library
If you can access the service through xmlrpc or rest, go this way, it
will be simpler and perform better. For xmlrpc, use the xmlrpc2di module
(it can also be used as xmlrpc client, also with load balancing and
failover etc), for rest, best is to write a DSM module that uses libcurl
(this is not complicated).
If you have to use SOAP, well... If you want to make the web service
client available to all applications, write it as a plugin which exposes
a DI interface. This way all applications can use it, you can use it
from DSM, you can test it from xmlrpc, etc. For examples how to do DI
API, see UserTimer.cpp in session_timer, monitoring, webconference,
di_dial etc.
With gsoap it works this way that you give the gsoap the wsdl, and it
generates c++ classes to access the remote methods. So you will have to
generate this for every web service that you want to access, and classes
with different types for the functions, and the input and output
parameters of the remote service will be generated. This means that you
need to write the module wrapper around this (i.e. the code that takes
the parameters out of AmArg parameters to DI functions, puts it into the
generated input parameter classes, does the function call itself, and
puts back results into DI parameters) for every web service. I think
with gsoap it is not easily possible to use it on a lower level as a
generic SOAP client, which you could then use for web services with
different WSDLs. But I think that if you put the common code separately,
writing the wrapper code for a new service is not too much work (its a
tedious job, though).
Some other notes on gsoap:
- you can use the sample code from gsoap docs almost 1:1
- the wsdl should be written cleanly and not too complicated, otherwise
you might get problems (namespace et al)
- i use soapcpp2 with -e -x
- if you use ssl, init the threads (google th-lock.c ssl
CRYPTO_thread_setup or the like)
- gsoap license is not gpl, this means you cannot redistribute the code
(you are free to do with it whatever you like, though)
- if you can, avoid soap...(have i said that already?)
hth
Stefan
Cheers
Jason
------------------------------------------------------------------------
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev