SOAP封装本质上是一种特殊的XML封装,在.NET中使用XmlTextWriter可以很方便的构造XML文本流。 所以,本文首先实现SoapWriter类,然后再提供对象的SOAP封装范例。 class SoapWriter { public: SoapWriter(size_t nTabOffset = 0); virtual ~PMESoapWriter(); public: // 以下函数中的name为空时,将使用类型名称作为元素名 void WriteBool(SoapBoolean value, const char* name = 0, const char* xmlns = 0); void WriteChar(SoapChar value, const char* name = 0, const char* xmlns = 0); void WriteShort(SoapShort value, const char* name = 0, const char* xmlns = 0); void WriteInt32(SoapInt32 value, const char* name = 0, const char* xmlns = 0); void WriteInt64(SoapInt64 value, const char* name = 0, const char* xmlns = 0); void WriteFloat(SoapFloat value, const char* name = 0, const char* xmlns = 0); void WriteDouble(SoapDouble value, const char* name = 0, const char* xmlns = 0); void WriteString(SoapString