I need to translate the project XML into a project MFC VC6 but I am not able.
Someone can help me?
I am at beginning in VC and I don't Know in details how it run.
Thanks very very much
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can someone help me?
I'm trying to convert tehe class (on XMLRPC server) wrote for win32 console
to MFC class but I don't know how I can implement this class:
// A variable number of arguments are passed, all doubles, result is their sum
class Sum : public XmlRpcServerMethod
{public: Sum(XmlRpcServer* s) : XmlRpcServerMethod("Sum", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
int nArgs = params.size();
double sum = 0.0;
for (int i=0; i<nArgs; ++i)
sum += double(params[i]);
result = sum;
}
} sum(&s);
Can you help me?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I do not understand your last post at all. What do you try to do? Create a new method? Create a new dialog? What do you mean with "class wrote for win32 console"?
Just guessing: you want to create a new method in the server, using Microsoft VC++ 6.
To do that, you can create a new class: in the class view, right click over the project. Then, select "General class", use "Sum" as class name and inheriting from XmlRpcServerMethod
Once the class is created, you need to modify the class constructor (as you mention in your post) and add the "execute" method. Finally, create an object with input parameter the server.
José
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you very much Josè.
It's very kind of you.
But I did it in the same way you wrote.
First of all when I implement new class the compilator give me an error. I can't use Sum.cpp but only Sum.h
If I put }sum(&s) I have an error.
If I dont write sum(&s) the compiler has no errors but the client (when connected with it) concludes whith 'error abnormal end of program...'.
If you can help me I'll be gratefull with you.
Have you the project developed with MFC?
Thank very very much.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Right after the build of this class I have the error:
C:\Programmi\Microsoft Visual Studio\VC98\PROJECTS\XmlHelloServer\Sum.cpp(22) : error C2512: 'XmlRpcServerMethod' : no appropriate default constructor available
If I comment the constructor and the distructor and write the code of "Sum" only in Sum.h I have no errors and all seems go right but the client ends with the 'error abnormal termination".
I ask you if you want to send me an example. My address is: matras_11@libero.it
It will be fantastic.
I thank you very much!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you got the XmlRpc++ lib from a ZIP file, it contains a "test" folder, with a file called "HelloServer.cpp". Yes, it is an example how to define a server method.
After that, in your XmlRpc server object, you need to register the method: after crerating the server object, use that object in the constructor of the ServerMethod (see the following Sum object constructor)
Doing your "Sum" functionality as described in the example file:
<------- HEADER FILE ---------->
// Sum.h: interface for the Sum class.
//
//////////////////////////////////////////////////////////////////////
<------- SOURCE FILE ---------->
// Sum.cpp: implementation of the Sum class.
//
//////////////////////////////////////////////////////////////////////
I need to translate the project XML into a project MFC VC6 but I am not able.
Someone can help me?
I am at beginning in VC and I don't Know in details how it run.
Thanks very very much
Do you still have this issue?
Jose
Yes I still have this problem.
Can you help me?
Thanks!
If you get the current distribution, it contains a project that can be opened with VC++ 6: you have two files, called xmlrpc.dsp and xmlrpc.dsw
With VC++ 6 select the option "Open Workspace" (I think, that is the english name) and open the xmlrpc.dsw file.
The xmlrpc project will create a xmlrpc.lib file. This is a statically linked library.
Then, in the project you want to use XmlRpc++ in, you have to include that library.
Give it a try
Jose
Thank you very much!
I'll try soon.
Can someone help me?
I'm trying to convert tehe class (on XMLRPC server) wrote for win32 console
to MFC class but I don't know how I can implement this class:
// A variable number of arguments are passed, all doubles, result is their sum
class Sum : public XmlRpcServerMethod
{public: Sum(XmlRpcServer* s) : XmlRpcServerMethod("Sum", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
int nArgs = params.size();
double sum = 0.0;
for (int i=0; i<nArgs; ++i)
sum += double(params[i]);
result = sum;
}
} sum(&s);
Can you help me?
I do not understand your last post at all. What do you try to do? Create a new method? Create a new dialog? What do you mean with "class wrote for win32 console"?
Just guessing: you want to create a new method in the server, using Microsoft VC++ 6.
To do that, you can create a new class: in the class view, right click over the project. Then, select "General class", use "Sum" as class name and inheriting from XmlRpcServerMethod
Once the class is created, you need to modify the class constructor (as you mention in your post) and add the "execute" method. Finally, create an object with input parameter the server.
José
Thank you very much Josè.
It's very kind of you.
But I did it in the same way you wrote.
First of all when I implement new class the compilator give me an error. I can't use Sum.cpp but only Sum.h
If I put }sum(&s) I have an error.
If I dont write sum(&s) the compiler has no errors but the client (when connected with it) concludes whith 'error abnormal end of program...'.
If you can help me I'll be gratefull with you.
Have you the project developed with MFC?
Thank very very much.
To your last question: yes, I do use XmlRpc++ with MFC problems and no issues had
I assume, you create a new class using the class-wizard in VC++. That generates two files, Sum.h and Sum.cpp.
Can you put the source code here of both files? Please, add also the compile error you got. To me, it seems that you have forgotten something.
José
// Sum.h: interface for the Sum class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SUM_H__78B20CFF_ED75_443A_B01B_0AB7EB118267__INCLUDED_)
#define AFX_SUM_H__78B20CFF_ED75_443A_B01B_0AB7EB118267__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class Sum : public XmlRpcServerMethod
{
public:
Sum();
virtual ~Sum();
};
#endif // !defined(AFX_SUM_H__78B20CFF_ED75_443A_B01B_0AB7EB118267__INCLUDED_)
// Sum.cpp: implementation of the Sum class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "XmlHelloServer.h"
#include "Sum.h"
//#include "./include/XmlRpc.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Sum::Sum()
{
}
Sum::~Sum()
{
}
Right after the build of this class I have the error:
C:\Programmi\Microsoft Visual Studio\VC98\PROJECTS\XmlHelloServer\Sum.cpp(22) : error C2512: 'XmlRpcServerMethod' : no appropriate default constructor available
If I comment the constructor and the distructor and write the code of "Sum" only in Sum.h I have no errors and all seems go right but the client ends with the 'error abnormal termination".
I ask you if you want to send me an example. My address is: matras_11@libero.it
It will be fantastic.
I thank you very much!
If you got the XmlRpc++ lib from a ZIP file, it contains a "test" folder, with a file called "HelloServer.cpp". Yes, it is an example how to define a server method.
After that, in your XmlRpc server object, you need to register the method: after crerating the server object, use that object in the constructor of the ServerMethod (see the following Sum object constructor)
Doing your "Sum" functionality as described in the example file:
<------- HEADER FILE ---------->
// Sum.h: interface for the Sum class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SUM_H__78B20CFF_ED75_443A_B01B_0AB7EB118267__INCLUDED_)
#define AFX_SUM_H__78B20CFF_ED75_443A_B01B_0AB7EB118267__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class Sum : public XmlRpcServerMethod
{
public:
Sun(XmlRpcServer* s) : XmlRpcServerMethod("Sum", s) {}
virtual ~Sum() {};
void execute(XmlRpcValue& params, XmlRpcValue& result);
};
#endif // !defined(AFX_SUM_H__78B20CFF_ED75_443A_B01B_0AB7EB118267__INCLUDED_)
<------- HEADER FILE ENDS HERE---------->
<------- SOURCE FILE ---------->
// Sum.cpp: implementation of the Sum class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "./include/XmlRpc.h"
#include "Sum.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
// Normally, you only need to implement the "execute" function;
// Construction-Destruction are implemented in the class definition
void Sum::execute(XmlRpcValue& params, XmlRpcValue& result)
{
// Do whatever you wanna do here (Sum operation?)
}
<------- SOURCE FILE ENDS HERE---------->