Execute method on server application.
Hello.
I have been looking on Qt example: fortuneserver. FortuneServer is responding on incomingConnection event and returning randome QString. How to define my own public methos on server application? For example I would like to allow client application to call server method:
Code:
public QString GetCustomerLastName
(const int
& customerID
);
public void SetCustomerLastName(const int& customerID, const QString& lastName);
Howto define those kind public methods on server and how to call them from client application?
Re: Execute method on server application.
This is off topic for this forum.
Re: Execute method on server application.
Com on I'm fresh with Qt and this tipic is about Qt client-server application.
Re: Execute method on server application.
Re: Execute method on server application.
You need to:
- Receive the incoming request, which may not be from a Qt client.
- Interpret the request, validate provided parameters, check permissions etc.
- Call the relevant method(s) in the server code to service the request.
- Send the result back to the client.
You are asking about steps 2 and 3. You can do these any way you like. Step 2 might be disassembling a SOAP, XML-RPC or some other request packet. Step 3 involves some sort of mapping mechanism. There is no magic expose-this-method-on-the-net language extension in C++.
Re: Execute method on server application.
Quote:
There is no magic expose-this-method-on-the-net
So that's what he was after.... ah...
Re: Execute method on server application.
I have read about gSOAP. I would like to use gSOAP in my Qt project. Base on FortuneServer example I have created server application that for any connected client is creating separated thread and keeping connection (and thread) alive until client get disconnected.
In gSOAP documentation I found how to Generate C++ Server Object Classes files.
Question: Is it enough if I will create gSOAP (*.h and *.cpp) files from header file that is containing all public server methods and attach generated files into my server and client application?