Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            : nuovo modulo server


git-svn-id: svn://10.65.10.50/trunk@10476 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2002-09-09 14:18:21 +00:00
parent 1d4f4e3267
commit 46c525e0d9
14 changed files with 1295 additions and 0 deletions

BIN
server/connect.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

185
server/diction.cpp Executable file
View File

@ -0,0 +1,185 @@
#include "wx/wx.h"
#include "wx/wfstream.h"
#include "wx/protocol/http.h"
#include <ctype.h>
#include "Soap.h"
#include "Diction.h"
class TDictionaryEntry : public wxObject
{
public:
wxString m_str;
TDictionaryEntry(const wxChar* str) : m_str(str) { }
};
class TDictionary : public wxHashTable
{
bool m_bDirty;
protected:
wxString Accentuate(const wxString& str) const;
const TDictionaryEntry* AddEntry(const wxString& ita, const wxChar* eng);
static bool FillCallback(TXmlItem& item, long jolly);
bool Load();
public:
wxString Translate(const wxString& ita);
TDictionary();
~TDictionary();
};
static TDictionary DevotoOli;
wxString TDictionary::Accentuate(const wxString& str) const
{
const int pos = str.Find('\'');
if (pos <= 0)
return str;
wxString bello = str.Left(pos);
for (size_t a = pos; str[a]; a++)
{
if (str[a] == '\'')
{
if ((isspace(str[a+1]) || str[a+1] == '\0') &&
strchr("aeiou", str[a-1]))
{
switch(str[a-1])
{
case 'a':
bello[a-1] = 'à'; break;
case 'e':
if (a >= 2 && (isspace(str[a-2]) || str[a-2] == '\''))
bello[a-1] = 'è';
else
bello[a-1] = 'é';
break;
case 'i':
bello[a-1] = 'ì'; break;
case 'o':
bello[a-1] = 'ò'; break;
case 'u':
bello[a-1] = 'ù'; break;
default:
break;
}
}
else
bello << str[a];
}
else
bello << str[a];
}
return bello;
}
const TDictionaryEntry* TDictionary::AddEntry(const wxString& ita, const wxChar* eng)
{
const wxString key = Accentuate(ita);
TDictionaryEntry* entry = new TDictionaryEntry(eng);
Put(key, entry);
m_bDirty = true;
return entry;
}
wxSocketClient& operator<<(wxSocketClient& sock, const wxChar* str)
{
if (str && *str)
sock.Write(str, wxStrlen(str));
return sock;
}
bool TDictionary::FillCallback(TXmlItem& item, long jolly)
{
if (item.GetTag() == "entry")
{
const TXmlItem* ita = item.GetChild(0);
const TXmlItem* eng = item.GetChild(1);
if (ita != NULL && eng != NULL)
{
ita = ita->GetChild(0);
eng = eng->GetChild(0);
if (ita != NULL && eng != NULL)
{
TDictionary* d = (TDictionary*)jolly;
d->AddEntry(ita->GetText(), eng->GetText());
}
}
}
return false;
}
bool TDictionary::Load()
{
wxFileInputStream inf("Campo.dic");
if (inf.Ok())
{
TXmlItem item;
item.Read(inf);
item.ForEach(FillCallback, (long)this);
}
m_bDirty = false; // No last minute additions :-)
return GetCount() > 0;
}
wxString TDictionary::Translate(const wxString& ita)
{
if (GetCount() == 0)
Load();
const wxString key = Accentuate(ita);
TDictionaryEntry* eng = (TDictionaryEntry*)Get(key);
if (eng != NULL)
{
if (eng->m_str != "???")
return eng->m_str;
}
else
AddEntry(ita, "???");
return key;
}
TDictionary::TDictionary() : wxHashTable(wxKEY_STRING, 883), m_bDirty(false)
{ }
TDictionary::~TDictionary()
{
DeleteContents(true);
if (m_bDirty)
{
wxFileOutputStream outf("Campo.dic");
outf << "<xml><dictionary>\n";
BeginFind();
for (wxNode* pNode = Next(); pNode != NULL; pNode = Next())
{
outf << " <entry>\n";
outf << " <ita>" << pNode->GetKeyString() << "</ita>\n";
outf << " <eng>" << ((TDictionaryEntry*)pNode->GetData())->m_str << "</eng>\n";
outf << " </entry>\n";
}
outf << "</dictionary></xml>\n";
}
}
bool DoTranslate(const TXmlItem& xmlMethod, TXmlItem& xmlAnswer)
{
const TXmlItem* xmlSentence = xmlMethod.FindFirst("sentence");
if (xmlSentence != NULL)
{
const TXmlItem* xmlItalian = xmlSentence->GetChild(0);
if (xmlItalian != NULL)
{
wxString result = DevotoOli.Translate(xmlItalian->GetText());
xmlAnswer.AddSoapString("sentence", result);
return true;
}
}
return false;
}

3
server/diction.h Executable file
View File

@ -0,0 +1,3 @@
bool DoTranslate(const TXmlItem& xmlMethod, TXmlItem& xmlAnswer);

BIN
server/mondrian.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

320
server/server.cpp Executable file
View File

@ -0,0 +1,320 @@
/////////////////////////////////////////////////////////////////////////////
// Name: server.cpp
// Purpose: Simple Soap Server
// Author: Guy
// Modified by:
// Created: 21/08/2002
// Copyright: (c) 2002 Guy
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ==========================================================================
// declarations
// ==========================================================================
// --------------------------------------------------------------------------
// headers
// --------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wx.h"
#include "wx/socket.h"
#include "soap.h"
// --------------------------------------------------------------------------
// classes
// --------------------------------------------------------------------------
// Define a new application type
class SoapServerApp : public wxApp
{
public:
virtual bool OnInit();
};
// Define a new frame type: this is going to be our main frame
class SoapFrame : public wxFrame
{
public:
SoapFrame();
~SoapFrame();
// event handlers (these functions should _not_ be virtual)
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnServerEvent(wxSocketEvent& event);
void OnSocketEvent(wxSocketEvent& event);
void ProcessSoapCommand(wxSocketBase *sock);
// convenience functions
void UpdateStatusBar();
private:
wxSocketServer *m_server;
wxTextCtrl *m_text;
wxMenu *m_menuFile;
wxMenuBar *m_menuBar;
bool m_busy;
int m_numClients;
// any class wishing to process wxWindows events must use this macro
DECLARE_EVENT_TABLE()
};
// --------------------------------------------------------------------------
// constants
// --------------------------------------------------------------------------
// IDs for the controls and the menu commands
enum
{
// menu items
SERVER_QUIT = 1000,
SERVER_ABOUT,
// id for sockets
SERVER_ID,
SOCKET_ID
};
// --------------------------------------------------------------------------
// event tables and other macros for wxWindows
// --------------------------------------------------------------------------
BEGIN_EVENT_TABLE(SoapFrame, wxFrame)
EVT_MENU(SERVER_QUIT, SoapFrame::OnQuit)
EVT_MENU(SERVER_ABOUT, SoapFrame::OnAbout)
EVT_SOCKET(SERVER_ID, SoapFrame::OnServerEvent)
EVT_SOCKET(SOCKET_ID, SoapFrame::OnSocketEvent)
END_EVENT_TABLE()
IMPLEMENT_APP(SoapServerApp)
// ==========================================================================
// implementation
// ==========================================================================
// --------------------------------------------------------------------------
// the application class
// --------------------------------------------------------------------------
bool SoapServerApp::OnInit()
{
// Create the main application window
SoapFrame *frame = new SoapFrame();
// Show it and tell the application that it's our main window
frame->Show(TRUE);
SetTopWindow(frame);
// Success
return TRUE;
}
// --------------------------------------------------------------------------
// main frame
// --------------------------------------------------------------------------
// frame constructor
SoapFrame::SoapFrame() : wxFrame((wxFrame *)NULL, -1,
_("Soap Server"),
wxDefaultPosition, wxSize(300, 200))
{
// Give the frame an icon
SetIcon(wxICON(mondrian));
// Make menus
m_menuFile = new wxMenu();
m_menuFile->Append(SERVER_ABOUT, _("&About...\tCtrl-A"), _("Show about dialog"));
m_menuFile->AppendSeparator();
m_menuFile->Append(SERVER_QUIT, _("E&xit\tAlt-X"), _("Quit server"));
// Append menus to the menubar
m_menuBar = new wxMenuBar();
m_menuBar->Append(m_menuFile, _("&File"));
SetMenuBar(m_menuBar);
// Status bar
CreateStatusBar(2);
// Make a textctrl for logging
m_text = new wxTextCtrl(this, -1,
_("Welcome to SOAP Server\n"),
wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxTE_READONLY);
// Create the address - defaults to localhost:0 initially
wxIPV4address addr;
addr.Service(3000);
// Create the socket
m_server = new wxSocketServer(addr);
// We use Ok() here to see if the server is really listening
if (! m_server->Ok())
{
m_text->AppendText(_("Could not listen at the specified port !\n\n"));
return;
}
else
{
m_text->AppendText(_("Server listening.\n\n"));
}
// Setup the event handler and subscribe to connection events
m_server->SetEventHandler(*this, SERVER_ID);
m_server->SetNotify(wxSOCKET_CONNECTION_FLAG);
m_server->Notify(TRUE);
m_busy = FALSE;
m_numClients = 0;
UpdateStatusBar();
}
SoapFrame::~SoapFrame()
{
// No delayed deletion here, as the frame is dying anyway
delete m_server;
}
// event handlers
void SoapFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
// TRUE is to force the frame to close
Close(TRUE);
}
void SoapFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxMessageBox(_("Soap Server\n(c) 2002 by Aga\n"),
_("About Soap Server"),
wxOK | wxICON_INFORMATION, this);
}
void SoapFrame::ProcessSoapCommand(wxSocketBase *sock)
{
m_text->SetValue(_("Processing begins\n\n"));
sock->SetFlags(wxSOCKET_NOWAIT);
// Read the data
char buf[4096]; memset(buf, 0, sizeof(buf));
unsigned int len = sock->Read(buf, sizeof(buf)).LastCount();
m_text->AppendText(_(buf));
wxString strAnswer = SoapProcessMessage(buf, len);
m_text->AppendText(_("\nSending response\n\n"));
m_text->AppendText(_(strAnswer));
// Write it back
sock->Write(strAnswer, strAnswer.Length());
m_text->AppendText(_("\n\nProcessing ends\n\n"));
}
void SoapFrame::OnServerEvent(wxSocketEvent& event)
{
wxString s = _("OnServerEvent: ");
wxSocketBase *sock;
switch(event.GetSocketEvent())
{
case wxSOCKET_CONNECTION : s.Append(_("wxSOCKET_CONNECTION\n")); break;
default : s.Append(_("Unexpected event !\n")); break;
}
m_text->AppendText(s);
// Accept new connection if there is one in the pending
// connections queue, else exit. We use Accept(FALSE) for
// non-blocking accept (although if we got here, there
// should ALWAYS be a pending connection).
sock = m_server->Accept(FALSE);
if (sock)
{
m_text->AppendText(_("New client connection accepted\n\n"));
}
else
{
m_text->AppendText(_("Error: couldn't accept a new connection\n\n"));
sock->Destroy();
return;
}
sock->SetEventHandler(*this, SOCKET_ID);
sock->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG);
sock->Notify(TRUE);
m_numClients++;
UpdateStatusBar();
}
void SoapFrame::OnSocketEvent(wxSocketEvent& event)
{
wxString s = _("OnSocketEvent: ");
wxSocketBase *sock = event.GetSocket();
// First, print a message
switch(event.GetSocketEvent())
{
case wxSOCKET_INPUT : s.Append(_("wxSOCKET_INPUT\n")); break;
case wxSOCKET_LOST : s.Append(_("wxSOCKET_LOST\n")); break;
default : s.Append(_("Unexpected event !\n")); break;
}
m_text->AppendText(s);
// Now we process the event
switch(event.GetSocketEvent())
{
case wxSOCKET_INPUT:
{
// We disable input events, so that the test doesn't trigger
// wxSocketEvent again.
sock->SetNotify(wxSOCKET_LOST_FLAG);
ProcessSoapCommand(sock);
// Enable input events again.
sock->SetNotify(wxSOCKET_LOST_FLAG | wxSOCKET_INPUT_FLAG);
break;
}
case wxSOCKET_LOST:
{
m_numClients--;
// Destroy() should be used instead of delete wherever possible,
// due to the fact that wxSocket uses 'delayed events' (see the
// documentation for wxPostEvent) and we don't want an event to
// arrive to the event handler (the frame, here) after the socket
// has been deleted. Also, we might be doing some other thing with
// the socket at the same time; for example, we might be in the
// middle of a test or something. Destroy() takes care of all
// this for us.
m_text->AppendText(_("Deleting socket.\n\n"));
sock->Destroy();
break;
}
default: ;
}
UpdateStatusBar();
}
// convenience functions
void SoapFrame::UpdateStatusBar()
{
wxString s;
s.Printf(_("%d clients connected"), m_numClients);
SetStatusText(s, 1);
}

3
server/server.rc Executable file
View File

@ -0,0 +1,3 @@
mondrian ICON "soap.ico"
#include "wx/msw/wx.rc"

445
server/soap.cpp Executable file
View File

@ -0,0 +1,445 @@
#include "wx/wx.h"
#include "wx/time.h"
#include "soap.h"
///////////////////////////////////////////////////////////
// Utility
///////////////////////////////////////////////////////////
wxOutputStream& operator<<(wxOutputStream& outf, const wxChar* str)
{
if (str && *str)
outf.Write(str, wxStrlen(str));
return outf;
}
wxOutputStream& operator<<(wxOutputStream& outf, const wxString str)
{
if (!str.IsEmpty())
outf.Write(str, str.Length());
return outf;
}
void Spaces(wxOutputStream& outf, int nSpaces)
{
outf << "\n";
if (nSpaces > 0)
{
wxString str;
str.Append(' ', nSpaces);
outf << str;
}
}
///////////////////////////////////////////////////////////
// TXmlAttr
///////////////////////////////////////////////////////////
class TXmlAttr : public wxObject
{
public:
wxString m_str;
void Write(wxOutputStream& outf) const;
TXmlAttr(const wxChar* str) : m_str(str) { }
};
void TXmlAttr::Write(wxOutputStream& outf) const
{
if (m_str.IsNumber())
outf << m_str;
else
outf << "\"" << m_str << "\"";
}
///////////////////////////////////////////////////////////
// TXmlItem
///////////////////////////////////////////////////////////
void TXmlItem::SetAttr(const wxChar* strAttr, const wxChar* strVal)
{
if (m_Attributes == NULL)
{
m_Attributes = new wxHashTable(wxKEY_STRING, 17);
m_Attributes->DeleteContents(true);
}
m_Attributes->Delete(strAttr);
m_Attributes->Put(strAttr, new TXmlAttr(strVal));
}
wxString TXmlItem::GetAttr(const wxChar* strAttr) const
{
wxString strResult;
if (m_Attributes != NULL)
{
const TXmlAttr* str = (const TXmlAttr*)m_Attributes->Get(strAttr);
if (str != NULL)
strResult = str->m_str;
}
return strResult;
}
int TXmlItem::GetChildren() const
{
int n = 0;
if (m_Children != NULL)
n = m_Children->GetCount();
return n;
}
TXmlItem* TXmlItem::GetChild(size_t n) const
{
TXmlItem* i = NULL;
if (m_Children != NULL && n < m_Children->GetCount())
{
wxNode* pNode = m_Children->Item(n);
if (pNode != NULL)
i = (TXmlItem*)pNode->GetData();
}
return i;
}
wxString TXmlItem::GetWord(wxInputStream& inf) const
{
wxString str;
int cFirstChar = EOF;
while (!inf.Eof())
{
cFirstChar = inf.GetC();
if (cFirstChar <= 0 || cFirstChar > ' ')
break;
}
if (cFirstChar == EOF)
return str;
const bool bIsString = cFirstChar == '"' || cFirstChar == '\'';
if (bIsString)
str = "";
else
{
str = char(cFirstChar);
if (strchr("<=/>", cFirstChar))
return str; // Simboli terminali
}
while (!inf.Eof())
{
int c = inf.GetC();
if (bIsString)
{
if (c == cFirstChar)
break;
if (c >= '\0' && c <= ' ')
c = ' ';
str += char(c);
}
else
{
if (c >= '\0' && c <= ' ')
break;
if (strchr("<=/>", c))
{
inf.Ungetch(char(c));
break;
}
str += char(c);
}
}
return str;
}
int TXmlItem::ReadTag(wxInputStream& inf)
{
wxString str = GetWord(inf);
if (str.IsEmpty())
return -1;
if (str[0] != '<') // No tag = sequence of words
{
bool bFirstChar = true;
while (!inf.Eof())
{
const wxChar c = inf.GetC();
if (c == '<')
{
inf.Ungetch(c);
break;
}
if (bFirstChar)
{
str << ' ';
bFirstChar = false;
}
str << c;
}
SetTag("");
SetText(str);
return 0;
}
bool bChildrenFollow = true;
m_strTag = GetWord(inf);
if (m_strTag == "/") // Sto leggendo un tag di chiusura del tipo </SOAP-ENV>
{
bChildrenFollow = false;
m_strTag += GetWord(inf);
}
wxString name = GetWord(inf);
while (!name.IsEmpty())
{
if (name[0] == '>')
return bChildrenFollow ? +1 : 0;
if (name[0] == '/')
{
bChildrenFollow = false;
continue;
}
// Ho letto un nome di attributo
wxString str = GetWord(inf);
if (str.IsEmpty() || str[0] != '=')
break;
// Leggo il valore dell'attributo
str = GetWord(inf);
SetAttr(name, str);
name = GetWord(inf);
}
return -1;
}
TXmlItem& TXmlItem::AddChild(TXmlItem* pItem)
{
if (m_Children == NULL)
{
m_Children = new wxList;
m_Children->DeleteContents(true);
}
if (pItem == NULL)
pItem = new TXmlItem;
m_Children->Append(pItem);
return *pItem;
}
TXmlItem& TXmlItem::AddChild(const wxChar* strTagName)
{
TXmlItem& i = AddChild((TXmlItem*)NULL);
i.SetTag(strTagName);
return i;
}
TXmlItem& TXmlItem::AddSoapString(const wxChar* name, const wxChar* value)
{
TXmlItem& xmlVar = AddChild(name);
xmlVar.SetAttr("xsi:type", "xsd:string");
xmlVar.AddChild("").SetText(value);
return xmlVar;
}
TXmlItem& TXmlItem::AddSoapInt(const wxChar* name, int value)
{
TXmlItem& xmlVar = AddChild(name);
xmlVar.SetAttr("xsi:type", "xsd:int");
wxString str; str += value;
xmlVar.AddChild("").SetText(str);
return xmlVar;
}
void TXmlItem::RemoveLastChild()
{
if (m_Children != NULL)
{
wxNode* n = m_Children->GetLast();
if (n != NULL)
m_Children->DeleteNode(n);
}
}
bool TXmlItem::Read(wxInputStream& inf)
{
const int res = ReadTag(inf);
if (res > 0) // There are children ahead
{
while (!inf.Eof())
{
TXmlItem& item = AddChild("/"); // Add dummy child
if (item.Read(inf))
{
if (item.m_strTag[0] == '/')
break;
}
else
break;
}
RemoveLastChild(); // Remove dummy child
}
return res >= 0;
}
TXmlItem* TXmlItem::ForEach(XmlItemCallback cb, long jolly)
{
if (cb(*this, jolly))
return this;
for (int n = 0; ; n++)
{
TXmlItem* c = GetChild(n);
if (c == NULL)
break;
c = c->ForEach(cb, jolly);
if (c)
return c;
}
return NULL;
}
void TXmlItem::Write(wxOutputStream& outf, int tab) const
{
if (!GetTag().IsEmpty())
{
Spaces(outf, tab);
outf << "<" << GetTag();
if (m_Attributes != NULL)
{
m_Attributes->BeginFind();
for (wxNode* pNode = m_Attributes->Next(); pNode; pNode = m_Attributes->Next())
{
outf << " " << pNode->GetKeyString() << "=";
const TXmlAttr* attr = (const TXmlAttr*)pNode->GetData();
attr->Write(outf);
}
}
if (GetChildren() > 0)
{
outf << ">";
for (int n = 0; ; n++)
{
TXmlItem* c = GetChild(n);
if (c == NULL)
break;
c->Write(outf, tab+1);
}
if (GetChild(n-1)->GetText().IsEmpty())
Spaces(outf, tab);
outf << "</" << GetTag() << ">";
}
else
outf << " />";
}
else
outf << GetText();
}
wxString TXmlItem::AsString() const
{
wxString str;
for (size_t nSize = 8192; ; nSize *= 2)
{
char* buf = str.GetWriteBuf(nSize);
memset(buf, 0, nSize);
wxMemoryOutputStream outf(buf, nSize);
// outf << "<?xml Version=\"1.0\" ?>"; // Non dovrebbe servire a nulla
Write(outf);
str.UngetWriteBuf();
if (buf[nSize-1] == '\0')
break;
}
return str;
}
bool FindFirstCallback(TXmlItem& item, long jolly)
{
const wxChar* strTag = (const wxChar*)jolly;
return item.GetTag() == strTag;
}
TXmlItem* TXmlItem::FindFirst(const wxChar* strTag) const
{
return ((TXmlItem*)this)->ForEach(FindFirstCallback, (long)strTag);
}
TXmlItem::TXmlItem()
: m_Attributes(NULL), m_Children(NULL)
{ }
TXmlItem::~TXmlItem()
{
if (m_Attributes)
delete m_Attributes;
if (m_Children)
delete m_Children;
}
///////////////////////////////////////////////////////////
// SoapProcess*
///////////////////////////////////////////////////////////
#include "Diction.h"
bool SoapProcessMethod(const TXmlItem& xmlMethod, TXmlItem& xmlAnswer)
{
const wxString& strMethod = xmlMethod.GetTag();
if (strMethod == "m:Translate")
return DoTranslate(xmlMethod, xmlAnswer);
return false;
}
wxString SoapProcessMessage(const char* buf, unsigned int len)
{
TXmlItem xmlEnvelope;
xmlEnvelope.SetTag("SOAP-ENV:Envelope");
TXmlItem& xmlBody = xmlEnvelope.AddChild("SOAP-ENV:Body");
const char* soapstart = strstr(buf, "<SOAP-ENV:");
if (soapstart != NULL)
{
const int soaplen = len - (soapstart - buf);
wxMemoryInputStream input(soapstart, soaplen);
TXmlItem query;
if (query.Read(input))
{
const TXmlItem* pxmlBody = query.FindFirst("SOAP-ENV:Body");
if (pxmlBody != NULL) for (int m = 0; ; m++)
{
const TXmlItem* pxmlMethod = pxmlBody->GetChild(m);
if (pxmlMethod == NULL)
break;
if (pxmlMethod->GetTag().StartsWith("m:"))
{
wxString str;
str = pxmlMethod->GetTag(); str += "Result";
TXmlItem& xmlAnswer = xmlBody.AddChild(str);
SoapProcessMethod(*pxmlMethod, xmlAnswer);
}
}
}
}
const wxString strResult = xmlEnvelope.AsString();
wxChar strLength[16]; sprintf(strLength, "%d", strResult.Length());
wxString strAnswer;
strAnswer += "HTTP/1.1 200 OK\n";
strAnswer += "Connection: close\n";
strAnswer += "Content-Length: "; strAnswer += strLength;
strAnswer += "\nContent-Type: text/xml; charset=utf-8\n";
strAnswer += "Date: ";
strAnswer += wxDateTime::Now().Format("%#c");
strAnswer += "\nServer: ";
strAnswer += wxGetHostName();
strAnswer += "\r\n\r\n";
strAnswer += strResult;
return strAnswer;
}

58
server/soap.h Executable file
View File

@ -0,0 +1,58 @@
#ifndef __SOAP_H
#define __SOAP_H
#ifndef _WX_WXMMSTREAM_H__
#include "wx/mstream.h"
#endif
class TXmlItem;
typedef bool (*XmlItemCallback)(TXmlItem& item, long jolly);
class TXmlItem : public wxObject
{
wxString m_strTag, m_strText;
wxHashTable* m_Attributes;
wxList* m_Children;
protected:
wxString GetWord(wxInputStream& input) const;
int ReadTag(wxInputStream& input);
TXmlItem& AddChild(TXmlItem* pItem);
void RemoveLastChild();
public:
const wxString& GetTag() const { return m_strTag; }
void SetTag(const wxChar* strTag) { m_strTag = strTag; }
const wxString& GetText() const { return m_strText; }
void SetText(const wxChar* str) { m_strText = str; }
void SetAttr(const wxChar* strAttr, const wxChar* strVal);
wxString GetAttr(const wxChar* strAttr) const;
TXmlItem& AddChild(const wxChar* strTag);
TXmlItem& AddSoapString(const wxChar* name, const wxChar* value);
TXmlItem& AddSoapInt(const wxChar* name, int value);
int GetChildren() const;
TXmlItem* GetChild(size_t n) const;
bool Read(wxInputStream& input);
void Write(wxOutputStream& output, int nTab = 0) const;
wxString AsString() const;
TXmlItem* ForEach(XmlItemCallback cb, long jolly = 0);
TXmlItem* FindFirst(const wxChar* strTag) const;
TXmlItem();
~TXmlItem();
};
wxOutputStream& operator<<(wxOutputStream& outf, const wxChar* str);
wxOutputStream& operator<<(wxOutputStream& outf, const wxString str);
wxString SoapProcessMessage(const char* buf, const unsigned int len);
#endif

BIN
server/soap.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

213
server/soapserv.dsp Executable file
View File

@ -0,0 +1,213 @@
# Microsoft Developer Studio Project File - Name="SoapServ" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=SoapServ - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "SoapServ.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "SoapServ.mak" CFG="SoapServ - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "SoapServ - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "SoapServ - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "SoapServ - Win32 Debug DLL" (based on "Win32 (x86) Application")
!MESSAGE "SoapServ - Win32 Release DLL" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "SoapServ - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../include" /I "../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib xpm.lib png.lib zlib.lib jpeg.lib tiff.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"Release/server.exe" /libpath:"../../lib" /libpath:"../../contrib/lib"
!ELSEIF "$(CFG)" == "SoapServ - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "\wx229\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FR /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib xpmd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"Debug/server.exe" /pdbtype:sept /libpath:"/wx229/lib"
!ELSEIF "$(CFG)" == "SoapServ - Win32 Debug DLL"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "DebugDLL"
# PROP BASE Intermediate_Dir "DebugDLL"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "DebugDLL"
# PROP Intermediate_Dir "DebugDLL"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /I "../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /Yu"wx/wxprec.h" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx22_9d.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /out:"DebugDLL/server.exe" /pdbtype:sept /libpath:"../../lib" /libpath:"../../contrib/lib"
!ELSEIF "$(CFG)" == "SoapServ - Win32 Release DLL"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseDLL"
# PROP BASE Intermediate_Dir "ReleaseDLL"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseDLL"
# PROP Intermediate_Dir "ReleaseDLL"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../include" /I "../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx22_9.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /out:"ReleaseDLL/server.exe" /libpath:"../../lib" /libpath:"../../contrib/lib"
!ENDIF
# Begin Target
# Name "SoapServ - Win32 Release"
# Name "SoapServ - Win32 Debug"
# Name "SoapServ - Win32 Debug DLL"
# Name "SoapServ - Win32 Release DLL"
# Begin Source File
SOURCE=.\Diction.cpp
# End Source File
# Begin Source File
SOURCE=.\Diction.h
# End Source File
# Begin Source File
SOURCE=.\server.cpp
!IF "$(CFG)" == "SoapServ - Win32 Release"
!ELSEIF "$(CFG)" == "SoapServ - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "SoapServ - Win32 Debug DLL"
# SUBTRACT BASE CPP /YX /Yc /Yu
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "SoapServ - Win32 Release DLL"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\server.rc
!IF "$(CFG)" == "SoapServ - Win32 Release"
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809 /i "../../include" /i "../../contrib/include"
!ELSEIF "$(CFG)" == "SoapServ - Win32 Debug"
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809 /i /wx229/include" "
!ELSEIF "$(CFG)" == "SoapServ - Win32 Debug DLL"
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809 /i "../../include" /i "../../contrib/include"
!ELSEIF "$(CFG)" == "SoapServ - Win32 Release DLL"
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809 /i "../../include" /i "../../contrib/include"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\soap.cpp
# End Source File
# Begin Source File
SOURCE=.\soap.h
# End Source File
# End Target
# End Project

29
server/soapserv.dsw Executable file
View File

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "SoapServ"=.\SoapServ.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

1
server/soapserv.ncb Executable file
View File

@ -0,0 +1 @@
Microsoft C/C++ program database 2.00

BIN
server/soapserv.opt Executable file

Binary file not shown.

38
server/soapserv.plg Executable file
View File

@ -0,0 +1,38 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: SoapServ - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "c:\temp\RSPA1C2.TMP" with contents
[
/nologo /MTd /W3 /Gm /GX /ZI /Od /I "\wx229\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FR"Debug/" /Fo"Debug/" /Fd"Debug/" /FD /c
"C:\U\GUY\R020200\SOAP\server.cpp"
]
Creating command line "cl.exe @c:\temp\RSPA1C2.TMP"
Creating temporary file "c:\temp\RSPA1C3.TMP" with contents
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib xpmd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/server.pdb" /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"Debug/server.exe" /pdbtype:sept /libpath:"/wx229/lib"
.\Debug\Diction.obj
.\Debug\server.obj
.\Debug\soap.obj
.\Debug\server.res
]
Creating command line "link.exe @c:\temp\RSPA1C3.TMP"
<h3>Output Window</h3>
Compiling...
server.cpp
Linking...
Creating command line "bscmake.exe /nologo /o"Debug/SoapServ.bsc" .\Debug\Diction.sbr .\Debug\server.sbr .\Debug\soap.sbr"
Creating browse info file...
<h3>Output Window</h3>
<h3>Results</h3>
server.exe - 0 error(s), 0 warning(s)
</pre>
</body>
</html>