From: Thomas H. <pol...@us...> - 2006-02-25 21:36:25
|
Update of /cvsroot/smartwin/SmartWin/SmartSOAP/SmartSOAP In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18233/SmartSOAP/SmartSOAP Modified Files: DateTime.h SmartSOAP.vcproj SmartSockets.h SmartUtilities.h SoapResponse.h TcpStream.cpp TcpStream.h XmlDocument.cpp XmlDocument.h XmlNode.h tstring.h Log Message: Index: SoapResponse.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/SmartSOAP/SmartSOAP/SoapResponse.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- SoapResponse.h 12 Feb 2006 15:49:52 -0000 1.4 +++ SoapResponse.h 25 Feb 2006 21:36:18 -0000 1.5 @@ -55,11 +55,13 @@ std::stringstream ss; ss << itsHttpResponse.getContentRaw(); ss.seekg(0); - XmlDocument doc(ss); - XmlNode & soapFault = doc.getDocumentNode()[0][0]; - if( soapFault.getName() == "Fault" ) + std::basic_stringstream<TCHAR> ssWide; + SmartUtilities::Utilities::convertStream( ss, ssWide ); + SmartXML::XmlDocument doc(ssWide); + SmartXML::XmlNode & soapFault = doc.getDocumentNode()[0][0]; + if( soapFault.getName() == _T("Fault") ) { - throw xCeptionSoap( soapFault[1].getContent() ); + throw xCeptionSoap( SmartUtilities::AsciiGuaranteed::doConvert(soapFault[1].getContent()) ); } } Index: TcpStream.cpp =================================================================== RCS file: /cvsroot/smartwin/SmartWin/SmartSOAP/SmartSOAP/TcpStream.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- TcpStream.cpp 13 Feb 2006 13:03:01 -0000 1.5 +++ TcpStream.cpp 25 Feb 2006 21:36:18 -0000 1.6 @@ -38,21 +38,21 @@ std::map<int, SOCKET> SocketState::itsListenSockets; TcpStream::TcpStream( int port ) - : std::basic_iostream<TCHAR>( &itsTcpStreamBuffer ) + : std::iostream( &itsTcpStreamBuffer ) { unsetf( ios_base::skipws ); itsTcpStreamBuffer.serverInit( port ); } TcpStream::TcpStream( long serverIpAddress, int port ) - : std::basic_iostream<TCHAR>( &itsTcpStreamBuffer ) + : std::iostream( &itsTcpStreamBuffer ) { unsetf( ios_base::skipws ); itsTcpStreamBuffer.clientInit( serverIpAddress, port ); } TcpStream::TcpStream( std::string serverIpAddress, int port ) - : std::basic_iostream<TCHAR>( &itsTcpStreamBuffer ) + : std::iostream( &itsTcpStreamBuffer ) { long ipAddress = ntohl( inet_addr( serverIpAddress.c_str() ) ); if( -1 == ipAddress ) Index: DateTime.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/SmartSOAP/SmartSOAP/DateTime.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- DateTime.h 13 Feb 2006 08:39:02 -0000 1.2 +++ DateTime.h 25 Feb 2006 21:36:18 -0000 1.3 @@ -69,9 +69,9 @@ bool operator > ( const DateTime & lhs, const DateTime & rhs ); - inline bool operator < ( const DateTime & lhs, const DateTime & rhs ); + bool operator < ( const DateTime & lhs, const DateTime & rhs ); - inline bool operator == ( const DateTime & lhs, const DateTime & rhs ); + bool operator == ( const DateTime & lhs, const DateTime & rhs ); } Index: TcpStream.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/SmartSOAP/SmartSOAP/TcpStream.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TcpStream.h 12 Feb 2006 15:49:52 -0000 1.3 +++ TcpStream.h 25 Feb 2006 21:36:18 -0000 1.4 @@ -29,7 +29,11 @@ #define TcpStream_H // Linking to the required library +#ifndef WINCE #pragma comment( lib, "wsock32.lib" ) +#else +#pragma comment( lib, "Ws2.lib" ) +#endif #include <string> #include <iostream> Index: XmlDocument.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/SmartSOAP/SmartSOAP/XmlDocument.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- XmlDocument.h 13 Feb 2006 13:03:01 -0000 1.3 +++ XmlDocument.h 25 Feb 2006 21:36:18 -0000 1.4 @@ -58,6 +58,7 @@ XmlDocument( const XmlNode & documentNode, const SmartUtilities::tstring & version = _T("1.0"), const SmartUtilities::tstring & encoding = _T("utf-8") ); XmlDocument( std::basic_istream<TCHAR> & stream ); XmlNode & getDocumentNode(); + SmartUtilities::tstring toString() const; }; } Index: SmartSockets.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/SmartSOAP/SmartSOAP/SmartSockets.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SmartSockets.h 11 Feb 2006 19:18:16 -0000 1.1 +++ SmartSockets.h 25 Feb 2006 21:36:18 -0000 1.2 @@ -1,7 +1,7 @@ #ifndef SmartSockets_H #define SmartSockets_H -#include <Winsock.h> +#include <Winsock2.h> #include <string> namespace SmartUtil Index: SmartSOAP.vcproj =================================================================== RCS file: /cvsroot/smartwin/SmartWin/SmartSOAP/SmartSOAP/SmartSOAP.vcproj,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- SmartSOAP.vcproj 13 Feb 2006 13:03:01 -0000 1.8 +++ SmartSOAP.vcproj 25 Feb 2006 21:36:18 -0000 1.9 @@ -205,6 +205,9 @@ RelativePath=".\SmartUtilities.h"> </File> <File + RelativePath=".\StringConversion.h"> + </File> + <File RelativePath=".\TimeSpan.h"> </File> <File Index: tstring.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/SmartSOAP/SmartSOAP/tstring.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- tstring.h 13 Feb 2006 08:39:02 -0000 1.1 +++ tstring.h 25 Feb 2006 21:36:18 -0000 1.2 @@ -25,8 +25,8 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SmartString_h -#define SmartString_h +#ifndef tstring_h +#define tstring_h #include <string> #include "tchar.h" Index: XmlNode.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/SmartSOAP/SmartSOAP/XmlNode.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- XmlNode.h 13 Feb 2006 13:03:01 -0000 1.5 +++ XmlNode.h 25 Feb 2006 21:36:18 -0000 1.6 @@ -88,6 +88,7 @@ XmlNode & addAttribute( const XmlAttribute & attribute ); XmlNode & addNamespace( const XmlNamespace & nameSpace ); XmlNode & operator[] ( size_t idx ); + size_t getChildrenCount() const { return itsChildren.size(); } const XmlNode & operator[] ( size_t idx ) const; }; } Index: XmlDocument.cpp =================================================================== RCS file: /cvsroot/smartwin/SmartWin/SmartSOAP/SmartSOAP/XmlDocument.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- XmlDocument.cpp 13 Feb 2006 13:03:01 -0000 1.5 +++ XmlDocument.cpp 25 Feb 2006 21:36:18 -0000 1.6 @@ -29,6 +29,7 @@ #include <string> #include <memory> #include <iostream> +#include <sstream> #include <tchar.h> #include "XmlDocument.h" #include "XmlAttribute.h" @@ -176,13 +177,16 @@ } } std::auto_ptr<XmlNode> retVal = parseNode( nodeBuffer, contentBuffer ); - while( true ) + if( nodeBuffer.substr(nodeBuffer.size()-2) != _T("/>") ) // Only check for children if node isn't closed immediately!! { - std::auto_ptr<XmlNode> retValChild = loadNodes( stream ); - if( retValChild.get() ) - retVal->addChild( *retValChild ); - else - break; + while( true ) + { + std::auto_ptr<XmlNode> retValChild = loadNodes( stream ); + if( retValChild.get() ) + retVal->addChild( *retValChild ); + else + break; + } } return retVal; } @@ -263,4 +267,12 @@ WriterHelper::writeNode( document.itsDocumentNode, stream ); return stream; } + +SmartUtilities::tstring XmlDocument::toString() const +{ + std::basic_stringstream<TCHAR> ss; + ss << *this; + return ss.str(); +} + } Index: SmartUtilities.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/SmartSOAP/SmartSOAP/SmartUtilities.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SmartUtilities.h 13 Feb 2006 13:03:01 -0000 1.1 +++ SmartUtilities.h 25 Feb 2006 21:36:18 -0000 1.2 @@ -31,5 +31,27 @@ #include "DateTime.h" #include "TimeSpan.h" #include "tstring.h" +#include "StringConversion.h" + +namespace SmartUtilities +{ + + class Utilities + { + public: + static void convertStream(std::iostream & fromStream, std::basic_iostream<TCHAR> & toStream ) + { + while( true ) + { + std::string tmp; + std::getline(fromStream, tmp); + SmartUtilities::tstring insertion = SmartUtilities::Ascii2CurrentBuild::doConvert(tmp); + toStream << insertion << std::endl; + if( fromStream.eof() ) + break; + } + } + }; +} #endif |