wxWindows n-tier application Topic is solved

If you have a cool piece of software to share, but you are not hosting it officially yet, please dump it in here. If you have code snippets that are useful, please donate!
Post Reply
marioavs
In need of some credit
In need of some credit
Posts: 6
Joined: Thu Jun 08, 2006 5:18 am
Location: Guatemala, Central America
Contact:

wxWindows n-tier application

Post by marioavs »

Here is my basic idea of a distributed application

1. GUI. wxWindows + gSoap (and possibly PHP, pocket pc, etc.)
2. Bussines Layer. wxWindows + gSoap + Apache
3. Database. Postgres or SQL Server

Other option, in my opinion, would be Java, but if we are generating so good client applications with wxWindows and gSoap, lets make the Web Services with gSoap and wxWindows. And make everything more robust using the great Apache Web Server. I have used this environment with .NET and working as client and as server, everything works fine. The only problem at this time are SOAP faults that .NET use as soap1.1 and aren't so friendly to manage as in gSoap (maybe I have to lear VB .NET.... some day)

At this time, I haven't tested on linux... but the theory says that I won't have problems. Something that have made my life easier is the wxString (de)serialization functions... so here is my contribution:

if you place this in a gsoap header file

Code: Select all

#include <wx/string.h>
extern class wxString;
extern typedef wxString xsd__string; // encode xsd__string value as the xsd:string schema type
you are gonna need this serializer (based on std::string serialization)

Code: Select all

#include <wx/string.h>
#include "envH.h"

void soap_serialize_xsd__string(struct soap *soap, const wxString *a)
{
//    soap_serialize_std__string(soap, a);
}

void soap_default_xsd__string(struct soap *soap, wxString *a)
{
    a->clear();
//	soap_default_std__string(soap, a);
}

int soap_out_xsd__string(struct soap * soap, const char *tag, int id, const wxString *s, const char *type)
{
	if ((soap->mode & SOAP_C_NILSTRING) && s->empty())
		return soap_element_null(soap, tag, id, type);
	if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, s, SOAP_TYPE_xsd__string), type) || soap_string_out(soap, s->c_str(), 0) || soap_element_end_out(soap, tag))
		return soap->error;
	return SOAP_OK;
}

wxString * soap_in_xsd__string(struct soap *soap, const char *tag, wxString *s, const char *type)
{
	if (soap_element_begin_in(soap, tag, 1, type))
		return NULL;
	if (!s)
		s = soap_new_xsd__string(soap, -1);
	if (soap->null)
		if (s)
			s->erase();
	if (soap->body && !*soap->href)
	{	char *t;
		s = (wxString*)soap_class_id_enter(soap, soap->id, s, SOAP_TYPE_xsd__string, sizeof(wxString), soap->type, soap->arrayType);
		if (s)
			if ((t = soap_string_in(soap, 1, -1, -1)))
				s->assign(t);
			else
				return NULL;
	}
	else
		s = (wxString*)soap_id_forward(soap, soap->href, soap_class_id_enter(soap, soap->id, s, SOAP_TYPE_xsd__string, sizeof(wxString), soap->type, soap->arrayType), 0, SOAP_TYPE_xsd__string, 0, sizeof(wxString), 0, soap_copy_xsd__string);
	if (soap->body && soap_element_end_in(soap, tag))
		return NULL;
	return s;
}
... and yes, I will find a gSoap forum the next time.
2.6.1, wxMSW, MinGW, Code::Blocks
priyank_bolia
wxWorld Domination!
wxWorld Domination!
Posts: 1339
Joined: Wed Aug 03, 2005 8:10 am
Location: BANGALORE, INDIA
Contact:

Post by priyank_bolia »

I am using wxWidgets and goap, there is any problem in that. Though I didn't mix wxString with gsoap, but the simple C++ strings goes well. You have a wsdl file and you can generate 25,000 line of code and complete implementation of web services within minutes using gsoap.
[CAUTION:]gsoap is a dual license commercial toolit, if your app is non-GPL and uses it, then pay for it. But I think its worth paying them.
marioavs
In need of some credit
In need of some credit
Posts: 6
Joined: Thu Jun 08, 2006 5:18 am
Location: Guatemala, Central America
Contact:

Post by marioavs »

priyank_bolia wrote:I am using wxWidgets and goap, there is any problem in that. Though I didn't mix wxString with gsoap, but the simple C++ strings goes well. You have a wsdl file and you can generate 25,000 line of code and complete implementation of web services within minutes using gsoap.
[CAUTION:]gsoap is a dual license commercial toolit, if your app is non-GPL and uses it, then pay for it. But I think its worth paying them.
I use wxString for Unicode and ASCII. That's why I think it's important to use it for the Web Services.

Only wsdl2h (gSOAP tool) has that special dual license, but soapcpp2 can be used for commercial applications (As far as I understood).
2.6.1, wxMSW, MinGW, Code::Blocks
krzysiek_t
Earned a small fee
Earned a small fee
Posts: 23
Joined: Tue Jul 11, 2006 1:36 pm
Location: Poland, Warsaw
Contact:

Post by krzysiek_t »

So maybe you can tell me how to force soapcpp2 to understand constructs like this:

Code: Select all

int ns__test(std::list<std::string>& x);
I use GCC 4.1.1. and cannot get it working. But this:

Code: Select all

int ns__test(std::string& x);
works perfectly.
priyank_bolia wrote:I am using wxWidgets and goap, there is any problem in that. Though I didn't mix wxString with gsoap, but the simple C++ strings goes well. You have a wsdl file and you can generate 25,000 line of code and complete implementation of web services within minutes using gsoap.
[CAUTION:]gsoap is a dual license commercial toolit, if your app is non-GPL and uses it, then pay for it. But I think its worth paying them.
[/code]
Post Reply