CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkNetworkConnectorQtSoap.h
Go to the documentation of this file.
1 /*
2  * ctkNetworkConnectorQtSoap.h
3  * ctkEventBus
4  *
5  * Created by Daniele Giunchi on 14/07/10.
6  * Copyright 2010 B3C. All rights reserved.
7  *
8  * See Licence at: http://tiny.cc/QXJ4D
9  *
10  */
11 
12 #ifndef CTKNETWORKCONNECTORQTSOAP_H
13 #define CTKNETWORKCONNECTORQTSOAP_H
14 
15 // include list
16 #include "ctkNetworkConnector.h"
17 
18 // Foundation Library include list
19 #include <qtsoap.h>
20 
21 namespace ctkEventBus {
22 
28 class org_commontk_eventbus_EXPORT ctkNetworkConnectorQtSoap : public ctkNetworkConnector {
29  Q_OBJECT
30 
31 public:
34 
36  /*virtual*/ ~ctkNetworkConnectorQtSoap();
37 
39  /*virtual*/ void createClient(const QString hostName, const unsigned int port);
40 
42  void setWSDL(const QString wsdlUrl);
43 
45  void setAction(const QString action);
46 
48  void setPath(const QString path);
49 
51  void registerNamespace(QString prefix, QString namespaceURI);
52 
54  /*virtual*/ void createServer(const unsigned int port);
55 
57  /*virtual*/ void startListen();
58 
60 
61  /*virtual*/ void send(const QString methodName, ctkEventArgumentsList *argList);
62 
64  QtSoapType *marshall(const QString name, const QVariant &parameter);
65 
67  QtSoapType *response();
68 
70  /*virtual*/ void initializeForEventBus();
71 
72  //retrieve an instance of the object
73  virtual ctkNetworkConnector *clone();
74 
75 Q_SIGNALS:
77  void registerMethodsServer(mafRegisterMethodsMap registerMethodsList);
78 
79 public Q_SLOTS:
81  void registerServerMethod(QString methodName, QList<QVariant::Type> types);
82 
83 private Q_SLOTS:
85  void retrieveRemoteResponse();
86 
87 private:
89  void stopServer();
90 
91  QtSoapHttpTransport *m_Http;
92  QtSoapMessage m_Request;
93  mafRegisterMethodsMap m_RegisterMethodsMap;
94  QString m_WSDLUrl;
95  QString m_Action;
96  QString m_Path;
97  QtSoapType *m_Response;
98 };
99 
101 // Inline methods
103 
104 inline void ctkNetworkConnectorQtSoap::setWSDL(const QString wsdlUrl) {
105  m_WSDLUrl = wsdlUrl;
106 }
107 
108 inline void ctkNetworkConnectorQtSoap::setAction(const QString action) {
109  m_Action = action;
110 }
111 
112 inline void ctkNetworkConnectorQtSoap::setPath(const QString path) {
113  m_Path = path;
114 }
115 
117  return m_Response;
118 }
119 
120 inline void ctkNetworkConnectorQtSoap::registerNamespace(QString prefix, QString namespaceURI) {
121  m_Request.useNamespace(prefix, namespaceURI);
122 }
123 
124 } //namespace ctkEventBus
125 
126 #endif // CTKNETWORKCONNECTORQTSOAP_H
QtSoapType * response()
return the response retrieved from the service
void setAction(const QString action)
set the action for the http transport
void setPath(const QString path)
set the path, for example the end point or the wsdl
void registerNamespace(QString prefix, QString namespaceURI)
register a further namespace which will be used in soap 1.1 for axis2 compatibility
QMap< QString, QList< QVariant::Type > > mafRegisterMethodsMap
map which represent list of function to be registered in the server, with parameters
void setWSDL(const QString wsdlUrl)
set the url of the wsdl for querying the service.