BUG#: 7610
authorkumpf <kumpf>
Tue, 29 Apr 2008 20:40:16 +0000 (20:40 +0000)
committerkumpf <kumpf>
Tue, 29 Apr 2008 20:40:16 +0000 (20:40 +0000)
TITLE: PEP 311 WS-Management Support in CIM Server
DESCRIPTION: Implement WS-Management protocol for WS-Transfer operations.

147 files changed:
mak/config.mak
src/Clients/wbemexec/HttpConstants.h
src/Clients/wbemexec/WbemExecCommand.cpp
src/Clients/wbemexec/XMLProcess.cpp
src/Pegasus/Common/TraceComponents.h
src/Pegasus/Common/XmlGenerator.cpp
src/Pegasus/Common/XmlParser.cpp
src/Pegasus/Common/XmlParser.h
src/Pegasus/Common/tests/XmlParser/XmlParser.cpp
src/Pegasus/Makefile
src/Pegasus/Server/CIMServer.cpp
src/Pegasus/Server/CIMServer.h
src/Pegasus/Server/HTTPAuthenticatorDelegator.cpp
src/Pegasus/Server/HTTPAuthenticatorDelegator.h
src/Pegasus/Server/Makefile
src/Pegasus/WsmServer/CimToWsmResponseMapper.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/CimToWsmResponseMapper.h [new file with mode: 0644]
src/Pegasus/WsmServer/Linkage.h [new file with mode: 0644]
src/Pegasus/WsmServer/Makefile [new file with mode: 0644]
src/Pegasus/WsmServer/WsmConstants.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/WsmConstants.h [new file with mode: 0644]
src/Pegasus/WsmServer/WsmEndpointReference.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/WsmEndpointReference.h [new file with mode: 0644]
src/Pegasus/WsmServer/WsmFault.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/WsmFault.h [new file with mode: 0644]
src/Pegasus/WsmServer/WsmInstance.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/WsmInstance.h [new file with mode: 0644]
src/Pegasus/WsmServer/WsmProcessor.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/WsmProcessor.h [new file with mode: 0644]
src/Pegasus/WsmServer/WsmProperty.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/WsmProperty.h [new file with mode: 0644]
src/Pegasus/WsmServer/WsmReader.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/WsmReader.h [new file with mode: 0644]
src/Pegasus/WsmServer/WsmRequest.h [new file with mode: 0644]
src/Pegasus/WsmServer/WsmRequestDecoder.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/WsmRequestDecoder.h [new file with mode: 0644]
src/Pegasus/WsmServer/WsmResponse.h [new file with mode: 0644]
src/Pegasus/WsmServer/WsmResponseEncoder.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/WsmResponseEncoder.h [new file with mode: 0644]
src/Pegasus/WsmServer/WsmSelectorSet.h [new file with mode: 0644]
src/Pegasus/WsmServer/WsmToCimRequestMapper.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/WsmToCimRequestMapper.h [new file with mode: 0644]
src/Pegasus/WsmServer/WsmUtils.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/WsmUtils.h [new file with mode: 0644]
src/Pegasus/WsmServer/WsmValue.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/WsmValue.h [new file with mode: 0644]
src/Pegasus/WsmServer/WsmWriter.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/WsmWriter.h [new file with mode: 0644]
src/Pegasus/WsmServer/tests/CimToWsmMapper/CimToWsmMapper.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/tests/CimToWsmMapper/Makefile [new file with mode: 0644]
src/Pegasus/WsmServer/tests/Makefile [new file with mode: 0644]
src/Pegasus/WsmServer/tests/WsmReader/Makefile [new file with mode: 0644]
src/Pegasus/WsmServer/tests/WsmReader/WsmReader.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/tests/WsmReader/headers.xml [new file with mode: 0644]
src/Pegasus/WsmServer/tests/WsmReader/instances.xml [new file with mode: 0644]
src/Pegasus/WsmServer/tests/WsmReader/properties.xml [new file with mode: 0644]
src/Pegasus/WsmServer/tests/WsmReader/selectors.xml [new file with mode: 0644]
src/Pegasus/WsmServer/tests/WsmToCimMapper/Makefile [new file with mode: 0644]
src/Pegasus/WsmServer/tests/WsmToCimMapper/WsmToCimMapper.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/tests/WsmValue/Makefile [new file with mode: 0644]
src/Pegasus/WsmServer/tests/WsmValue/WsmValue.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/tests/WsmWriter/Makefile [new file with mode: 0644]
src/Pegasus/WsmServer/tests/WsmWriter/WsmWriter.cpp [new file with mode: 0644]
src/Pegasus/WsmServer/tests/libraries.mak [new file with mode: 0644]
src/Pegasus/msg/Server/pegasusServer_en.txt
src/Providers/TestProviders/PG_TestPropertyTypes/PG_TestPropertyTypes.cpp
src/Server/Makefile
test/wetest/Makefile
test/wetest/wsman/Create/Create_InvalidClass01.xml [new file with mode: 0644]
test/wetest/wsman/Create/Create_InvalidClass01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Create/Create_InvalidKeyName01.xml [new file with mode: 0644]
test/wetest/wsman/Create/Create_InvalidKeyName01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Create/Create_InvalidNamespace01.xml [new file with mode: 0644]
test/wetest/wsman/Create/Create_InvalidNamespace01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Create/Create_InvalidPropertyName01.xml [new file with mode: 0644]
test/wetest/wsman/Create/Create_InvalidPropertyName01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Create/Create_InvalidPropertyValue01.xml [new file with mode: 0644]
test/wetest/wsman/Create/Create_InvalidPropertyValue01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Create/Create_Success01.xml [new file with mode: 0644]
test/wetest/wsman/Create/Create_Success01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Create/Makefile [new file with mode: 0644]
test/wetest/wsman/Delete/Delete_InvalidKeyName01.xml [new file with mode: 0644]
test/wetest/wsman/Delete/Delete_InvalidKeyName01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Delete/Delete_NotFound01.xml [new file with mode: 0644]
test/wetest/wsman/Delete/Delete_NotFound01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Delete/Delete_Success01.xml [new file with mode: 0644]
test/wetest/wsman/Delete/Delete_Success01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Delete/Makefile [new file with mode: 0644]
test/wetest/wsman/Get/Get_InvalidClass01.xml [new file with mode: 0644]
test/wetest/wsman/Get/Get_InvalidClass01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Get/Get_InvalidKeyName01.xml [new file with mode: 0644]
test/wetest/wsman/Get/Get_InvalidKeyName01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Get/Get_InvalidNamespace01.xml [new file with mode: 0644]
test/wetest/wsman/Get/Get_InvalidNamespace01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Get/Get_NotFound01.xml [new file with mode: 0644]
test/wetest/wsman/Get/Get_NotFound01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Get/Get_Success01.xml [new file with mode: 0644]
test/wetest/wsman/Get/Get_Success01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Get/Makefile [new file with mode: 0644]
test/wetest/wsman/HttpHeader/ContentTypeCharsetUnsupported01.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/ContentTypeCharsetUnsupported01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/ContentTypeMissing01.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/ContentTypeMissing01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/ContentTypeTextXml01.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/ContentTypeTextXml01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/ContentTypeUnparsable01.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/ContentTypeUnparsable01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/ContentTypeUnsupported01.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/ContentTypeUnsupported01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/HostMissing01.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/HostMissing01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/Http1_0Post01.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/Http1_0Post01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/Http1_1MPost01.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/Http1_1MPost01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/Makefile [new file with mode: 0644]
test/wetest/wsman/HttpHeader/SOAPActionCorrect01.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/SOAPActionCorrect01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/SOAPActionCorrectQuoted01.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/SOAPActionCorrectQuoted01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/SOAPActionIncorrect01.xml [new file with mode: 0644]
test/wetest/wsman/HttpHeader/SOAPActionIncorrect01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Makefile [new file with mode: 0644]
test/wetest/wsman/Put/Makefile [new file with mode: 0644]
test/wetest/wsman/Put/Put_InvalidParameter01.xml [new file with mode: 0644]
test/wetest/wsman/Put/Put_InvalidParameter01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Put/Put_NotFound01.xml [new file with mode: 0644]
test/wetest/wsman/Put/Put_NotFound01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Put/Put_Success01.xml [new file with mode: 0644]
test/wetest/wsman/Put/Put_Success01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/Put/Put_Success02.xml [new file with mode: 0644]
test/wetest/wsman/Put/Put_Success02rspgood.xml [new file with mode: 0644]
test/wetest/wsman/SoapHeader/ActionMissing01.xml [new file with mode: 0644]
test/wetest/wsman/SoapHeader/ActionMissing01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/SoapHeader/ActionUnsupported01.xml [new file with mode: 0644]
test/wetest/wsman/SoapHeader/ActionUnsupported01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/SoapHeader/FaultToUnsupported01.xml [new file with mode: 0644]
test/wetest/wsman/SoapHeader/FaultToUnsupported01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/SoapHeader/FragmentLevelAccess01.xml [new file with mode: 0644]
test/wetest/wsman/SoapHeader/FragmentLevelAccess01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/SoapHeader/HeaderNotUnderstood01.xml [new file with mode: 0644]
test/wetest/wsman/SoapHeader/HeaderNotUnderstood01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/SoapHeader/Makefile [new file with mode: 0644]
test/wetest/wsman/SoapHeader/ReplyToUnsupported01.xml [new file with mode: 0644]
test/wetest/wsman/SoapHeader/ReplyToUnsupported01rspgood.xml [new file with mode: 0644]
test/wetest/wsman/SoapHeader/XmlSyntaxInvalid01.xml [new file with mode: 0644]
test/wetest/wsman/SoapHeader/XmlSyntaxInvalid01rspgood.xml [new file with mode: 0644]

index 8aa4b6c672a98ed6ab137fd4a0e5841c777aa81b..29b116a2ebf386e1b62e4812cab4fc7c2fe95390 100644 (file)
@@ -1078,6 +1078,28 @@ ifdef PEGASUS_ENABLE_PRIVILEGE_SEPARATION
   DEFINES += -DPEGASUS_CIMSERVERMAIN_USER=\"$(PEGASUS_CIMSERVERMAIN_USER)\"
 endif
 
+
+##==============================================================================
+##
+## PEGASUS_ENABLE_PROTOCOL_WSMAN
+##
+##     Enables the WS-Management protocol in the CIM Server.
+##
+##==============================================================================
+
+ifndef PEGASUS_ENABLE_PROTOCOL_WSMAN
+    PEGASUS_ENABLE_PROTOCOL_WSMAN = false
+endif
+
+ifeq ($(PEGASUS_ENABLE_PROTOCOL_WSMAN),true)
+    DEFINES += -DPEGASUS_ENABLE_PROTOCOL_WSMAN
+else
+    ifneq ($(PEGASUS_ENABLE_PROTOCOL_WSMAN),false)
+        $(error PEGASUS_ENABLE_PROTOCOL_WSMAN ($(PEGASUS_ENABLE_PROTOCOL_WSMAN)) invalid, must be true or false)
+    endif
+endif
+
+
 ##==============================================================================
 ##
 ## PEGASUS_USE_PAM_STANDALONE_PROC
index cbd2a3817be1b44c69fc9596a760f21dc8bb221f..7d36eed0188c0beea578366f0e56e3150c3da987 100644 (file)
@@ -179,6 +179,15 @@ static const char HEADER_NAME_CIMBATCH [] = "CIMBatch";
 static const char HEADER_VALUE_CONTENTTYPE [] = 
                            "application/xml; charset=\"utf-8\"";
 
+#ifdef PEGASUS_ENABLE_PROTOCOL_WSMAN
+/**
+ *  The value of the WS-Management HTTP Content-type header specifying that the
+ *  media type of the underlying data is application data in soap+xml format.
+ */
+static const char WSMAN_HEADER_VALUE_CONTENTTYPE[] =
+    "application/soap+xml; charset=utf-8";
+#endif
+
 /**
  *  The value of the HTTP Man header specifying the CIM mapping onto HTTP
  *  extension header name space URI.
index f26449b9d43111ef4ca75db4c611dc0b757f1b0a..5ec98096d9915c8793cb7bbcf60712bd1f59bf9a 100644 (file)
@@ -388,6 +388,43 @@ void WbemExecCommand::_printContent(
         //  Print XML response to the ostream
         //
         const char* content = responseMessage.getData () + contentOffset;
+
+#if defined(PEGASUS_DEBUG) && defined(PEGASUS_ENABLE_PROTOCOL_WSMAN)
+        //
+        // The response contains a unique Message ID. To allow
+        // predictable message IDs for static comparison tests, replace the
+        // response message Id with 0.
+        //
+        AutoArrayPtr<char> contentCopy;
+
+        if (const char* uuidStart = strstr(content, "<wsa:MessageID>"))
+        {
+            if (const char* uuidEnd = strstr(uuidStart, "</wsa:MessageID>"))
+            {
+                contentCopy.reset((
+                    strcpy(new char [strlen(content)+1],content)));
+
+                // The message ID starts after the last ':' char. (See,
+                // DSP0226 R5.4.4-1.). Position to the last ':' char.
+                const char* colonPos = uuidEnd;
+                for ( ; colonPos >= uuidStart && *colonPos != ':'; colonPos--);
+
+                char* beginPtr = contentCopy.get() + (colonPos+1 - content);
+                char* endPtr   = contentCopy.get() + (uuidEnd - content); 
+
+                // Replace the response messageID with 0. 
+                for (; beginPtr < endPtr; beginPtr++)
+                {
+                    if (*beginPtr != '-') 
+                    {
+                        *beginPtr = '0'; 
+                    }
+                }
+
+                content = contentCopy.get();
+            }
+        }
+#endif
         XmlWriter::indentedPrint (oStream, content, 0);
     }
 }
index 61b0ab0827230641b49de9290621ad6d670cef95..dd322f0358b898ec7497babd25a54237940c0433 100644 (file)
@@ -105,11 +105,12 @@ throw (XmlValidationError, XmlSemanticError, WbemExecException,
     Boolean                      multireq              = false;
     Uint32                       i                     = 0;
     static Uint32                BUFFERSIZE            = 1024;
+    Boolean hasXmlDeclaration = false;
 
     //
     //  xml declaration
     //
-    if (!(XmlReader::testXmlDeclaration (parser, entry)))
+    if (!(hasXmlDeclaration = XmlReader::testXmlDeclaration (parser, entry))) 
     {
         //
         //  No xml declaration
@@ -119,6 +120,7 @@ throw (XmlValidationError, XmlSemanticError, WbemExecException,
         char tmp [8];
         char* tmpp = & (tmp [0]);
         strncpy (tmpp, entry.text, 8);
+        tmpp[7] = 0;
 #if !defined(PEGASUS_COMPILER_MSVC) && !defined(PEGASUS_OS_ZOS)
         char *last;
         char* p = strtok_r (tmpp, HTTP_SP, &last);
@@ -136,15 +138,49 @@ throw (XmlValidationError, XmlSemanticError, WbemExecException,
             {
                 return content;
             }
-            else
-            {
-                //
-                //  Input contains neither XML declaration nor HTTP M-POST or
-                //  POST method request
-                //
-                throw WbemExecException(WbemExecException::INVALID_INPUT);
-            }
-        }  /* if p not NULL */
+        }
+     }
+
+#ifdef PEGASUS_ENABLE_PROTOCOL_WSMAN
+
+     // Check if the next tag is a SOAP envelope.
+     if (parser.next(entry) && 
+             entry.type == XmlEntry::START_TAG && 
+             strcmp(entry.localName, "Envelope") == 0)
+     {
+          //
+          //  Set WSMAN headers and content.
+          //
+          message << HTTP_METHOD_POST << HTTP_SP 
+                  << "/wsman" << HTTP_SP 
+                  << HTTP_PROTOCOL << HTTP_VERSION_11 << HTTP_CRLF;
+          message << HEADER_NAME_HOST << HEADER_SEPARATOR 
+                  << HTTP_SP << hostName << HTTP_CRLF;
+          message << HEADER_NAME_CONTENTTYPE << HEADER_SEPARATOR 
+                  << HTTP_SP << WSMAN_HEADER_VALUE_CONTENTTYPE 
+                  << HTTP_CRLF;
+          message << HEADER_NAME_CONTENTLENGTH << HEADER_SEPARATOR 
+                  << HTTP_SP << (Uint32)content.size () << HTTP_CRLF;
+
+          httpHeaders << message;
+          message << HTTP_CRLF;
+          message << content;
+          return message;
+     }
+     else
+     {
+         parser.putBack(entry);
+     }
+    
+#endif
+
+    if (!hasXmlDeclaration)
+    {
+        //
+        //  Input contains neither XML declaration nor HTTP M-POST or
+        //  POST method request
+        //
+        throw WbemExecException(WbemExecException::INVALID_INPUT);
     }
 
     //
index c97fbd6faf2d49d988f3216c039bd91df86b97a9..a9fc0550fc3b4670cb3bbf72b8dffc3aaaf3a72f 100644 (file)
@@ -125,7 +125,8 @@ static char const* TRACE_COMPONENT_LIST[] =
     "CMPIProvider",
     "IndicationGeneration",
     "IndicationReceipt",
-    "CMPIProviderInterface"
+    "CMPIProviderInterface",
+    "WsmServer"
 };
 /** Constants identifying the Trace components. These constants are used by
     the component to identify its Trace messages. The component ID needs to
@@ -185,7 +186,8 @@ enum TRACE_COMPONENT_ID
     TRC_CMPIPROVIDER,
     TRC_INDICATION_GENERATION,
     TRC_INDICATION_RECEIPT,
-    TRC_CMPIPROVIDERINTERFACE
+    TRC_CMPIPROVIDERINTERFACE,
+    TRC_WSMSERVER
 };
 
 PEGASUS_NAMESPACE_END
index 1359a66be7c91b0a24ee8300acb806405ea32313..92e3c082fb5aa7ddbea036082c7880f9bfb75d7d 100644 (file)
@@ -758,7 +758,7 @@ void XmlGenerator::indentedPrint(
 
                 os << "<?" << entry.text << " ";
                 _printAttributes(
-                    os, entry.attributes, entry.attributeCount);
+                    os, entry.attributes.getData(), entry.attributes.size());
                 os << "?>";
                 break;
             }
@@ -769,11 +769,11 @@ void XmlGenerator::indentedPrint(
 
                 os << "<" << entry.text;
 
-                if (entry.attributeCount)
+                if (entry.attributes.size())
                     os << ' ';
 
                 _printAttributes(
-                    os, entry.attributes, entry.attributeCount);
+                    os, entry.attributes.getData(), entry.attributes.size());
                 os << ">";
                 stack.push(entry.text);
                 break;
@@ -785,7 +785,7 @@ void XmlGenerator::indentedPrint(
 
                 os << "<" << entry.text << " ";
                 _printAttributes(
-                    os, entry.attributes, entry.attributeCount);
+                    os, entry.attributes.getData(), entry.attributes.size());
                 os << "/>";
                 break;
             }
index 750528bd9d968812c4b40c0ce19d0a2923562abd..8fc8ecb5b83404644c926342ee155d3ec71e5e42 100644 (file)
@@ -172,14 +172,14 @@ static const char* _xmlMessages[] =
     "Unterminated comment",
     "Unterminated CDATA block",
     "Unterminated DOCTYPE",
-    "Too many attributes: parser only handles 10",
     "Malformed reference",
     "Expected a comment or CDATA following \"<!\" sequence",
     "Closing element does not match opening element",
     "One or more tags are still open",
     "More than one root element was encountered",
     "Validation error",
-    "Semantic error"
+    "Semantic error",
+    "Namespace not declared"
 };
 
 static const char* _xmlKeys[] =
@@ -193,36 +193,16 @@ static const char* _xmlKeys[] =
     "Common.XmlParser.UNTERMINATED_COMMENT",
     "Common.XmlParser.UNTERMINATED_CDATA",
     "Common.XmlParser.UNTERMINATED_DOCTYPE",
-    "Common.XmlParser.TOO_MANY_ATTRIBUTES",
     "Common.XmlParser.MALFORMED_REFERENCE",
     "Common.XmlParser.EXPECTED_COMMENT_OR_CDATA",
     "Common.XmlParser.START_END_MISMATCH",
     "Common.XmlParser.UNCLOSED_TAGS",
     "Common.XmlParser.MULTIPLE_ROOTS",
     "Common.XmlParser.VALIDATION_ERROR",
-    "Common.XmlParser.SEMANTIC_ERROR"
+    "Common.XmlParser.SEMANTIC_ERROR",
+    "Common.XmlParser.UNDECLARED_NAMESPACE"
 };
 
-// l10n replace _formMessage (comment out the old one)
-/*
-static String _formMessage(Uint32 code, Uint32 line, const String& message)
-{
-    String result = _xmlMessages[Uint32(code) - 1];
-
-    char buffer[32];
-    sprintf(buffer, "%d", line);
-    result.append(": on line ");
-    result.append(buffer);
-
-    if (message.size())
-    {
-        result.append(": ");
-        result.append(message);
-    }
-
-    return result;
-}
-*/
 
 static MessageLoaderParms _formMessage(
     Uint32 code,
@@ -231,7 +211,7 @@ static MessageLoaderParms _formMessage(
 {
     String dftMsg = _xmlMessages[Uint32(code) - 1];
     String key = _xmlKeys[Uint32(code) - 1];
-        String msg = message;
+    String msg = message;
 
     dftMsg.append(": on line $0");
     if (message.size())
@@ -328,11 +308,14 @@ XmlSemanticError::XmlSemanticError(
 //
 ////////////////////////////////////////////////////////////////////////////////
 
-XmlParser::XmlParser(char* text)
+XmlParser::XmlParser(char* text, XmlNamespace* ns)
     : _line(1),
       _current(text),
       _restoreChar('\0'),
-      _foundRoot(false)
+      _foundRoot(false),
+      _supportedNamespaces(ns),
+      // Start valid indexes with -2. -1 is reserved for not found.
+      _currentUnsupportedNSType(-2)
 {
 }
 
@@ -389,7 +372,7 @@ static int _getEntityRef(char*& p)
 }
 #if defined(PEGASUS_PLATFORM_WIN64_IA64_MSVC) || \
     defined(PEGASUS_PLATFORM_WIN64_X86_64_MSVC)
-#pragma optimize( "", on ) 
+#pragma optimize( "", on )
 #endif
 
 static inline int _getCharRef(char*& p, bool hex)
@@ -510,7 +493,9 @@ static void _normalize(Uint32& line, char*& p, char end_char, char*& start)
     }
 }
 
-Boolean XmlParser::next(XmlEntry& entry, Boolean includeComment)
+Boolean XmlParser::next(
+    XmlEntry& entry,
+    Boolean includeComment)
 {
     if (!_putBackStack.isEmpty())
     {
@@ -532,6 +517,18 @@ Boolean XmlParser::next(XmlEntry& entry, Boolean includeComment)
         _restoreChar = '\0';
     }
 
+    entry.attributes.clear();
+
+    if (_supportedNamespaces)
+    {
+        // Remove namespaces of a deeper scope level from the stack.
+        while (!_nameSpaces.isEmpty() &&
+               _nameSpaces.top().scopeLevel > _stack.size())
+        {
+            _nameSpaces.pop();
+        }
+    }
+
     // Loop until we are done with comments if includeComment is false.
     do
     {
@@ -598,11 +595,141 @@ Boolean XmlParser::next(XmlEntry& entry, Boolean includeComment)
             if (nullTerminator)
                 *nullTerminator = '\0';
         }
-    }while (!includeComment && entry.type == XmlEntry::COMMENT);
+    } while (!includeComment && entry.type == XmlEntry::COMMENT);
+
+    if (_supportedNamespaces &&
+        (entry.type == XmlEntry::START_TAG ||
+         entry.type == XmlEntry::EMPTY_TAG ||
+         entry.type == XmlEntry::END_TAG))
+    {
+        // Determine the namespace type for this entry
+
+        if (entry.type == XmlEntry::START_TAG ||
+            entry.type == XmlEntry::EMPTY_TAG)
+        {
+            // Process namespace declarations and determine the namespace type
+            // for the attributes.
+
+            Uint32 scopeLevel = _stack.size();
+            if (entry.type == XmlEntry::EMPTY_TAG)
+            {
+                // Empty tags are deeper scope, but not pushed onto the stack
+                scopeLevel++;
+            }
+
+            for (Uint32 i = 0, n = entry.attributes.size(); i < n; i++)
+            {
+                XmlAttribute& attr = entry.attributes[i];
+                if ((strncmp(attr.name, "xmlns:", 6) == 0) ||
+                    (strcmp(attr.name, "xmlns") == 0))
+                {
+                    // Process a namespace declaration
+                    XmlNamespace ns;
+                    if (attr.name[5] == ':')
+                    {
+                        ns.localName = attr.localName;
+                    }
+                    else
+                    {
+                        // Default name space has no local name
+                        ns.localName = 0;
+                    }
+                    ns.extendedName = attr.value;
+                    ns.scopeLevel = scopeLevel;
+                    ns.type = _getSupportedNamespaceType(ns.extendedName);
+
+                    // If the namespace is not supported, assign it a unique
+                    // negative identifier.
+                    if (ns.type == -1)
+                    {
+                        ns.type = _currentUnsupportedNSType--;
+                    }
+
+                    _nameSpaces.push(ns);
+                }
+                else
+                {
+                    // Get the namespace type for this attribute.
+                    attr.nsType = _getNamespaceType(attr.name);
+                }
+            }
+        }
+
+        entry.nsType = _getNamespaceType(entry.text);
+    }
+    else
+    {
+        entry.nsType = -1;
+    }
 
     return true;
 }
 
+// Get the namespace type of the given tag
+int XmlParser::_getNamespaceType(const char* tag)
+{
+    const char* pos = strchr(tag, ':');
+
+    // If ':' is not found, the tag is not namespace qualified and we
+    // need to look for the default name space.
+
+    // Search the namespace stack from the top
+    for (Sint32 i = _nameSpaces.size() - 1; i >=0; i--)
+    {
+        // If ':' is found, look for the name space with the matching
+        // local name...
+        if ((pos && _nameSpaces[i].localName &&
+             !strncmp(_nameSpaces[i].localName, tag, pos - tag)) ||
+            // ... otherwise look for the default name space. It's the
+            // one with localName set to NULL
+            (!pos && !_nameSpaces[i].localName))
+        {
+            return _nameSpaces[i].type;
+        }
+    }
+
+    // If the tag is namespace qualified, but the name space has not been
+    // declared, it's malformed XML and we must throw an exception.
+    // Note:  The "xml" namespace is specifically defined by the W3C as a
+    // reserved prefix ("http://www.w3.org/XML/1998/namespace").
+    if (pos && (strncmp(tag, "xml:", 4) != 0))
+    {
+        throw XmlException(XmlException::UNDECLARED_NAMESPACE, _line);
+    }
+
+    // Otherwise it's OK not to have a name space.
+    return -1;
+}
+
+// Given the extended namespace name, find it in the table of supported
+// namespaces and return its type.
+int XmlParser::_getSupportedNamespaceType(const char* extendedName)
+{
+    for (Sint32 i = 0;
+         _supportedNamespaces[i].localName != 0;
+         i++)
+    {
+        PEGASUS_ASSERT(_supportedNamespaces[i].type == i);
+        if (!strcmp(_supportedNamespaces[i].extendedName, extendedName))
+        {
+            return _supportedNamespaces[i].type;
+        }
+    }
+    return -1;
+}
+
+XmlNamespace* XmlParser::getNamespace(int nsType)
+{
+    for (Sint32 i = _nameSpaces.size() - 1; i >=0; i--)
+    {
+        if (_nameSpaces[i].type == nsType)
+        {
+            return &_nameSpaces[i];
+        }
+    }
+    return 0;
+}
+
 void XmlParser::putBack(XmlEntry& entry)
 {
     _putBackStack.push(entry);
@@ -613,11 +740,11 @@ XmlParser::~XmlParser()
     // Nothing to do!
 }
 
-// A-Za-z0-9_-:.
+// A-Za-z0-9_-.  (Note that ':' is not included and must be checked separately)
 static unsigned char _isInnerElementChar[] =
 {
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,
+    0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,
     1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
     1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -625,16 +752,40 @@ static unsigned char _isInnerElementChar[] =
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
-Boolean XmlParser::_getElementName(char*& p)
+inline Boolean _getQName(char*& p, const char*& localName)
 {
+    localName = p;
+
     if (!CharSet::isAlNumUnder(Uint8(*p)))
-        throw XmlException(XmlException::BAD_START_TAG, _line);
+        return false;
 
     p++;
 
     while (*p && _isInnerElementChar[Uint8(*p)])
         p++;
 
+    // We've validated the prefix, now validate the local name
+    if (*p == ':')
+    {
+        localName = ++p;
+
+        if (!CharSet::isAlNumUnder(Uint8(*p)))
+            return false;
+
+        p++;
+
+        while (*p && _isInnerElementChar[Uint8(*p)])
+            p++;
+    }
+
+    return true;
+}
+
+Boolean XmlParser::_getElementName(char*& p, const char*& localName)
+{
+    if (!_getQName(p, localName))
+        throw XmlException(XmlException::BAD_START_TAG, _line);
+
     // The next character must be a space:
 
     if (_isspace(*p))
@@ -652,18 +803,16 @@ Boolean XmlParser::_getElementName(char*& p)
     return false;
 }
 
-Boolean XmlParser::_getOpenElementName(char*& p, Boolean& openCloseElement)
+Boolean XmlParser::_getOpenElementName(
+    char*& p,
+    const char*& localName,
+    Boolean& openCloseElement)
 {
     openCloseElement = false;
 
-    if (!CharSet::isAlNumUnder(Uint8(*p)))
+    if (!_getQName(p, localName))
         throw XmlException(XmlException::BAD_START_TAG, _line);
 
-    p++;
-
-    while (*p && _isInnerElementChar[Uint8(*p)])
-        p++;
-
     // The next character must be a space:
 
     if (_isspace(*p))
@@ -689,16 +838,11 @@ Boolean XmlParser::_getOpenElementName(char*& p, Boolean& openCloseElement)
     return false;
 }
 
-void XmlParser::_getAttributeNameAndEqual(char*& p)
+void XmlParser::_getAttributeNameAndEqual(char*& p, const char*& localName)
 {
-    if (!CharSet::isAlNumUnder((Uint8)*p))
+    if (!_getQName(p, localName))
         throw XmlException(XmlException::BAD_ATTRIBUTE_NAME, _line);
 
-    p++;
-
-    while (*p && _isInnerElementChar[Uint8(*p)])
-        p++;
-
     char* term = p;
 
     _skipWhitespace(_line, p);
@@ -779,8 +923,6 @@ void XmlParser::_getDocType(char*& p)
 
 void XmlParser::_getElement(char*& p, XmlEntry& entry)
 {
-    entry.attributeCount = 0;
-
     //--------------------------------------------------------------------------
     // Get the element name (expect one of these: '?', '!', [A-Za-z_])
     //--------------------------------------------------------------------------
@@ -792,7 +934,7 @@ void XmlParser::_getElement(char*& p, XmlEntry& entry)
 
         Boolean openCloseElement = false;
 
-        if (_getElementName(p))
+        if (_getElementName(p, entry.localName))
             return;
     }
     else if (*p == '!')
@@ -831,7 +973,7 @@ void XmlParser::_getElement(char*& p, XmlEntry& entry)
         entry.type = XmlEntry::END_TAG;
         entry.text = ++p;
 
-        if (!_getElementName(p))
+        if (!_getElementName(p, entry.localName))
             throw(XmlException(XmlException::BAD_END_TAG, _line));
 
         return;
@@ -845,7 +987,7 @@ void XmlParser::_getElement(char*& p, XmlEntry& entry)
 
         Boolean openCloseElement = false;
 
-        if (_getOpenElementName(p, openCloseElement))
+        if (_getOpenElementName(p, entry.localName, openCloseElement))
         {
             if (openCloseElement)
                 entry.type = XmlEntry::EMPTY_TAG;
@@ -882,8 +1024,9 @@ void XmlParser::_getElement(char*& p, XmlEntry& entry)
         }
 
         XmlAttribute attr;
+        attr.nsType = -1;
         attr.name = p;
-        _getAttributeNameAndEqual(p);
+        _getAttributeNameAndEqual(p, attr.localName);
 
         // Get the attribute value (e.g., "some value")
         {
@@ -927,10 +1070,7 @@ void XmlParser::_getElement(char*& p, XmlEntry& entry)
 
         _skipWhitespace(_line, p);
 
-        if (entry.attributeCount == XmlEntry::MAX_ATTRIBUTES)
-            throw XmlException(XmlException::TOO_MANY_ATTRIBUTES, _line);
-
-        entry.attributes[entry.attributeCount++] = attr;
+        entry.attributes.append(attr);
     }
 }
 
@@ -962,7 +1102,7 @@ void XmlEntry::print() const
 
     PEGASUS_STD(cout) << '\n';
 
-    for (Uint32 i = 0; i < attributeCount; i++)
+    for (Uint32 i = 0, n = attributes.size(); i < n; i++)
     {
         PEGASUS_STD(cout) << "    " << attributes[i].name << "=\"";
         _printValue(attributes[i].value);
@@ -973,7 +1113,7 @@ void XmlEntry::print() const
 const XmlAttribute* XmlEntry::findAttribute(
     const char* name) const
 {
-    for (Uint32 i = 0; i < attributeCount; i++)
+    for (Uint32 i = 0, n = attributes.size(); i < n; i++)
     {
         if (strcmp(attributes[i].name, name) == 0)
             return &attributes[i];
@@ -982,6 +1122,22 @@ const XmlAttribute* XmlEntry::findAttribute(
     return 0;
 }
 
+const XmlAttribute* XmlEntry::findAttribute(
+    int nsType,
+    const char* name) const
+{
+    for (Uint32 i = 0, n = attributes.size(); i < n; i++)
+    {
+        if ((attributes[i].nsType == nsType) &&
+            (strcmp(attributes[i].localName, name) == 0))
+        {
+            return &attributes[i];
+        }
+    }
+
+    return 0;
+}
+
 // Find first non-whitespace character (set first) and last non-whitespace
 // character (set last one past this). For example, consider this string:
 //
index 7ee0d5326f297634abd6dc69425deeba3bbfe1d2..49b074291e5e50ff18bc2c73c55ef7f504e00a45 100644 (file)
@@ -58,14 +58,14 @@ public:
         UNTERMINATED_COMMENT,
         UNTERMINATED_CDATA,
         UNTERMINATED_DOCTYPE,
-        TOO_MANY_ATTRIBUTES,
         MALFORMED_REFERENCE,
         EXPECTED_COMMENT_OR_CDATA,
         START_END_MISMATCH,
         UNCLOSED_TAGS,
         MULTIPLE_ROOTS,
         VALIDATION_ERROR,
-        SEMANTIC_ERROR
+        SEMANTIC_ERROR,
+        UNDECLARED_NAMESPACE
     };
 
 
@@ -104,15 +104,25 @@ public:
     XmlSemanticError(Uint32 lineNumber, MessageLoaderParms& msgParms);
 };
 
+struct XmlNamespace
+{
+    const char* localName;
+    const char* extendedName;
+    int type;
+    Uint32 scopeLevel;
+};
+
 struct XmlAttribute
 {
+    int nsType;
     const char* name;
+    const char* localName;
     const char* value;
 };
 
 struct PEGASUS_COMMON_LINKAGE XmlEntry
 {
-    enum CIMType
+    enum XmlEntryType
     {
         XML_DECLARATION,
         START_TAG,
@@ -124,17 +134,18 @@ struct PEGASUS_COMMON_LINKAGE XmlEntry
         CONTENT
     };
 
-    enum { MAX_ATTRIBUTES = 10 };
-
-    CIMType type;
+    XmlEntryType type;
     const char* text;
-    XmlAttribute attributes[MAX_ATTRIBUTES];
-    Uint32 attributeCount;
+    int nsType;            // Only applies to START_TAG, EMPTY_TAG, and END_TAG
+    const char* localName; // Only applies to START_TAG, EMPTY_TAG, and END_TAG
+    Array<XmlAttribute> attributes;
 
     void print() const;
 
     const XmlAttribute* findAttribute(const char* name) const;
 
+    const XmlAttribute* findAttribute(int nsType, const char* name) const;
+
     Boolean getAttributeValue(const char* name, Uint32& value) const;
 
     Boolean getAttributeValue(const char* name, Real32& value) const;
@@ -155,7 +166,7 @@ public:
 
     // Warning: this constructor modifies the text.
 
-    XmlParser(char* text);
+    XmlParser(char* text, XmlNamespace* ns = 0);
 
     /** Comments are returned with entry if includeComment is true else 
         XmlParser ignores comments. Default is false.
@@ -170,13 +181,18 @@ public:
 
     Uint32 getLine() const { return _line; }
 
+    XmlNamespace* getNamespace(int nsType);
+
 private:
 
-    Boolean _getElementName(char*& p);
+    Boolean _getElementName(char*& p, const char*& localName);
 
-    Boolean _getOpenElementName(char*& p, Boolean& openCloseElement);
+    Boolean _getOpenElementName(
+        char*& p,
+        const char*& localName,
+        Boolean& openCloseElement);
 
-    void _getAttributeNameAndEqual(char*& p);
+    void _getAttributeNameAndEqual(char*& p, const char*& localName);
 
     void _getComment(char*& p);
 
@@ -186,12 +202,20 @@ private:
 
     void _getElement(char*& p, XmlEntry& entry);
 
+    int _getNamespaceType(const char* tag);
+
+    int _getSupportedNamespaceType(const char* extendedName);
+
     Uint32 _line;
     char* _current;
     char _restoreChar;
     Stack<char*> _stack;
     Boolean _foundRoot;
     Stack<XmlEntry> _putBackStack;
+
+    XmlNamespace* _supportedNamespaces;
+    Stack<XmlNamespace> _nameSpaces;
+    int _currentUnsupportedNSType;
 };
 
 PEGASUS_COMMON_LINKAGE void XmlAppendCString(
index ed7aa3f8f7ab59408ea6d4d146f080970bcefd18..092e9691747aeab1524001b86d0ddabc1029feaf 100644 (file)
@@ -69,7 +69,7 @@ static void _parseFile(const char* fileName)
     PEGASUS_ASSERT (parser.getStackSize () == 0);
     while (parser.next(entry))
     {
-        if (verbose) 
+        if (verbose)
         {
             entry.print();
         }
@@ -77,6 +77,208 @@ static void _parseFile(const char* fileName)
     PEGASUS_ASSERT (parser.next (entry, true) == false);
 }
 
+#define ASSERT_XML_EXCEPTION(statement)  \
+    do                                   \
+    {                                    \
+        Boolean caughtException = false; \
+        try                              \
+        {                                \
+            statement;                   \
+        }                                \
+        catch (XmlException& e)          \
+        {                                \
+            caughtException = true;      \
+        }                                \
+        PEGASUS_ASSERT(caughtException); \
+    } while(0)
+
+void testNamespaceSupport()
+{
+    XmlNamespace testNamespaces[] =
+    {
+        {
+            "ns0",
+            "urn:0",
+            0,
+            0
+        },
+        {
+            "ns1",
+            "urn:1",
+            1,
+            0
+        },
+        {
+            "ns2",
+            "urn:2",
+            2,
+            0
+        },
+        { 0, 0, 0, 0 }    // Terminator
+    };
+
+    XmlEntry entry;
+    const XmlAttribute* attr;
+
+    // Test namespace scoping
+    {
+        char xmlContent[] =
+            "<a:tag xmlns:a=\"urn:0\" xmlns:b=\"urn:1\">"
+            " <b:tag xmlns=\"urn:2\" ignore=\"false\" a:attr=\"true\">"
+            "  <tag/>"
+            " </b:tag>"
+            " <tag xmlns=\"urn:0\" xml:lang=\"en-US\">"
+            "  Data"
+            " </tag>"
+            " <d:tag xmlns:d=\"urn:x\"/>"
+            " <b:tag xmlns:b=\"urn:1\"/>"
+            "</a:tag>";
+        XmlParser p(xmlContent, testNamespaces);
+
+        // <a:tag xmlns:a=\"urn:0\" xmlns:b=\"urn:1\">
+        PEGASUS_ASSERT(p.next(entry));
+        PEGASUS_ASSERT(entry.type == XmlEntry::START_TAG);
+        PEGASUS_ASSERT(!strcmp(entry.text, "a:tag"));
+        PEGASUS_ASSERT(entry.nsType == 0);
+        PEGASUS_ASSERT(!strcmp(entry.localName, "tag"));
+        PEGASUS_ASSERT(p.getNamespace(0) != 0);
+        PEGASUS_ASSERT(p.getNamespace(1) != 0);
+        PEGASUS_ASSERT(p.getNamespace(2) == 0);
+
+        // <b:tag xmlns=\"urn:2\" ignore=\"false\" a:attr=\"true\">
+        PEGASUS_ASSERT(p.next(entry));
+        PEGASUS_ASSERT(entry.type == XmlEntry::START_TAG);
+        PEGASUS_ASSERT(!strcmp(entry.text, "b:tag"));
+        PEGASUS_ASSERT(entry.nsType == 1);
+        PEGASUS_ASSERT(!strcmp(entry.localName, "tag"));
+        PEGASUS_ASSERT(p.getNamespace(2) != 0);
+        attr = entry.findAttribute(0, "attr");
+        PEGASUS_ASSERT(attr != 0);
+        PEGASUS_ASSERT(attr->nsType == 0);
+        PEGASUS_ASSERT(strcmp(attr->name, "a:attr") == 0);
+        PEGASUS_ASSERT(strcmp(attr->localName, "attr") == 0);
+        PEGASUS_ASSERT(strcmp(attr->value, "true") == 0);
+        PEGASUS_ASSERT(entry.findAttribute(1, "attr") == 0);
+        attr = entry.findAttribute(2, "ignore");
+        PEGASUS_ASSERT(attr != 0);
+        PEGASUS_ASSERT(attr->nsType == 2);
+        PEGASUS_ASSERT(strcmp(attr->name, "ignore") == 0);
+        PEGASUS_ASSERT(strcmp(attr->localName, "ignore") == 0);
+        PEGASUS_ASSERT(strcmp(attr->value, "false") == 0);
+
+        // <tag/>
+        PEGASUS_ASSERT(p.next(entry));
+        PEGASUS_ASSERT(entry.type == XmlEntry::EMPTY_TAG);
+        PEGASUS_ASSERT(!strcmp(entry.text, "tag"));
+        PEGASUS_ASSERT(entry.nsType == 2);
+        PEGASUS_ASSERT(!strcmp(entry.localName, "tag"));
+
+        // </b:tag>
+        PEGASUS_ASSERT(p.next(entry));
+        PEGASUS_ASSERT(entry.type == XmlEntry::END_TAG);
+        PEGASUS_ASSERT(!strcmp(entry.text, "b:tag"));
+        PEGASUS_ASSERT(entry.nsType == 1);
+        PEGASUS_ASSERT(!strcmp(entry.localName, "tag"));
+        PEGASUS_ASSERT(p.getNamespace(0) != 0);
+        PEGASUS_ASSERT(p.getNamespace(1) != 0);
+        PEGASUS_ASSERT(p.getNamespace(2) != 0);
+
+        // <tag xmlns=\"urn:0\" xml:lang=\"en-US\">
+        PEGASUS_ASSERT(p.next(entry));
+        PEGASUS_ASSERT(entry.type == XmlEntry::START_TAG);
+        PEGASUS_ASSERT(!strcmp(entry.text, "tag"));
+        PEGASUS_ASSERT(entry.nsType == 0);
+        PEGASUS_ASSERT(!strcmp(entry.localName, "tag"));
+        PEGASUS_ASSERT(p.getNamespace(0) != 0);
+        PEGASUS_ASSERT(p.getNamespace(1) != 0);
+        PEGASUS_ASSERT(p.getNamespace(2) == 0);
+        attr = entry.findAttribute("xml:lang");
+        PEGASUS_ASSERT(attr != 0);
+        PEGASUS_ASSERT(attr->nsType == -1);
+        PEGASUS_ASSERT(strcmp(attr->name, "xml:lang") == 0);
+        PEGASUS_ASSERT(strcmp(attr->localName, "lang") == 0);
+        PEGASUS_ASSERT(strcmp(attr->value, "en-US") == 0);
+
+        // Data
+        PEGASUS_ASSERT(p.next(entry));
+        PEGASUS_ASSERT(entry.type == XmlEntry::CONTENT);
+        PEGASUS_ASSERT(!strcmp(entry.text, "Data"));
+
+        // </tag>
+        PEGASUS_ASSERT(p.next(entry));
+        PEGASUS_ASSERT(entry.type == XmlEntry::END_TAG);
+        PEGASUS_ASSERT(!strcmp(entry.text, "tag"));
+        PEGASUS_ASSERT(entry.nsType == 0);
+        PEGASUS_ASSERT(!strcmp(entry.localName, "tag"));
+
+        // <d:tag xmlns:d=\"urn:x\"/>
+        PEGASUS_ASSERT(p.next(entry));
+        PEGASUS_ASSERT(entry.type == XmlEntry::EMPTY_TAG);
+        PEGASUS_ASSERT(!strcmp(entry.text, "d:tag"));
+        PEGASUS_ASSERT(entry.nsType == -2);
+        PEGASUS_ASSERT(!strcmp(entry.localName, "tag"));
+        PEGASUS_ASSERT(p.getNamespace(-2) != 0);
+
+        // <b:tag xmlns:b=\"urn:1\"/>
+        PEGASUS_ASSERT(p.next(entry));
+        PEGASUS_ASSERT(entry.type == XmlEntry::EMPTY_TAG);
+        PEGASUS_ASSERT(!strcmp(entry.text, "b:tag"));
+        PEGASUS_ASSERT(entry.nsType == 1);
+        PEGASUS_ASSERT(!strcmp(entry.localName, "tag"));
+        PEGASUS_ASSERT(p.getNamespace(-2) == 0);
+        PEGASUS_ASSERT(p.getNamespace(0) != 0);
+        PEGASUS_ASSERT(p.getNamespace(1) != 0);
+        PEGASUS_ASSERT(p.getNamespace(2) == 0);
+
+        // </a:tag>
+        PEGASUS_ASSERT(p.next(entry));
+        PEGASUS_ASSERT(entry.type == XmlEntry::END_TAG);
+        PEGASUS_ASSERT(!strcmp(entry.text, "a:tag"));
+        PEGASUS_ASSERT(entry.nsType == 0);
+        PEGASUS_ASSERT(!strcmp(entry.localName, "tag"));
+        PEGASUS_ASSERT(p.getNamespace(0) != 0);
+        PEGASUS_ASSERT(p.getNamespace(1) != 0);
+    }
+
+    // Test undeclared namespace
+    {
+        char xmlContent[] = "<a:tag xmlns:b=\"urn:1\"/>";
+        XmlParser p(xmlContent, testNamespaces);
+        ASSERT_XML_EXCEPTION(p.next(entry));
+    }
+
+    // Test invalid QNames
+    {
+        char xmlContent[] = "<.a:tag xmlns:a=\"urn:0\"/>";
+        XmlParser p(xmlContent, testNamespaces);
+        ASSERT_XML_EXCEPTION(p.next(entry));
+    }
+
+    {
+        char xmlContent[] = "<a&:tag xmlns:a=\"urn:0\"/>";
+        XmlParser p(xmlContent, testNamespaces);
+        ASSERT_XML_EXCEPTION(p.next(entry));
+    }
+
+    {
+        char xmlContent[] = "<a:.tag xmlns:a=\"urn:0\"/>";
+        XmlParser p(xmlContent, testNamespaces);
+        ASSERT_XML_EXCEPTION(p.next(entry));
+    }
+
+    {
+        char xmlContent[] = "<a:ta:g xmlns:a=\"urn:0\"/>";
+        XmlParser p(xmlContent, testNamespaces);
+        ASSERT_XML_EXCEPTION(p.next(entry));
+    }
+
+    {
+        char xmlContent[] = "<a:ta";
+        XmlParser p(xmlContent, testNamespaces);
+        ASSERT_XML_EXCEPTION(p.next(entry));
+    }
+}
+
 // Test case for 7581: XML parser leaves trailing spaces in entry content.
 static void _trailingSpace()
 {
@@ -101,27 +303,30 @@ int main(int argc, char** argv)
 {
 
     verbose = (getenv ("PEGASUS_TEST_VERBOSE")) ? true : false;
-  
+
     if (argc < 2)
     {
-    cerr << "Usage: " << argv[0] << " xml-filename ..." << endl;
-    exit(1);
+        cerr << "Usage: " << argv[0] << " xml-filename ..." << endl;
+        exit(1);
     }
 
     for (Uint32 i = 1; i < Uint32(argc); i++)
     {
-    try 
-    { 
-        _parseFile(argv[i]);
-
-        _trailingSpace();
-    }
-    catch(Exception& e)
-    {
-        cerr << "Error: " << e.getMessage() << endl;    
-        exit(1);
-    }
+        try
+        {
+            _parseFile(argv[i]);
+        }
+        catch (Exception& e)
+        {
+            cerr << "Error: " << e.getMessage() << endl;
+            exit(1);
+        }
     }
+
+    _trailingSpace();
+
+    testNamespaceSupport();
+
     cout << argv[0] << " +++++ passed all tests" << endl;
 
     return 0;
index 41e96a0cb67c1e2dae8a2a068d30d2aa978f1001..d11a39ff462b1c38dfc30e41ac88e74f638ff4e0 100644 (file)
@@ -158,6 +158,12 @@ ifdef PEGASUS_HAS_SSL
         ControlProviders/CertificateProvider
 endif
 
+ifeq ($(PEGASUS_ENABLE_PROTOCOL_WSMAN),true)
+    DIRS += \
+        WsmServer \
+        WsmServer/tests
+endif
+
 DIRS += \
     Server \
     Server/tests \
index f85d568c08f1f5ab9505d81b329bef38ebfa59ea..5b682c7c1ebcf1508eaf34f167364f71862ef91a 100644 (file)
@@ -113,6 +113,10 @@ CIMQueryCapabilitiesProvider.h>
 # include <Pegasus/ControlProviders/InteropProvider/InteropProvider.h>
 #endif
 
+#ifdef PEGASUS_ENABLE_PROTOCOL_WSMAN
+# include <Pegasus/WsmServer/WsmProcessor.h>
+#endif
+
 PEGASUS_NAMESPACE_BEGIN
 #ifdef PEGASUS_SLP_REG_TIMEOUT
 ThreadReturnType PEGASUS_THREAD_CDECL registerPegasusWithSLP(void *parm);
@@ -432,6 +436,8 @@ void CIMServer::_init()
     Boolean enableAuthentication = ConfigManager::parseBooleanValue(
         configManager->getCurrentValue("enableAuthentication"));
 
+    MessageQueueService* cimOperationProcessorQueue = 0;
+
     //
     // Create Authorization queue only if authentication is enabled
     //
@@ -439,20 +445,18 @@ void CIMServer::_init()
     {
         _cimOperationRequestAuthorizer = new CIMOperationRequestAuthorizer(
             _cimOperationRequestDispatcher);
-
-        _cimOperationRequestDecoder = new CIMOperationRequestDecoder(
-            _cimOperationRequestAuthorizer,
-            _cimOperationResponseEncoder->getQueueId());
+        cimOperationProcessorQueue = _cimOperationRequestAuthorizer;
     }
     else
     {
         _cimOperationRequestAuthorizer = 0;
-
-        _cimOperationRequestDecoder = new CIMOperationRequestDecoder(
-            _cimOperationRequestDispatcher,
-            _cimOperationResponseEncoder->getQueueId());
+        cimOperationProcessorQueue = _cimOperationRequestDispatcher;
     }
 
+    _cimOperationRequestDecoder = new CIMOperationRequestDecoder(
+        cimOperationProcessorQueue,
+        _cimOperationResponseEncoder->getQueueId());
+
     _cimExportRequestDispatcher = new CIMExportRequestDispatcher();
 
     _cimExportResponseEncoder = new CIMExportResponseEncoder;
@@ -466,6 +470,14 @@ void CIMServer::_init()
         _cimExportRequestDecoder->getQueueId(),
         _repository);
 
+#ifdef PEGASUS_ENABLE_PROTOCOL_WSMAN
+    _wsmProcessor = new WsmProcessor(
+        cimOperationProcessorQueue,
+        _repository);
+    _httpAuthenticatorDelegator->setWsmQueueId(
+        _wsmProcessor->getWsmRequestDecoderQueueId());
+#endif
+
     // IMPORTANT-NU-20020513: Indication service must start after ExportService
     // otherwise HandlerService started by indicationService will never
     // get ExportQueue to export indications for existing subscriptions
@@ -566,9 +578,14 @@ CIMServer::~CIMServer ()
     // CIMOperationRequestDecoder depends on CIMOperationRequestAuthorizer
     // and CIMOperationResponseEncoder
     delete _cimOperationRequestDecoder;
-
     delete _cimOperationResponseEncoder;
 
+#ifdef PEGASUS_ENABLE_PROTOCOL_WSMAN
+    // WsmProcessor depends on CIMOperationRequestAuthorizer/Dispatcher and
+    // CIMRepository
+    delete _wsmProcessor;
+#endif
+
     // BinaryMessageHandler depends on CIMOperationRequestDispatcher
     delete _binaryMessageHandler;
 
@@ -799,6 +816,9 @@ void CIMServer::setState(Uint32 state)
         // tell decoder that CIMServer is terminating
         _cimOperationRequestDecoder->setServerTerminating(true);
         _cimExportRequestDecoder->setServerTerminating(true);
+#ifdef PEGASUS_ENABLE_PROTOCOL_WSMAN
+        _wsmProcessor->setServerTerminating(true);
+#endif
 
         // tell authorizer that CIMServer is terminating ONLY if
         // authentication and authorization are enabled
@@ -813,6 +833,9 @@ void CIMServer::setState(Uint32 state)
         // tell decoder that CIMServer is not terminating
         _cimOperationRequestDecoder->setServerTerminating(false);
         _cimExportRequestDecoder->setServerTerminating(false);
+#ifdef PEGASUS_ENABLE_PROTOCOL_WSMAN
+        _wsmProcessor->setServerTerminating(false);
+#endif
 
         // tell authorizer that CIMServer is terminating ONLY if
         // authentication and authorization are enabled
index ace6811095592d3c9b64104dc335fdde3abd08c1..a2ec0874f292ea6873634f7f08204fe810c90339 100644 (file)
@@ -46,8 +46,6 @@
 
 PEGASUS_NAMESPACE_BEGIN
 
-struct ServerRep;
-
 class CIMOperationRequestDispatcher;
 class CIMOperationResponseEncoder;
 class CIMOperationRequestDecoder;
@@ -55,6 +53,7 @@ class CIMOperationRequestAuthorizer;
 class CIMExportRequestDispatcher;
 class CIMExportResponseEncoder;
 class CIMExportRequestDecoder;
+class WsmProcessor;
 class HTTPAcceptor;
 class CIMRepository;
 
@@ -157,6 +156,7 @@ private:
 
     AutoPtr<Monitor> _monitor;
     CIMRepository* _repository;
+
     CIMOperationRequestDispatcher* _cimOperationRequestDispatcher;
     CIMOperationResponseEncoder* _cimOperationResponseEncoder;
     CIMOperationRequestDecoder* _cimOperationRequestDecoder;
@@ -167,6 +167,10 @@ private:
     CIMExportRequestDecoder* _cimExportRequestDecoder;
     HTTPAuthenticatorDelegator* _httpAuthenticatorDelegator;
 
+#ifdef PEGASUS_ENABLE_PROTOCOL_WSMAN
+    WsmProcessor* _wsmProcessor;
+#endif
+
     Array<HTTPAcceptor*> _acceptors;
     Array<ProviderMessageHandler*> _controlProviders;
     AutoPtr<CIMServerState> _serverState;
index 23b4ac83a130f6a7988d297910062d2c11b95a39..87d953330c0d48316d0672fc2a80083281020f9c 100644 (file)
@@ -78,12 +78,13 @@ static const String _HTTP_HEADER_PEGASUSAUTHORIZATION = "PegasusAuthorization";
 static const String _CONFIG_PARAM_ENABLEAUTHENTICATION = "enableAuthentication";
 
 HTTPAuthenticatorDelegator::HTTPAuthenticatorDelegator(
-    Uint32 operationMessageQueueId,
-    Uint32 exportMessageQueueId,
+    Uint32 cimOperationMessageQueueId,
+    Uint32 cimExportMessageQueueId,
     CIMRepository* repository)
     : Base(PEGASUS_QUEUENAME_HTTPAUTHDELEGATOR, MessageQueue::getNextQueueId()),
-      _operationMessageQueueId(operationMessageQueueId),
-      _exportMessageQueueId(exportMessageQueueId),
+      _cimOperationMessageQueueId(cimOperationMessageQueueId),
+      _cimExportMessageQueueId(cimExportMessageQueueId),
+      _wsmanOperationMessageQueueId(PEG_NOT_FOUND),
       _repository(repository)
 {
     PEG_METHOD_ENTER(TRC_HTTP,
@@ -1190,8 +1191,13 @@ void HTTPAuthenticatorDelegator::handleHTTPMessage(
         }
 
         //
-        // Search for "CIMOperation" header:
+        // Determine the type of this request:
         //
+        //   - A "CIMOperation" header indicates a CIM operation request
+        //   - A "CIMExport" header indicates a CIM export request
+        //   - A "/wsman" path in the start message indicates a WS-Man request
+        //
+
         String cimOperation;
 
         if (HTTPMessage::lookupHeader(
@@ -1203,7 +1209,7 @@ void HTTPAuthenticatorDelegator::handleHTTPMessage(
                  cimOperation));
 
             MessageQueue* queue =
-                MessageQueue::lookup(_operationMessageQueueId);
+                MessageQueue::lookup(_cimOperationMessageQueueId);
 
             if (queue)
             {
@@ -1237,7 +1243,7 @@ void HTTPAuthenticatorDelegator::handleHTTPMessage(
                 "HTTPAuthenticatorDelegator - CIMExport: $0 ",cimOperation);
 
             MessageQueue* queue =
-                MessageQueue::lookup(_exportMessageQueueId);
+                MessageQueue::lookup(_cimExportMessageQueueId);
 
             if (queue)
             {
@@ -1247,6 +1253,49 @@ void HTTPAuthenticatorDelegator::handleHTTPMessage(
                 deleteMessage = false;
             }
         }
+        else if ((_wsmanOperationMessageQueueId != PEG_NOT_FOUND) &&
+                 ((requestUri == "/wsman") ||
+                  ((requestUri == "/wsman-anon") && !enableAuthentication)))
+        {
+            // Note: DSP0226 R5.3-1 specifies if /wsman is used,
+            // unauthenticated access should not be allowed.  This "should"
+            // requirement is not implemented here, because it is difficult
+            // for a client to determine whether enableAuthentication=true.
+
+            // DSP0226 R5.3-2 specifies if /wsman-anon is used, authenticated
+            // access shall not be required.  Unauthenticated access is
+            // currently not allowed if enableAuthentication=true.  When
+            // support for wsmid:Identify is added, it will be necessary to
+            // respond to that request without requiring authentication,
+            // regardless of the CIM Server configuration.
+
+            MessageQueue* queue =
+                MessageQueue::lookup(_wsmanOperationMessageQueueId);
+
+            if (queue)
+            {
+                httpMessage->dest = queue->getQueueId();
+
+                try
+                {
+                    queue->enqueue(httpMessage);
+                }
+                catch (const bad_alloc&)
+                {
+                    delete httpMessage;
+                    _sendHttpError(
+                       queueId,
+                       HTTP_STATUS_REQUEST_TOO_LARGE,
+                       String::EMPTY,
+                       String::EMPTY,
+                       closeConnect);
+                    PEG_METHOD_EXIT();
+                    deleteMessage = false;
+                    return;
+                }
+                deleteMessage = false;
+            }
+        }
         else
         {
             // We don't recognize this request message type
index 1c70e4d50c5958850566af6fbb56bc2823a1bf55..e901e18dd44b0aeea1592263c64c10b586d50e6f 100644 (file)
@@ -62,8 +62,8 @@ public:
 
     /** Constructor. */
     HTTPAuthenticatorDelegator(
-        Uint32 operationMessageQueueId,
-        Uint32 exportMessageQueueId,
+        Uint32 cimOperationMessageQueueId,
+        Uint32 cimExportMessageQueueId,
         CIMRepository* repository);
 
     /** Destructor. */
@@ -80,6 +80,11 @@ public:
 
     void handleHTTPMessage(HTTPMessage* httpMessage, Boolean& deleteMessage);
 
+    void setWsmQueueId(Uint32 wsmanOperationMessageQueueId)
+    {
+        _wsmanOperationMessageQueueId = wsmanOperationMessageQueueId;
+    }
+
 private:
 
     void _sendResponse(
@@ -106,9 +111,9 @@ private:
         const String& pegasusError = String::EMPTY,
         Boolean closeConnect = false);
 
-    Uint32 _operationMessageQueueId;
-
-    Uint32 _exportMessageQueueId;
+    Uint32 _cimOperationMessageQueueId;
+    Uint32 _cimExportMessageQueueId;
+    Uint32 _wsmanOperationMessageQueueId;
 
     AutoPtr<AuthenticationManager> _authenticationManager;
 
index bc6e83218017429a218407cc9dff06ee6aca357b..461f9adf6c7aebc2640810adc02f3cd4a8de02a6 100644 (file)
@@ -88,6 +88,10 @@ LIBRARIES += \
        CertificateProvider
 endif
 
+ifeq ($(PEGASUS_ENABLE_PROTOCOL_WSMAN),true)
+    LIBRARIES += pegwsmserver
+endif
+
 PRE_DEPEND_INCLUDES = -I./depends
 
 SOURCES = \
@@ -115,6 +119,3 @@ SYS_LIBS = ws2_32.lib advapi32.lib
 endif
 
 include $(ROOT)/mak/library.mak
-
-run:
-       Server $(REPOSITORY_ROOT)
diff --git a/src/Pegasus/WsmServer/CimToWsmResponseMapper.cpp b/src/Pegasus/WsmServer/CimToWsmResponseMapper.cpp
new file mode 100644 (file)
index 0000000..982c18b
--- /dev/null
@@ -0,0 +1,588 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#include <cctype>
+#include <cstdio>
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/Tracer.h>
+#include <Pegasus/Common/MessageLoader.h>
+#include <Pegasus/WsmServer/WsmConstants.h>
+#include "CimToWsmResponseMapper.h"
+
+PEGASUS_NAMESPACE_BEGIN
+
+CimToWsmResponseMapper::CimToWsmResponseMapper()
+{
+}
+
+CimToWsmResponseMapper::~CimToWsmResponseMapper()
+{
+}
+
+WsmResponse* CimToWsmResponseMapper::mapToWsmResponse(
+    const WsmRequest* wsmRequest,
+    const CIMResponseMessage* message)
+{
+    AutoPtr<WsmResponse> wsmResponse;
+
+    if (message->cimException.getCode() != CIM_ERR_SUCCESS)
+    {
+        wsmResponse.reset(_mapToWsmFaultResponse(wsmRequest, message));
+    }
+    else
+    {
+        switch (message->getType())
+        {
+            case CIM_GET_INSTANCE_RESPONSE_MESSAGE:
+                wsmResponse.reset(_mapToWsmGetResponse(
+                    (WsmGetRequest*) wsmRequest,
+                    (CIMGetInstanceResponseMessage*) message));
+                break;
+
+            case CIM_MODIFY_INSTANCE_RESPONSE_MESSAGE:
+                wsmResponse.reset(_mapToWsmPutResponse(
+                    (WsmPutRequest*) wsmRequest,
+                    (CIMModifyInstanceResponseMessage*) message));
+                break;
+
+            case CIM_CREATE_INSTANCE_RESPONSE_MESSAGE:
+                wsmResponse.reset(_mapToWsmCreateResponse(
+                    (WsmCreateRequest*) wsmRequest,
+                    (CIMCreateInstanceResponseMessage*) message));
+                break;
+
+            case CIM_DELETE_INSTANCE_RESPONSE_MESSAGE:
+                wsmResponse.reset(_mapToWsmDeleteResponse(
+                    (WsmDeleteRequest*) wsmRequest,
+                    (CIMDeleteInstanceResponseMessage*) message));
+                break;
+
+            default:
+                PEGASUS_ASSERT(0);
+                break;
+        }
+    }
+    return wsmResponse.release();
+}
+
+WsmFaultResponse* CimToWsmResponseMapper::_mapToWsmFaultResponse(
+    const WsmRequest* wsmRequest,
+    const CIMResponseMessage* response)
+{
+    WsmFault fault = mapCimExceptionToWsmFault(response->cimException);
+
+    WsmFaultResponse* wsmResponse = new WsmFaultResponse(wsmRequest, fault);
+
+    return wsmResponse;
+}
+
+WsmFault CimToWsmResponseMapper::mapCimExceptionToWsmFault(
+    const CIMException& cimException)
+{
+    WsmFault::Subcode subcode;
+    const ContentLanguageList& languageList =
+        cimException.getContentLanguages();
+    String reason = TraceableCIMException(cimException).getDescription();
+    String faultDetail;
+
+    switch (cimException.getCode())
+    {
+        case CIM_ERR_FAILED:                // Too general to specify fault
+        case CIM_ERR_CLASS_HAS_CHILDREN:    // Only ModifyClass and DeleteClass
+        case CIM_ERR_CLASS_HAS_INSTANCES:   // Only ModifyClass and DeleteClass
+        case CIM_ERR_INVALID_SUPERCLASS:    // Only CreateClass and ModifyClass
+        // These could map to wsa_ActionNotSupported if InvokeMethod is
+        // supported through Custom Actions.
+        case CIM_ERR_METHOD_NOT_FOUND:      // Only InvokeMethod
+        case CIM_ERR_METHOD_NOT_AVAILABLE:  // Only InvokeMethod
+        case CIM_ERR_NO_SUCH_PROPERTY:      // Only GetProperty and SetProperty
+        case CIM_ERR_TYPE_MISMATCH:         // Only SetProperty
+            subcode = WsmFault::wsman_InternalError;
+            break;
+
+        case CIM_ERR_ACCESS_DENIED:
+            subcode = WsmFault::wsman_AccessDenied;
+            break;
+
+        case CIM_ERR_ALREADY_EXISTS:
+            subcode = WsmFault::wsman_AlreadyExists;
+            break;
+
+        case CIM_ERR_INVALID_CLASS:
+            subcode = WsmFault::wsa_DestinationUnreachable;
+            faultDetail = WSMAN_FAULTDETAIL_INVALIDRESOURCEURI;
+            break;
+
+        case CIM_ERR_INVALID_NAMESPACE:
+            // Consider wsman_InvalidSelectors?
+            subcode = WsmFault::wsa_DestinationUnreachable;
+            // faultDetail is not set to WSMAN_FAULTDETAIL_INVALIDRESOURCEURI
+            // since this error reflects an incorrect Selector value rather
+            // than an incorrect ResourceURI.
+            break;
+
+        case CIM_ERR_INVALID_PARAMETER:
+            // For InvokeMethod, this would map to wsman_InvalidParameter.
+            // It is difficult to discern the correct fault for other
+            // operations.  It make sense to use wxf_InvalidRepresentation for
+            // Create and Put, and wsman_InvalidSelectors for Get and Put.
+            subcode = WsmFault::wsman_InvalidParameter;
+            break;
+
+        case CIM_ERR_INVALID_QUERY:
+            // Note that Enumerate operations have a different subcode:
+            // wsen_CannotProcessFilter.
+            subcode = WsmFault::wsen_CannotProcessFilter;
+            break;
+
+        case CIM_ERR_NOT_FOUND:
+            // DSP0226 Table 10 of master faults calls for
+            // DestinationUnreachable in cases when the resource is no found.
+            subcode = WsmFault::wsa_DestinationUnreachable;
+            break;
+
+        case CIM_ERR_NOT_SUPPORTED:
+            subcode = WsmFault::wsa_ActionNotSupported;
+            faultDetail = WSMAN_FAULTDETAIL_ACTIONMISMATCH;
+            break;
+
+        case CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED:
+            // DSP0227 section 15.1.11 indicates that ExecuteQuery operations
+            // through WS-Management use CQL filter dialect.  If this status
+            // code results, it is fair to assume filtering is not supported
+            // at all.  Another option would be to use
+            // wsen_FilterDialectRequestedUnavailable.
+            subcode = WsmFault::wsen_FilteringNotSupported;
+            break;
+
+        default:
+            PEGASUS_ASSERT(0);
+    }
+
+    return WsmFault(subcode, reason, languageList, faultDetail);
+}
+
+WsmGetResponse* CimToWsmResponseMapper::_mapToWsmGetResponse(
+    const WsmGetRequest* wsmRequest,
+    const CIMGetInstanceResponseMessage* response)
+{
+    WsmInstance wsmInstance;
+
+    convertCimToWsmInstance(response->cimInstance, wsmInstance);
+
+    WsmGetResponse* wsmResponse =
+        new WsmGetResponse(
+            wsmInstance,
+            wsmRequest,
+            _getContentLanguages(response->operationContext));
+
+    return wsmResponse;
+}
+
+WsmPutResponse* CimToWsmResponseMapper::_mapToWsmPutResponse(
+    const WsmPutRequest* wsmRequest,
+    const CIMModifyInstanceResponseMessage* response)
+{
+    WsmPutResponse* wsmResponse =
+        new WsmPutResponse(
+            wsmRequest,
+            _getContentLanguages(response->operationContext));
+
+    return wsmResponse;
+}
+
+WsmCreateResponse* CimToWsmResponseMapper::_mapToWsmCreateResponse(
+    const WsmCreateRequest* wsmRequest,
+    const CIMCreateInstanceResponseMessage* response)
+{
+    WsmEndpointReference epr;
+
+    convertObjPathToEPR(response->instanceName, epr);
+
+    WsmCreateResponse* wsmResponse =
+        new WsmCreateResponse(
+            epr,
+            wsmRequest,
+            _getContentLanguages(response->operationContext));
+
+    return wsmResponse;
+}
+
+WsmDeleteResponse* CimToWsmResponseMapper::_mapToWsmDeleteResponse(
+    const WsmDeleteRequest* wsmRequest,
+    const CIMDeleteInstanceResponseMessage* response)
+{
+    WsmDeleteResponse* wsmResponse =
+        new WsmDeleteResponse(
+            wsmRequest,
+            _getContentLanguages(response->operationContext));
+
+    return wsmResponse;
+}
+
+void CimToWsmResponseMapper::convertCimToWsmInstance(
+    const CIMInstance& cimInstance,
+    WsmInstance& wsmInstance)
+{
+    wsmInstance.setClassName(cimInstance.getClassName().getString());
+
+    for (Uint32 i = 0, n = cimInstance.getPropertyCount(); i < n; i++)
+    {
+        CIMConstProperty cimProperty = cimInstance.getProperty(i);
+        const String& propertyName = cimProperty.getName().getString();
+        const CIMValue& cimValue = cimProperty.getValue();
+
+        WsmValue wsmValue;
+        convertCimToWsmValue(cimValue, wsmValue);
+
+        WsmProperty wsmProperty(propertyName, wsmValue);
+        wsmInstance.addProperty(wsmProperty);
+    }
+}
+
+template<class T>
+static void _convertCimToWsmArrayValue(
+    const CIMValue& cimValue,
+    WsmValue& wsmValue)
+{
+    Array<T> arr;
+    Array<String> strs;
+
+    cimValue.get(arr);
+    for (Uint32 i = 0, n = arr.size(); i < n; i++)
+    {
+        CIMValue val(arr[i]);
+        String str(val.toString());
+        if (val.getType() == CIMTYPE_BOOLEAN)
+        {
+            str.toLower();
+        }
+        strs.append(str);
+    }
+    wsmValue.set(strs);
+}
+
+void CimToWsmResponseMapper::convertCimToWsmValue(
+     const CIMValue& cimValue,
+     WsmValue& wsmValue)
+{
+    if (cimValue.isNull())
+    {
+        wsmValue.setNull();
+        return;
+    }
+
+    if (cimValue.isArray())
+    {
+        switch (cimValue.getType())
+        {
+            case CIMTYPE_BOOLEAN:
+            {
+                _convertCimToWsmArrayValue<Boolean>(cimValue, wsmValue);
+                break;
+            }
+
+            case CIMTYPE_UINT8:
+            {
+                _convertCimToWsmArrayValue<Uint8>(cimValue, wsmValue);
+                break;
+            }
+
+            case CIMTYPE_SINT8:
+            {
+                _convertCimToWsmArrayValue<Sint8>(cimValue, wsmValue);
+                break;
+            }
+
+            case CIMTYPE_UINT16:
+            {
+                _convertCimToWsmArrayValue<Uint16>(cimValue, wsmValue);
+                break;
+            }
+
+            case CIMTYPE_SINT16:
+            {
+                _convertCimToWsmArrayValue<Sint16>(cimValue, wsmValue);
+                break;
+            }
+
+            case CIMTYPE_UINT32:
+            {
+                _convertCimToWsmArrayValue<Uint32>(cimValue, wsmValue);
+                break;
+            }
+
+            case CIMTYPE_SINT32:
+            {
+                _convertCimToWsmArrayValue<Sint32>(cimValue, wsmValue);
+                break;
+            }
+
+            case CIMTYPE_UINT64:
+            {
+                _convertCimToWsmArrayValue<Uint64>(cimValue, wsmValue);
+                break;
+            }
+
+            case CIMTYPE_SINT64:
+            {
+                _convertCimToWsmArrayValue<Sint64>(cimValue, wsmValue);
+                break;
+            }
+
+            case CIMTYPE_REAL32:
+            {
+                _convertCimToWsmArrayValue<Real32>(cimValue, wsmValue);
+                break;
+            }
+
+            case CIMTYPE_REAL64:
+            {
+                _convertCimToWsmArrayValue<Real64>(cimValue, wsmValue);
+                break;
+            }
+
+            case CIMTYPE_CHAR16:
+            {
+                _convertCimToWsmArrayValue<Char16>(cimValue, wsmValue);
+                break;
+            }
+
+            case CIMTYPE_STRING:
+            {
+                _convertCimToWsmArrayValue<String>(cimValue, wsmValue);
+                break;
+            }
+
+            case CIMTYPE_DATETIME:
+            {
+                Array<CIMDateTime> dates;
+                Array<String> strs;
+                cimValue.get(dates);
+                for (Uint32 i = 0, n = dates.size(); i < n; i++)
+                {
+                    strs.append(dates[i].toString());
+                }
+                wsmValue.set(strs);
+                break;
+            }
+
+            case CIMTYPE_REFERENCE:
+            {
+                Array<WsmEndpointReference> eprs;
+                Array<CIMObjectPath> objPaths;
+                cimValue.get(objPaths);
+
+                for (Uint32 i = 0, n = objPaths.size(); i < n; i++)
+                {
+                    WsmEndpointReference epr;
+                    convertObjPathToEPR(objPaths[i], epr);
+                    eprs.append(epr);
+                }
+                wsmValue.set(eprs);
+                break;
+            }
+
+            case CIMTYPE_OBJECT:
+            {
+                Array<WsmInstance> wsmInstances;
+                Array<CIMObject> cimObjects;
+                cimValue.get(cimObjects);
+                for (Uint32 i = 0, n = cimObjects.size(); i < n; i++)
+                {
+                    if (cimObjects[i].isInstance())
+                    {
+                        WsmInstance wsmInstance;
+                        convertCimToWsmInstance(
+                            CIMInstance(cimObjects[i]), wsmInstance);
+                        wsmInstances.append(wsmInstance);
+                    }
+                    else
+                    {
+                        throw WsmFault(WsmFault::wsman_InternalError,
+                            MessageLoaderParms(
+                                "WsmServer.CimToWsmResponseMapper."
+                                    "EMBEDDED_CLASS_NOT_SUPPORTED",
+                                "Embedded class objects in WS-Management "
+                                    "responses are not supported."));
+                    }
+                }
+                wsmValue.set(wsmInstances);
+                break;
+            }
+
+#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT
+            case CIMTYPE_INSTANCE:
+            {
+                Array<WsmInstance> wsmInstances;
+                Array<CIMInstance> cimInstances;
+                cimValue.get(cimInstances);
+                for (Uint32 i = 0, n = cimInstances.size(); i < n; i++)
+                {
+                    WsmInstance wsmInstance;
+                    convertCimToWsmInstance(cimInstances[i], wsmInstance);
+                    wsmInstances.append(wsmInstance);
+                }
+                wsmValue.set(wsmInstances);
+                break;
+            }
+#endif
+
+            default:
+            {
+                PEGASUS_ASSERT(0);
+            }
+        }
+    }
+    else
+    {
+        switch (cimValue.getType())
+        {
+            case CIMTYPE_BOOLEAN:
+            {
+                String str(cimValue.toString());
+                str.toLower();
+                wsmValue.set(str);
+                break;
+            }
+            case CIMTYPE_UINT8:
+            case CIMTYPE_SINT8:
+            case CIMTYPE_UINT16:
+            case CIMTYPE_SINT16:
+            case CIMTYPE_UINT32:
+            case CIMTYPE_SINT32:
+            case CIMTYPE_UINT64:
+            case CIMTYPE_SINT64:
+            case CIMTYPE_REAL32:
+            case CIMTYPE_REAL64:
+            case CIMTYPE_CHAR16:
+            case CIMTYPE_STRING:
+            case CIMTYPE_DATETIME:
+            {
+                wsmValue.set(cimValue.toString());
+                break;
+            }
+            case CIMTYPE_REFERENCE:
+            {
+                WsmEndpointReference epr;
+                CIMObjectPath objPath;
+                cimValue.get(objPath);
+                convertObjPathToEPR(objPath, epr);
+                wsmValue.set(epr);
+                break;
+            }
+            case CIMTYPE_OBJECT:
+            {
+                CIMObject cimObject;
+                cimValue.get(cimObject);
+                if (cimObject.isInstance())
+                {
+                    WsmInstance wsmInstance;
+                    convertCimToWsmInstance(
+                        CIMInstance(cimObject), wsmInstance);
+                    wsmValue.set(wsmInstance);
+                }
+                else
+                {
+                    throw WsmFault(WsmFault::wsman_InternalError,
+                        MessageLoaderParms(
+                            "WsmServer.CimToWsmResponseMapper."
+                                "EMBEDDED_CLASS_NOT_SUPPORTED",
+                            "Embedded class objects in WS-Management "
+                                "responses are not supported"));
+                }
+                break;
+            }
+#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT
+            case CIMTYPE_INSTANCE:
+            {
+                WsmInstance wsmInstance;
+                CIMInstance cimInstance;
+                cimValue.get(cimInstance);
+                convertCimToWsmInstance(cimInstance, wsmInstance);
+                wsmValue.set(wsmInstance);
+                break;
+            }
+#endif
+            default:
+            {
+                PEGASUS_ASSERT(0);
+            }
+        }
+    }
+}
+
+void CimToWsmResponseMapper::convertObjPathToEPR(
+    const CIMObjectPath& objPath,
+    WsmEndpointReference& epr)
+{
+    // Since the connection protocol is unknown at this point, we assume
+    // it's http and form an EPR address by concatenating "http://" with
+    // the host name in the object path,  with "/wsman".
+    if (objPath.getHost().size() > 0)
+        epr.address = "http://" + objPath.getHost() + "/wsman";
+    else
+        epr.address = WSM_ADDRESS_ANONYMOUS;
+
+    epr.resourceUri = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/" +
+        objPath.getClassName().getString();
+
+    CIMNamespaceName cimNS = objPath.getNameSpace();
+    if (!cimNS.isNull())
+    {
+        WsmSelector selector(String("__cimnamespace"), cimNS.getString());
+        epr.selectorSet->selectors.append(selector);
+    }
+
+    const Array<CIMKeyBinding>& keyBindings = objPath.getKeyBindings();
+    for (Uint32 i = 0, n = keyBindings.size(); i < n; i++)
+    {
+        CIMKeyBinding binding = keyBindings[i];
+        if (binding.getType() == CIMKeyBinding::REFERENCE)
+        {
+            CIMObjectPath cimRef = binding.getValue();
+            WsmEndpointReference wsmRef;
+            convertObjPathToEPR(cimRef, wsmRef);
+            WsmSelector selector(binding.getName().getString(), wsmRef);
+            epr.selectorSet->selectors.append(selector);
+        }
+        else
+        {
+            WsmSelector selector(binding.getName().getString(),
+                binding.getValue());
+            epr.selectorSet->selectors.append(selector);
+        }
+    }
+}
+
+PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/WsmServer/CimToWsmResponseMapper.h b/src/Pegasus/WsmServer/CimToWsmResponseMapper.h
new file mode 100644 (file)
index 0000000..bb0fcef
--- /dev/null
@@ -0,0 +1,100 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_CimToWsmResponseMapper_h
+#define Pegasus_CimToWsmResponseMapper_h
+
+#include <Pegasus/Common/CIMMessage.h>
+#include <Pegasus/WsmServer/WsmResponse.h>
+#include <Pegasus/WsmServer/WsmRequest.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+/**
+    Converts CIMResponseMessage messages to WsmResponses.
+*/
+class PEGASUS_WSMSERVER_LINKAGE CimToWsmResponseMapper
+{
+public:
+
+    CimToWsmResponseMapper();
+    ~CimToWsmResponseMapper();
+
+    WsmResponse* mapToWsmResponse(
+        const WsmRequest* wsmRequest,
+        const CIMResponseMessage* message);
+    WsmFault mapCimExceptionToWsmFault(const CIMException& cimException);
+
+    void convertCimToWsmInstance(
+        const CIMInstance& cimInstance,
+        WsmInstance& wsmInstance);
+    void convertCimToWsmValue(
+        const CIMValue& cimValue,
+        WsmValue& wsmValue);
+    void convertObjPathToEPR(
+        const CIMObjectPath& objPath,
+        WsmEndpointReference& epr);
+
+private:
+
+    WsmGetResponse* _mapToWsmGetResponse(
+        const WsmGetRequest* wsmRequest,
+        const CIMGetInstanceResponseMessage* response);
+    WsmPutResponse* _mapToWsmPutResponse(
+        const WsmPutRequest* wsmRequest,
+        const CIMModifyInstanceResponseMessage* response);
+    WsmCreateResponse* _mapToWsmCreateResponse(
+        const WsmCreateRequest* wsmRequest,
+        const CIMCreateInstanceResponseMessage* response);
+    WsmDeleteResponse* _mapToWsmDeleteResponse(
+        const WsmDeleteRequest* wsmRequest,
+        const CIMDeleteInstanceResponseMessage* response);
+    WsmFaultResponse* _mapToWsmFaultResponse(
+        const WsmRequest* wsmRequest,
+        const CIMResponseMessage* message);
+
+    ContentLanguageList _getContentLanguages(const OperationContext& context)
+    {
+        if (context.contains(ContentLanguageListContainer::NAME))
+        {
+            return ((ContentLanguageListContainer)
+                context.get(ContentLanguageListContainer::NAME)).getLanguages();
+        }
+
+        return ContentLanguageList();
+    }
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_CimToWsmResponseMapper_h */
diff --git a/src/Pegasus/WsmServer/Linkage.h b/src/Pegasus/WsmServer/Linkage.h
new file mode 100644 (file)
index 0000000..8f57903
--- /dev/null
@@ -0,0 +1,42 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#include <Pegasus/Common/Config.h>
+
+#ifndef PEGASUS_WSMSERVER_LINKAGE
+#   ifdef PEGASUS_WSMSERVER_INTERNAL
+#       define PEGASUS_WSMSERVER_LINKAGE PEGASUS_EXPORT
+#   else
+#       define PEGASUS_WSMSERVER_LINKAGE PEGASUS_IMPORT
+#   endif
+#endif
diff --git a/src/Pegasus/WsmServer/Makefile b/src/Pegasus/WsmServer/Makefile
new file mode 100644 (file)
index 0000000..6293b39
--- /dev/null
@@ -0,0 +1,65 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#// 
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//==============================================================================
+ROOT = ../../..
+
+DIR = Pegasus/WsmServer
+
+include $(ROOT)/mak/config.mak
+
+EXTRA_INCLUDES = $(SYS_INCLUDES)
+
+LOCAL_DEFINES = -DPEGASUS_WSMSERVER_INTERNAL -DPEGASUS_INTERNALONLY
+
+STATIC=1
+LIBRARY = pegwsmserver
+
+LIBRARIES = \
+    pegrepository \
+    pegconfig \
+    pegcommon
+
+SOURCES = \
+    WsmConstants.cpp \
+    WsmUtils.cpp \
+    WsmEndpointReference.cpp \
+    WsmValue.cpp \
+    WsmProperty.cpp \
+    WsmInstance.cpp \
+    WsmFault.cpp \
+    WsmReader.cpp \
+    WsmWriter.cpp \
+    WsmRequestDecoder.cpp \
+    WsmResponseEncoder.cpp \
+    WsmToCimRequestMapper.cpp \
+    CimToWsmResponseMapper.cpp \
+    WsmProcessor.cpp
+
+include $(ROOT)/mak/library.mak
diff --git a/src/Pegasus/WsmServer/WsmConstants.cpp b/src/Pegasus/WsmServer/WsmConstants.cpp
new file mode 100644 (file)
index 0000000..2e58d8f
--- /dev/null
@@ -0,0 +1,46 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#include <Pegasus/Common/Config.h>
+#include "WsmConstants.h"
+
+PEGASUS_NAMESPACE_BEGIN
+
+//
+// CIM Namespace Names
+//
+
+const CIMNamespaceName PEGASUS_DEFAULT_WSM_NAMESPACE =
+    CIMNamespaceName("root/cimv2");
+
+PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/WsmServer/WsmConstants.h b/src/Pegasus/WsmServer/WsmConstants.h
new file mode 100644 (file)
index 0000000..a6ad51f
--- /dev/null
@@ -0,0 +1,184 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_WsmConstants_h
+#define Pegasus_WsmConstants_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/CIMName.h>
+
+//
+// Message Queue Names
+//
+
+#define PEGASUS_QUEUENAME_WSMREQDECODER       "WsmRequestDecoder"
+#define PEGASUS_QUEUENAME_WSMRESPENCODER      "WsmResponseEncoder"
+#define PEGASUS_QUEUENAME_WSMPROCESSOR        "WsmProcessor"
+
+//
+// Minimum allowable value for MaxEnvelopeSize
+//
+
+#define WSM_MIN_MAXENVELOPESIZE_VALUE 8192
+
+//
+// WS-Management URIs
+//
+
+#define WSM_ADDRESS_ANONYMOUS \
+    "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"
+
+// See DSP0227 R5.2-1, R6-1, and R7.1-7.
+#define WSM_RESOURCEURI_ALLCLASSES \
+    "http://schemas.dmtf.org/wbem/wscim/1/*"
+
+#define WSM_RESOURCEURI_CIMSCHEMAV2 \
+    "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2"
+
+
+//
+// Action URIs
+//
+
+#define WSM_ACTION_GET \
+    "http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"
+
+#define WSM_ACTION_GET_RESPONSE \
+    "http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse"
+
+#define WSM_ACTION_PUT \
+    "http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"
+
+#define WSM_ACTION_PUT_RESPONSE \
+    "http://schemas.xmlsoap.org/ws/2004/09/transfer/PutResponse"
+
+#define WSM_ACTION_CREATE \
+    "http://schemas.xmlsoap.org/ws/2004/09/transfer/Create"
+
+#define WSM_ACTION_CREATE_RESPONSE \
+    "http://schemas.xmlsoap.org/ws/2004/09/transfer/CreateResponse"
+
+#define WSM_ACTION_DELETE \
+    "http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"
+
+#define WSM_ACTION_DELETE_RESPONSE \
+    "http://schemas.xmlsoap.org/ws/2004/09/transfer/DeleteResponse"
+
+#define WSM_ACTION_ENUMERATE \
+    "http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"
+
+#define WSM_ACTION_ENUMERATE_RESPONSE \
+    "http://schemas.xmlsoap.org/ws/2004/09/enumeration/EnumerateResponse"
+
+#define WSM_ACTION_PULL \
+    "http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"
+
+#define WSM_ACTION_PULL_RESPONSE \
+    "http://schemas.xmlsoap.org/ws/2004/09/enumeration/PullResponse"
+
+#define WSM_ACTION_RELEASE \
+    "http://schemas.xmlsoap.org/ws/2004/09/enumeration/Release"
+
+#define WSM_ACTION_RELEASE_RESPONSE \
+    "http://schemas.xmlsoap.org/ws/2004/09/enumeration/ReleaseResponse"
+
+#define WSM_ACTION_WSMAN_FAULT \
+    "http://schemas.dmtf.org/wbem/wsman/1/wsman/fault"
+
+#define WSM_ACTION_WSA_FAULT \
+    "http://schemas.xmlsoap.org/ws/2004/08/addressing/fault"
+
+#define WSM_ACTION_WXF_FAULT \
+    "http://schemas.xmlsoap.org/ws/2004/09/transfer/fault"
+
+#define WSM_ACTION_WSEN_FAULT \
+    "http://schemas.xmlsoap.org/ws/2004/09/enumeration/fault"
+
+#define WSM_ACTION_WSE_FAULT \
+    "http://schemas.xmlsoap.org/ws/2004/08/eventing/fault"
+
+
+//
+// WS-Management FaultDetail URI values
+//
+
+#define WSMAN_FAULTDETAIL_ACTIONMISMATCH \
+    "http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/ActionMismatch"
+
+#define WSMAN_FAULTDETAIL_ADDRESSINGMODE \
+    "http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/AddressingMode"
+
+#define WSMAN_FAULTDETAIL_CHARACTERSET \
+    "http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/CharacterSet"
+
+#define WSMAN_FAULTDETAIL_FRAGMENTLEVELACCESS \
+    "http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/FragmentLevelAccess"
+
+#define WSMAN_FAULTDETAIL_INVALIDRESOURCEURI \
+    "http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/InvalidResourceURI"
+
+#define WSMAN_FAULTDETAIL_INVALIDVALUE \
+    "http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/InvalidValue"
+
+#define WSMAN_FAULTDETAIL_LOCALE \
+    "http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/Locale"
+
+#define WSMAN_FAULTDETAIL_OPERATIONTIMEOUT \
+    "http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/OperationTimeout"
+
+#define WSMAN_FAULTDETAIL_TYPEMISMATCH \
+    "http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/TypeMismatch"
+
+#define WSMAN_FAULTDETAIL_UNEXPECTEDSELECTORS \
+    "http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/UnexpectedSelectors"
+
+#define WSMAN_FAULTDETAIL_MINIMUMENVELOPELIMIT \
+   "http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/MinimumEnvelopeLimit"
+
+#define WSMAN_FAULTDETAIL_MAXENVELOPESIZE \
+    "http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/MaxEnvelopeSize"
+
+#define WSMAN_FAULTDETAIL_UNREPORTABLESUCCESS \
+    "http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/UnreportableSuccess"
+
+PEGASUS_NAMESPACE_BEGIN
+
+//
+// CIM Namespace Names
+//
+
+extern const CIMNamespaceName PEGASUS_DEFAULT_WSM_NAMESPACE;
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_WsmConstants_h */
diff --git a/src/Pegasus/WsmServer/WsmEndpointReference.cpp b/src/Pegasus/WsmServer/WsmEndpointReference.cpp
new file mode 100644 (file)
index 0000000..608b202
--- /dev/null
@@ -0,0 +1,88 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/WsmServer/WsmSelectorSet.h>
+#include "WsmEndpointReference.h"
+
+PEGASUS_NAMESPACE_BEGIN
+
+WsmEndpointReference::WsmEndpointReference()
+{
+    selectorSet = new WsmSelectorSet;
+}
+
+WsmEndpointReference::~WsmEndpointReference()
+{
+    delete selectorSet;
+}
+
+WsmEndpointReference::WsmEndpointReference(const WsmEndpointReference& epr)
+    : address(epr.address),
+      resourceUri(epr.resourceUri)
+{
+    if (epr.selectorSet)
+    {
+        selectorSet = new WsmSelectorSet;
+        selectorSet->selectors = epr.selectorSet->selectors;
+    }
+    else
+    {
+        selectorSet = 0;
+    }
+}
+
+WsmEndpointReference& WsmEndpointReference::operator=(
+    const WsmEndpointReference& epr)
+{
+    if (this != &epr)
+    {
+        address = epr.address;
+        resourceUri = epr.resourceUri;
+
+        delete selectorSet;
+        if (epr.selectorSet)
+        {
+            selectorSet = new WsmSelectorSet;
+            selectorSet->selectors = epr.selectorSet->selectors;
+        }
+        else
+        {
+            selectorSet = 0;
+        }
+    }
+
+    return *this;
+}
+
+PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/WsmServer/WsmEndpointReference.h b/src/Pegasus/WsmServer/WsmEndpointReference.h
new file mode 100644 (file)
index 0000000..0f6ef91
--- /dev/null
@@ -0,0 +1,62 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _Pegasus_WsmEndpointReference_h
+#define _Pegasus_WsmEndpointReference_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/String.h>
+#include <Pegasus/WsmServer/Linkage.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+class WsmSelectorSet;
+
+class PEGASUS_WSMSERVER_LINKAGE WsmEndpointReference
+{
+public:
+
+    WsmEndpointReference();
+    WsmEndpointReference(const WsmEndpointReference& epr);
+    ~WsmEndpointReference();
+
+    WsmEndpointReference& operator=(const WsmEndpointReference& epr);
+
+    String address;
+    String resourceUri;
+    WsmSelectorSet* selectorSet;
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif /* _Pegasus_WsmEndpointReference_h */
diff --git a/src/Pegasus/WsmServer/WsmFault.cpp b/src/Pegasus/WsmServer/WsmFault.cpp
new file mode 100644 (file)
index 0000000..3ca619b
--- /dev/null
@@ -0,0 +1,450 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/WsmServer/WsmConstants.h>
+#include "WsmFault.h"
+
+PEGASUS_NAMESPACE_BEGIN
+
+//
+// This table represents the normative fault list for WS-Management, as
+// defined in DSP0226 section 14.6.
+//
+
+WsmFault::FaultTableEntry WsmFault::_faultTable[] =
+{
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsman_AccessDenied,
+        WsmNamespaces::WS_MAN,
+        "AccessDenied",
+        // The sender was not authorized to access the resource.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsa_ActionNotSupported,
+        WsmNamespaces::WS_ADDRESSING,
+        "ActionNotSupported",
+        // The action is not supported by the service.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsman_AlreadyExists,
+        WsmNamespaces::WS_MAN,
+        "AlreadyExists",
+        // The sender attempted to create a resource that already exists.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsen_CannotProcessFilter,
+        WsmNamespaces::WS_ENUMERATION,
+        "CannotProcessFilter",
+        // The requested filter could not be processed.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsman_Concurrency,
+        WsmNamespaces::WS_MAN,
+        "Concurrency",
+        // The action could not be completed due to concurrency or
+        // locking problems.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wse_DeliveryModeRequestedUnavailable,
+        WsmNamespaces::WS_EVENTING,
+        "DeliveryModeRequestedUnavailable",
+        // The requested delivery mode is not supported.
+    },
+    {
+        WsmFault::s_Receiver,
+        WsmFault::wsman_DeliveryRefused,
+        WsmNamespaces::WS_MAN,
+        "DeliveryRefused",
+        // The receiver refuses to accept delivery of events and
+        // requests that the subscription be canceled.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsa_DestinationUnreachable,
+        WsmNamespaces::WS_ADDRESSING,
+        "DestinationUnreachable",
+        // No route can be determined to reach the destination role
+        // defined by the WS-Addressing To header.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsman_EncodingLimit,
+        WsmNamespaces::WS_MAN,
+        "EncodingLimit",
+        // An internal encoding limit was exceeded in a request or
+        // would be violated if the message was processed.
+    },
+    {
+        WsmFault::s_Receiver,
+        WsmFault::wsa_EndpointUnavailable,
+        WsmNamespaces::WS_ADDRESSING,
+        "EndpointUnavailable",
+        // The specified endpoint is currently unavailable.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wse_EventSourceUnableToProcess,
+        WsmNamespaces::WS_EVENTING,
+        "EventSourceUnableToProcess",
+        // The event source cannot process the subscription.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsen_FilterDialectRequestedUnavailable,
+        WsmNamespaces::WS_ENUMERATION,
+        "FilterDialectRequestedUnavailable",
+        // The requested filtering dialect is not supported.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wse_FilteringNotSupported,
+        WsmNamespaces::WS_EVENTING,
+        "FilteringNotSupported",
+        // Filtering over the event source is not supported.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsen_FilteringNotSupported,
+        WsmNamespaces::WS_ENUMERATION,
+        "FilteringNotSupported",
+        // Filtered enumeration is not supported.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wse_FilteringRequestedUnavailable,
+        WsmNamespaces::WS_EVENTING,
+        "FilteringRequestedUnavailable",
+        // The requested filter dialect is not supported.
+    },
+    {
+        WsmFault::s_Receiver,
+        WsmFault::wsman_InternalError,
+        WsmNamespaces::WS_MAN,
+        "InternalError",
+        // The service cannot comply with the request due to internal
+        // processing errors.
+    },
+    {
+        WsmFault::s_Receiver,
+        WsmFault::wsman_FragmentDialectNotSupported,
+        WsmNamespaces::WS_MAN,
+        "FragmentDialectNotSupported",
+        // The requested fragment filtering dialect or language
+        // is not supported.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsman_InvalidBookmark,
+        WsmNamespaces::WS_MAN,
+        "InvalidBookmark",
+        // The bookmark supplied with the subscription is not valid.
+    },
+    {
+        WsmFault::s_Receiver,
+        WsmFault::wsen_InvalidEnumerationContext,
+        WsmNamespaces::WS_ENUMERATION,
+        "InvalidEnumerationContext",
+        // The supplied enumeration context is invalid.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wse_InvalidExpirationTime,
+        WsmNamespaces::WS_EVENTING,
+        "InvalidExpirationTime",
+        // The expiration time is not valid.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsen_InvalidExpirationTime,
+        WsmNamespaces::WS_ENUMERATION,
+        "InvalidExpirationTime",
+        // The expiration time is not valid.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wse_InvalidMessage,
+        WsmNamespaces::WS_EVENTING,
+        "InvalidMessage",
+        // The request message has unknown or invalid content and
+        // cannot be processed.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsa_InvalidMessageInformationHeader,
+        WsmNamespaces::WS_ADDRESSING,
+        "InvalidMessageInformationHeader",
+        // A message information header is not valid and the message
+        // cannot be processed.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsman_InvalidOptions,
+        WsmNamespaces::WS_MAN,
+        "InvalidOptions",
+        // One or more options are not valid.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsman_InvalidParameter,
+        WsmNamespaces::WS_MAN,
+        "InvalidParameter",
+        // An operation parameter is not valid.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wxf_InvalidRepresentation,
+        WsmNamespaces::WS_TRANSFER,
+        "InvalidRepresentation",
+        // The XML content is not valid.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsman_InvalidSelectors,
+        WsmNamespaces::WS_MAN,
+        "InvalidSelectors",
+        // The selectors for the resource are not valid.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsa_MessageInformationHeaderRequired,
+        WsmNamespaces::WS_ADDRESSING,
+        "MessageInformationHeaderRequired",
+        // A required header is missing.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsman_NoAck,
+        WsmNamespaces::WS_MAN,
+        "NoAck",
+        // The receiver did not acknowledge the event delivery.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsman_QuotaLimit,
+        WsmNamespaces::WS_MAN,
+        "QuotaLimit",
+        // The service is busy servicing other requests.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsman_SchemaValidationError,
+        WsmNamespaces::WS_MAN,
+        "SchemaValidationError",
+        // The supplied SOAP violates the corresponding XML schema definition.
+    },
+    {
+        WsmFault::s_Receiver,
+        WsmFault::wsen_TimedOut,
+        WsmNamespaces::WS_ENUMERATION,
+        "TimedOut",
+        // The enumerator has timed out and is no longer valid.
+    },
+    {
+        WsmFault::s_Receiver,
+        WsmFault::wsman_TimedOut,
+        WsmNamespaces::WS_MAN,
+        "TimedOut",
+        // The operation has timed out.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wse_UnableToRenew,
+        WsmNamespaces::WS_EVENTING,
+        "UnableToRenew",
+        // The subscription could not be renewed.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wse_UnsupportedExpirationType,
+        WsmNamespaces::WS_EVENTING,
+        "UnsupportedExpirationType",
+        // The specified expiration type is not supported.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsen_UnsupportedExpirationType,
+        WsmNamespaces::WS_ENUMERATION,
+        "UnsupportedExpirationType",
+        // The specified expiration type is not supported.
+    },
+    {
+        WsmFault::s_Sender,
+        WsmFault::wsman_UnsupportedFeature,
+        WsmNamespaces::WS_MAN,
+        "UnsupportedFeature",
+        // The specified feature is not supported.
+    }
+};
+
+
+WsmFault::WsmFault(
+    Subcode subcode,
+    const MessageLoaderParms& msgParms,
+    const String& faultDetail)
+    : _subcode(subcode),
+      _faultDetail(faultDetail)
+{
+    _reason = MessageLoader::getMessage(
+        const_cast<MessageLoaderParms &>(msgParms));
+    // Must be after MessageLoader::getMessage call
+    _reasonLanguage = msgParms.contentlanguages;
+}
+
+WsmFault::WsmFault(
+    Subcode subcode,
+    const String& reason,
+    const ContentLanguageList& reasonLanguage,
+    const String& faultDetail)
+    : _subcode(subcode),
+      _reason(reason),
+      _reasonLanguage(reasonLanguage),
+      _faultDetail(faultDetail)
+{
+}
+
+WsmFault::WsmFault(const WsmFault& fault)
+    : _subcode(fault._subcode),
+      _reason(fault._reason),
+      _reasonLanguage(fault._reasonLanguage),
+      _faultDetail(fault._faultDetail)
+{
+}
+
+const char* WsmFault::getAction() const
+{
+    if (_faultTable[_subcode].nsType == WsmNamespaces::WS_MAN)
+    {
+        return WSM_ACTION_WSMAN_FAULT;
+    }
+
+    if (_faultTable[_subcode].nsType == WsmNamespaces::WS_ADDRESSING)
+    {
+        return WSM_ACTION_WSA_FAULT;
+    }
+
+    if (_faultTable[_subcode].nsType == WsmNamespaces::WS_TRANSFER)
+    {
+        return WSM_ACTION_WXF_FAULT;
+    }
+
+    if (_faultTable[_subcode].nsType == WsmNamespaces::WS_ENUMERATION)
+    {
+        return WSM_ACTION_WSEN_FAULT;
+    }
+
+    PEGASUS_ASSERT(_faultTable[_subcode].nsType == WsmNamespaces::WS_EVENTING);
+    return WSM_ACTION_WSE_FAULT;
+}
+
+String WsmFault::getCode() const
+{
+    String strCode = WsmNamespaces::supportedNamespaces[
+        WsmNamespaces::SOAP_ENVELOPE].localName;
+    if (_faultTable[_subcode].code == s_Sender)
+        strCode = strCode + ":Sender";
+    else
+        strCode = strCode + ":Receiver";
+
+    return strCode;
+}
+
+String WsmFault::getSubcode() const
+{
+    return
+        String(WsmNamespaces::supportedNamespaces[
+            _faultTable[_subcode].nsType].localName) +
+        ":" +
+        _faultTable[_subcode].subcodeStr;
+}
+
+String WsmFault::getReason() const
+{
+    return _reason;
+}
+
+ContentLanguageList WsmFault::getReasonLanguage() const
+{
+    return _reasonLanguage;
+}
+
+String WsmFault::getFaultDetail() const
+{
+    return _faultDetail;
+}
+
+
+//
+// SoapNotUnderstoodFault
+//
+
+SoapNotUnderstoodFault::SoapNotUnderstoodFault(
+    const String& nameSpace,
+    const String& headerName)
+    : _nameSpace(nameSpace),
+      _headerName(headerName)
+{
+    MessageLoaderParms parms(
+        "WsmServer.WsmFault.SOAP_HEADER_NOT_UNDERSTOOD",
+        "Header not understood.");
+    _message = MessageLoader::getMessage(parms);
+    _messageLanguage = parms.contentlanguages;
+}
+
+String SoapNotUnderstoodFault::getNamespace() const
+{
+    return _nameSpace;
+}
+
+String SoapNotUnderstoodFault::getHeaderName() const
+{
+    return _headerName;
+}
+
+String SoapNotUnderstoodFault::getMessage() const
+{
+    return _message;
+}
+
+ContentLanguageList SoapNotUnderstoodFault::getMessageLanguage() const
+{
+    return _messageLanguage;
+}
+
+PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/WsmServer/WsmFault.h b/src/Pegasus/WsmServer/WsmFault.h
new file mode 100644 (file)
index 0000000..fbf8900
--- /dev/null
@@ -0,0 +1,165 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_WsmFault_h
+#define Pegasus_WsmFault_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/Linkage.h>
+#include <Pegasus/Common/String.h>
+#include <Pegasus/Common/ContentLanguageList.h>
+#include <Pegasus/Common/MessageLoader.h>
+#include <Pegasus/WsmServer/WsmRequest.h>
+#include <Pegasus/WsmServer/WsmUtils.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+
+class PEGASUS_WSMSERVER_LINKAGE  WsmFault
+{
+public:
+
+    enum Code
+    {
+        s_Sender,
+        s_Receiver
+    };
+
+    enum Subcode
+    {
+        wsman_AccessDenied,
+        wsa_ActionNotSupported,
+        wsman_AlreadyExists,
+        wsen_CannotProcessFilter,
+        wsman_Concurrency,
+        wse_DeliveryModeRequestedUnavailable,
+        wsman_DeliveryRefused,
+        wsa_DestinationUnreachable,
+        wsman_EncodingLimit,
+        wsa_EndpointUnavailable,
+        wse_EventSourceUnableToProcess,
+        wsen_FilterDialectRequestedUnavailable,
+        wse_FilteringNotSupported,
+        wsen_FilteringNotSupported,
+        wse_FilteringRequestedUnavailable,
+        wsman_InternalError,
+        wsman_FragmentDialectNotSupported,
+        wsman_InvalidBookmark,
+        wsen_InvalidEnumerationContext,
+        wse_InvalidExpirationTime,
+        wsen_InvalidExpirationTime,
+        wse_InvalidMessage,
+        wsa_InvalidMessageInformationHeader,
+        wsman_InvalidOptions,
+        wsman_InvalidParameter,
+        wxf_InvalidRepresentation,
+        wsman_InvalidSelectors,
+        wsa_MessageInformationHeaderRequired,
+        wsman_NoAck,
+        wsman_QuotaLimit,
+        wsman_SchemaValidationError,
+        wsen_TimedOut,
+        wsman_TimedOut,
+        wse_UnableToRenew,
+        wse_UnsupportedExpirationType,
+        wsen_UnsupportedExpirationType,
+        wsman_UnsupportedFeature
+    };
+
+    struct FaultTableEntry
+    {
+        Code code;
+        Subcode subcode;
+        WsmNamespaces::Type nsType;
+        const char* subcodeStr;
+    };
+
+    WsmFault(
+        Subcode subcode,
+        const MessageLoaderParms& msgParms,
+        const String& faultDetail = String::EMPTY);
+
+    WsmFault(
+        Subcode subcode,
+        const String& reason = String::EMPTY,
+        const ContentLanguageList& reasonLanguage = ContentLanguageList(),
+        const String& faultDetail = String::EMPTY);
+
+    WsmFault(const WsmFault& fault);
+
+    ~WsmFault()
+    {
+    }
+
+    const char* getAction() const;
+    String getCode() const;
+    String getSubcode() const;
+    String getReason() const;
+    ContentLanguageList getReasonLanguage() const;
+    String getFaultDetail() const;
+    // Note: Other types of s:Detail data are not supported.
+
+private:
+
+    static FaultTableEntry _faultTable[];
+
+    Subcode _subcode;
+    String _reason;
+    ContentLanguageList _reasonLanguage;
+    String _faultDetail;
+};
+
+class PEGASUS_WSMSERVER_LINKAGE SoapNotUnderstoodFault
+{
+public:
+
+    SoapNotUnderstoodFault(
+        const String& nameSpace,
+        const String& headerName);
+
+    String getNamespace() const;
+    String getHeaderName() const;
+    String getMessage() const;
+    ContentLanguageList getMessageLanguage() const;
+
+private:
+
+    String _nameSpace;
+    String _headerName;
+    String _message;
+    ContentLanguageList _messageLanguage;
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_WsmFault_h */
diff --git a/src/Pegasus/WsmServer/WsmInstance.cpp b/src/Pegasus/WsmServer/WsmInstance.cpp
new file mode 100644 (file)
index 0000000..307a6d4
--- /dev/null
@@ -0,0 +1,66 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#include "WsmInstance.h"
+
+
+PEGASUS_NAMESPACE_BEGIN
+
+WsmInstance::WsmInstance(const String& className) :
+    _className(className)
+{
+}
+
+WsmInstance::WsmInstance(const WsmInstance& inst) :
+    _className(inst._className),
+    _properties(inst._properties)
+{
+}
+
+void WsmInstance::addProperty(const WsmProperty& prop)
+{
+    _properties.append(prop);
+}
+
+WsmProperty& WsmInstance::getProperty(Uint32 index)
+{
+    return _properties[index];
+}
+
+Uint32 WsmInstance::getPropertyCount() const
+{
+    return _properties.size();
+}
+
+
+PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/WsmServer/WsmInstance.h b/src/Pegasus/WsmServer/WsmInstance.h
new file mode 100644 (file)
index 0000000..38560b2
--- /dev/null
@@ -0,0 +1,76 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_WsmInstance_h
+#define Pegasus_WsmInstance_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/String.h>
+#include <Pegasus/Common/ArrayInternal.h>
+#include <Pegasus/WsmServer/WsmProperty.h>
+
+
+PEGASUS_NAMESPACE_BEGIN
+
+class PEGASUS_WSMSERVER_LINKAGE WsmInstance
+{
+public:
+
+    WsmInstance() {}
+    WsmInstance(const WsmInstance& inst);
+    WsmInstance(const String& className);
+
+    const String& getClassName() const
+    {
+        return _className;
+    }
+
+    void setClassName(const String& name)
+    {
+        _className = name;
+    }
+
+    WsmProperty& getProperty(Uint32 index);
+    void addProperty(const WsmProperty& prop);
+    Uint32 getPropertyCount() const;
+
+private:
+
+    String _className;
+    Array<WsmProperty> _properties;
+};
+
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_WsmInstance_h */
diff --git a/src/Pegasus/WsmServer/WsmProcessor.cpp b/src/Pegasus/WsmServer/WsmProcessor.cpp
new file mode 100644 (file)
index 0000000..a9ab7b0
--- /dev/null
@@ -0,0 +1,216 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#include <cctype>
+#include <cstdio>
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/Tracer.h>
+#include <Pegasus/Common/MessageLoader.h>
+#include <Pegasus/Common/AutoPtr.h>
+#include "WsmConstants.h"
+#include "WsmProcessor.h"
+
+PEGASUS_NAMESPACE_BEGIN
+
+WsmProcessor::WsmProcessor(
+    MessageQueueService* cimOperationProcessorQueue,
+    CIMRepository* repository)
+    : MessageQueueService(PEGASUS_QUEUENAME_WSMPROCESSOR),
+      _wsmResponseEncoder(),
+      _wsmRequestDecoder(this),
+      _cimOperationProcessorQueue(cimOperationProcessorQueue),
+      _repository(repository),
+      _wsmToCimRequestMapper(repository)
+{
+}
+
+WsmProcessor::~WsmProcessor()
+{
+}
+
+void WsmProcessor::handleEnqueue(Message* message)
+{
+    if (!message)
+    {
+        return;
+    }
+
+    PEGASUS_ASSERT(dynamic_cast<CIMResponseMessage*>(message) != 0);
+    handleResponse(dynamic_cast<CIMResponseMessage*>(message));
+}
+
+void WsmProcessor::handleEnqueue()
+{
+    Message* message = dequeue();
+    handleEnqueue(message);
+}
+
+void WsmProcessor::handleRequest(WsmRequest* wsmRequest)
+{
+    PEG_METHOD_ENTER(TRC_WSMSERVER, "WsmProcessor::handleRequest()");
+
+    // Process requests by type.  For now, only WS-Transfer operations are
+    // implemented, and they all are handled by forwarding to the CIM Server.
+
+    AutoPtr<WsmRequest> wsmRequestDestroyer(wsmRequest);
+
+    try
+    {
+        CIMOperationRequestMessage* cimRequest =
+            _wsmToCimRequestMapper.mapToCimRequest(wsmRequest);
+
+        // Save the request until the response comes back.
+        // Note that the CIM request has its own unique message ID.
+        _requestTable.insert(cimRequest->messageId, wsmRequest);
+        wsmRequestDestroyer.release();
+
+        cimRequest->queueIds.push(getQueueId());
+        _cimOperationProcessorQueue->enqueue(cimRequest);
+    }
+    catch (WsmFault& fault)
+    {
+        sendResponse(new WsmFaultResponse(wsmRequest, fault));
+    }
+    catch (CIMException& e)
+    {
+        sendResponse(new WsmFaultResponse(
+            wsmRequest,
+            _cimToWsmResponseMapper.mapCimExceptionToWsmFault(e)));
+    }
+    catch (Exception& e)
+    {
+        sendResponse(new WsmFaultResponse(
+            wsmRequest,
+            WsmFault(
+                WsmFault::wsman_InternalError,
+                e.getMessage(),
+                e.getContentLanguages())));
+    }
+    catch (PEGASUS_STD(exception)& e)
+    {
+        sendResponse(new WsmFaultResponse(
+            wsmRequest,
+            WsmFault(WsmFault::wsman_InternalError, e.what())));
+    }
+    catch (...)
+    {
+        sendResponse(new WsmFaultResponse(
+            wsmRequest,
+            WsmFault(WsmFault::wsman_InternalError)));
+    }
+
+    // Note this requirement when Enumerate/Pull operations are supported:
+    // DSP0226 R6.3-5: For operations that span multiple message sequences,
+    // the wsman:Locale element is processed in the initial message only.
+    // It should be ignored in subsequent messages because the first
+    // message establishes the required locale. The service may issue a
+    // fault if the wsman:Locale is present in subsequent messages and the
+    // value is different from that used in the initiating request.
+
+    PEG_METHOD_EXIT();
+}
+
+void WsmProcessor::handleResponse(CIMResponseMessage* cimResponse)
+{
+    PEG_METHOD_ENTER(TRC_WSMSERVER, "WsmProcessor::handleResponse()");
+
+    AutoPtr<CIMResponseMessage> cimResponseDestroyer(cimResponse);
+
+    // Lookup the request this response corresponds to
+    WsmRequest* wsmRequest;
+    Boolean gotRequest =
+        _requestTable.lookup(cimResponse->messageId, wsmRequest);
+    PEGASUS_ASSERT(gotRequest);
+    AutoPtr<WsmRequest> wsmRequestDestroyer(wsmRequest);
+    _requestTable.remove(wsmRequest->messageId);
+
+    try
+    {
+        AutoPtr<WsmResponse> wsmResponse(
+            _cimToWsmResponseMapper.mapToWsmResponse(wsmRequest, cimResponse));
+
+        cimResponse->updateThreadLanguages();
+        cimResponse->queueIds.pop();
+        _wsmResponseEncoder.enqueue(wsmResponse.get());
+    }
+    catch (WsmFault& fault)
+    {
+        sendResponse(new WsmFaultResponse(wsmRequest, fault));
+    }
+    catch (CIMException& e)
+    {
+        sendResponse(new WsmFaultResponse(
+            wsmRequest,
+            _cimToWsmResponseMapper.mapCimExceptionToWsmFault(e)));
+    }
+    catch (Exception& e)
+    {
+        sendResponse(new WsmFaultResponse(
+            wsmRequest,
+            WsmFault(
+                WsmFault::wsman_InternalError,
+                e.getMessage(),
+                e.getContentLanguages())));
+    }
+    catch (PEGASUS_STD(exception)& e)
+    {
+        sendResponse(new WsmFaultResponse(
+            wsmRequest,
+            WsmFault(WsmFault::wsman_InternalError, e.what())));
+    }
+    catch (...)
+    {
+        sendResponse(new WsmFaultResponse(
+            wsmRequest,
+            WsmFault(WsmFault::wsman_InternalError)));
+    }
+
+    PEG_METHOD_EXIT();
+}
+
+void WsmProcessor::sendResponse(WsmResponse* wsmResponse)
+{
+    PEG_METHOD_ENTER(TRC_WSMSERVER, "WsmProcessor::sendResponse()");
+
+    _wsmResponseEncoder.enqueue(wsmResponse);
+    delete wsmResponse;
+
+    PEG_METHOD_EXIT();
+}
+
+Uint32 WsmProcessor::getWsmRequestDecoderQueueId()
+{
+    return _wsmRequestDecoder.getQueueId();
+}
+
+PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/WsmServer/WsmProcessor.h b/src/Pegasus/WsmServer/WsmProcessor.h
new file mode 100644 (file)
index 0000000..71fa359
--- /dev/null
@@ -0,0 +1,112 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_WsmProcessor_h
+#define Pegasus_WsmProcessor_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/MessageQueueService.h>
+#include <Pegasus/Common/CIMMessage.h>
+#include <Pegasus/Repository/CIMRepository.h>
+#include <Pegasus/WsmServer/WsmRequestDecoder.h>
+#include <Pegasus/WsmServer/WsmResponseEncoder.h>
+#include <Pegasus/WsmServer/WsmToCimRequestMapper.h>
+#include <Pegasus/WsmServer/CimToWsmResponseMapper.h>
+#include <Pegasus/WsmServer/Linkage.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+/**
+    Processes WsmRequest messages and produces WsmResponse messages.
+*/
+class PEGASUS_WSMSERVER_LINKAGE WsmProcessor : public MessageQueueService
+{
+public:
+
+    WsmProcessor(
+        MessageQueueService* cimOperationProcessorQueue,
+        CIMRepository* repository);
+
+    ~WsmProcessor();
+
+    virtual void handleEnqueue(Message *);
+
+    virtual void handleEnqueue();
+
+    void handleRequest(WsmRequest* wsmRequest);
+    void handleResponse(CIMResponseMessage* cimResponse);
+
+    void sendResponse(WsmResponse* wsmResponse);
+
+    Uint32 getWsmRequestDecoderQueueId();
+
+    void setServerTerminating(Boolean flag)
+    {
+        _wsmRequestDecoder.setServerTerminating(flag);
+    }
+
+private:
+
+    WsmResponseEncoder _wsmResponseEncoder;
+    WsmRequestDecoder _wsmRequestDecoder;
+
+    /**
+        A pointer to a CIMOperationRequestDispatcher that can be used to
+        process CIM operation requests.
+    */
+    MessageQueueService* _cimOperationProcessorQueue;
+
+    /**
+        A repository object that can be used to look up schema definitions.
+    */
+    CIMRepository* _repository;
+
+    WsmToCimRequestMapper _wsmToCimRequestMapper;
+    CimToWsmResponseMapper _cimToWsmResponseMapper;
+
+    typedef HashTable<String,
+        WsmRequest*, EqualFunc<String>, HashFunc<String> > RequestTable;
+    /**
+        The RequestTable stores the original WS-Management request until the
+        operation is complete.  It is used to create an appropriate
+        WS-Management response from the CIM operation response message.
+        A unique message ID is used for CIM operation messages, different from
+        the WS-Management request message ID.  The CIM operation message ID
+        is used as the hash key.
+    */
+    RequestTable _requestTable;
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_WsmProcessor_h */
diff --git a/src/Pegasus/WsmServer/WsmProperty.cpp b/src/Pegasus/WsmServer/WsmProperty.cpp
new file mode 100644 (file)
index 0000000..e216b39
--- /dev/null
@@ -0,0 +1,41 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#include "WsmProperty.h"
+
+
+PEGASUS_NAMESPACE_BEGIN
+
+
+
+PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/WsmServer/WsmProperty.h b/src/Pegasus/WsmServer/WsmProperty.h
new file mode 100644 (file)
index 0000000..d305258
--- /dev/null
@@ -0,0 +1,70 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_WsmProperty_h
+#define Pegasus_WsmProperty_h
+
+#include <Pegasus/Common/String.h>
+#include <Pegasus/WsmServer/WsmValue.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+class WsmProperty
+{
+public:
+
+    WsmProperty(const String& name, WsmValue& value)
+        : _name(name),
+          _value(value)
+    {
+    }
+
+    const String& getName() const
+    {
+        return _name;
+    }
+
+    WsmValue& getValue()
+    {
+        return _value;
+    }
+
+private:
+
+    String _name;
+    WsmValue _value;
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_WsmProperty_h */
diff --git a/src/Pegasus/WsmServer/WsmReader.cpp b/src/Pegasus/WsmServer/WsmReader.cpp
new file mode 100644 (file)
index 0000000..45d7857
--- /dev/null
@@ -0,0 +1,981 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#include <cctype>
+#include <cstdio>
+#include <cstdlib>
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/MessageLoader.h>
+#include <Pegasus/Common/StringConversion.h>
+#include <Pegasus/Common/XmlReader.h>
+#include <Pegasus/WsmServer/WsmConstants.h>
+#include <Pegasus/WsmServer/WsmFault.h>
+#include "WsmReader.h"
+
+PEGASUS_NAMESPACE_BEGIN
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// WsmReader
+//
+///////////////////////////////////////////////////////////////////////////////
+
+WsmReader::WsmReader(char* text)
+    : _parser(text, WsmNamespaces::supportedNamespaces)
+{
+}
+
+WsmReader::~WsmReader()
+{
+}
+
+//-----------------------------------------------------------------------------
+//
+// getXmlDeclaration()
+//
+//     <?xml version="1.0" encoding="utf-8"?>
+//
+//-----------------------------------------------------------------------------
+Boolean WsmReader::getXmlDeclaration(
+    const char*& xmlVersion,
+    const char*& xmlEncoding)
+{
+    XmlEntry entry;
+
+    if (_parser.next(entry))
+    {
+        if ((entry.type != XmlEntry::XML_DECLARATION) ||
+            (strcmp(entry.text, "xml") != 0))
+        {
+            _parser.putBack(entry);
+            return false;
+        }
+
+        entry.getAttributeValue("version", xmlVersion);
+        entry.getAttributeValue("encoding", xmlEncoding);
+        return true;
+    }
+
+    return false;
+}
+
+Boolean WsmReader::testStartTag(
+    XmlEntry& entry,
+    int nsType,
+    const char* tagName)
+{
+    if (!_parser.next(entry))
+    {
+        return false;
+    }
+
+    if ((entry.type != XmlEntry::START_TAG) ||
+        (entry.nsType != nsType) ||
+        (tagName && strcmp(entry.localName, tagName) != 0))
+    {
+        _parser.putBack(entry);
+        return false;
+    }
+
+    return true;
+}
+
+Boolean WsmReader::testStartOrEmptyTag(
+    XmlEntry& entry,
+    int nsType,
+    const char* tagName)
+{
+    if (!_parser.next(entry))
+    {
+        return false;
+    }
+
+    if (((entry.type != XmlEntry::START_TAG) &&
+         (entry.type != XmlEntry::EMPTY_TAG)) ||
+        (entry.nsType != nsType) ||
+        (tagName && strcmp(entry.localName, tagName) != 0))
+    {
+        _parser.putBack(entry);
+        return false;
+    }
+
+    return true;
+}
+
+Boolean WsmReader::testEndTag(
+    int nsType,
+    const char* tagName)
+{
+    XmlEntry entry;
+
+    if (!_parser.next(entry))
+    {
+        return false;
+    }
+
+    if ((entry.type != XmlEntry::END_TAG) ||
+        (entry.nsType != nsType) ||
+        (tagName && strcmp(entry.localName, tagName) != 0))
+    {
+        _parser.putBack(entry);
+        return false;
+    }
+
+    return true;
+}
+
+void WsmReader::expectStartTag(
+    XmlEntry& entry,
+    int nsType,
+    const char* tagName)
+{
+    if (!_parser.next(entry) ||
+        entry.type != XmlEntry::START_TAG ||
+        entry.nsType != nsType ||
+        strcmp(entry.localName, tagName) != 0)
+    {
+        const char* nsUri;
+
+        // The nsType must have already been declared in the XML or it must be
+        // a supported namespace.
+        XmlNamespace* ns = _parser.getNamespace(nsType);
+        if (ns)
+        {
+            nsUri = ns->extendedName;
+        }
+        else
+        {
+            PEGASUS_ASSERT((nsType >= 0) && (nsType < WsmNamespaces::LAST));
+            nsUri = WsmNamespaces::supportedNamespaces[nsType].extendedName;
+        }
+
+        MessageLoaderParms mlParms(
+            "WsmServer.WsmReader.EXPECTED_OPEN",
+            "Expecting a start tag for \"$0\" element in namespace \"$1\".",
+            tagName, nsUri);
+        throw XmlValidationError(_parser.getLine(), mlParms);
+    }
+}
+
+void WsmReader::expectStartOrEmptyTag(
+    XmlEntry& entry,
+    int nsType,
+    const char* tagName)
+{
+    if (!_parser.next(entry) ||
+        (entry.type != XmlEntry::START_TAG &&
+         entry.type != XmlEntry::EMPTY_TAG) ||
+        entry.nsType != nsType ||
+        strcmp(entry.localName, tagName) != 0)
+    {
+        const char* nsUri;
+
+        // The nsType must have already been declared in the XML or it must be
+        // a supported namespace.
+        XmlNamespace* ns = _parser.getNamespace(nsType);
+        if (ns)
+        {
+            nsUri = ns->extendedName;
+        }
+        else
+        {
+            PEGASUS_ASSERT((nsType >= 0) && (nsType < WsmNamespaces::LAST));
+            nsUri = WsmNamespaces::supportedNamespaces[nsType].extendedName;
+        }
+
+        MessageLoaderParms mlParms(
+            "WsmServer.WsmReader.EXPECTED_OPENCLOSE",
+            "Expecting a start tag or an empty tag for \"$0\" element in "
+                "namespace \"$1\".",
+            tagName, nsUri);
+        throw XmlValidationError(_parser.getLine(), mlParms);
+    }
+}
+
+void WsmReader::expectEndTag(
+    int nsType,
+    const char* tagName)
+{
+    XmlEntry entry;
+
+    if (!_parser.next(entry) ||
+        entry.type != XmlEntry::END_TAG ||
+        entry.nsType != nsType ||
+        strcmp(entry.localName, tagName) != 0)
+    {
+        // The nsType must have already been declared in the XML.  (Note that
+        // ns->localName is null for a default namespace declaration.)
+        XmlNamespace* ns = _parser.getNamespace(nsType);
+        PEGASUS_ASSERT(ns);
+        MessageLoaderParms mlParms(
+            "WsmServer.WsmReader.EXPECTED_CLOSE",
+            "Expecting an end tag for \"$0\" element in namespace \"$1\".",
+            tagName, ns->extendedName);
+        throw XmlValidationError(_parser.getLine(), mlParms);
+    }
+}
+
+void WsmReader::expectContentOrCData(XmlEntry& entry)
+{
+    XmlReader::expectContentOrCData(_parser, entry);
+}
+
+Boolean WsmReader::next(XmlEntry& entry)
+{
+    return _parser.next(entry);
+}
+
+Boolean WsmReader::getAttributeValue(
+    Uint32 lineNumber,
+    XmlEntry& entry,
+    const char* attributeName,
+    String& attributeValue,
+    Boolean required)
+{
+    if (!entry.getAttributeValue(attributeName, attributeValue))
+    {
+        if (required)
+        {
+            MessageLoaderParms parms(
+                "WsmServer.WsmReader.MISSING_ATTRIBUTE",
+                "The attribute $0.$1 is missing.",
+                entry.text,
+                attributeName);
+            throw XmlValidationError(lineNumber, parms);
+        }
+
+        return false;
+    }
+
+    return true;
+}
+
+Boolean WsmReader::mustUnderstand(XmlEntry& entry)
+{
+    const XmlAttribute* attr = entry.findAttribute(
+        WsmNamespaces::SOAP_ENVELOPE, "mustUnderstand");
+    return (attr && (strcmp(attr->value, "true") == 0));
+}
+
+Boolean WsmReader::getElementStringValue(
+    int nsType,
+    const char* tagName,
+    String& stringValue,
+    Boolean required)
+{
+    XmlEntry entry;
+
+    if (required)
+    {
+        expectStartTag(entry, nsType, tagName);
+    }
+    else if (!testStartTag(entry, nsType, tagName))
+    {
+        return false;
+    }
+
+    expectContentOrCData(entry);
+    stringValue = entry.text;
+    expectEndTag(nsType, tagName);
+    return true;
+}
+
+const char* WsmReader::getElementContent(XmlEntry& entry)
+{
+    if (entry.type == XmlEntry::EMPTY_TAG)
+    {
+        return "";
+    }
+
+    expectContentOrCData(entry);
+    return entry.text;
+}
+
+Boolean WsmReader::getSelectorElement(WsmSelector& selector)
+{
+    XmlEntry entry;
+    if (!testStartOrEmptyTag(entry, WsmNamespaces::WS_MAN, "Selector"))
+    {
+        return false;
+    }
+
+    Boolean empty = entry.type == XmlEntry::EMPTY_TAG;
+    String name;
+
+    getAttributeValue(_parser.getLine(), entry, "Name", name);
+
+    if (empty)
+    {
+        selector = WsmSelector(name, String::EMPTY);
+    }
+    else
+    {
+        WsmEndpointReference endpointReference;
+
+        if (getSelectorEPRElement(endpointReference))
+        {
+            selector = WsmSelector(name, endpointReference);
+        }
+        else
+        {
+            expectContentOrCData(entry);
+            selector = WsmSelector(name, entry.text);
+        }
+
+        expectEndTag(WsmNamespaces::WS_MAN, "Selector");
+    }
+
+    return true;
+}
+
+Boolean WsmReader::getSelectorSetElement(WsmSelectorSet& selectorSet)
+{
+    XmlEntry entry;
+    if (!testStartTag(entry, WsmNamespaces::WS_MAN, "SelectorSet"))
+    {
+        return false;
+    }
+
+    selectorSet.selectors.clear();
+
+    WsmSelector selector;
+
+    while (getSelectorElement(selector))
+    {
+        selectorSet.selectors.append(selector);
+    }
+
+    // If the selector set is empty, report an error
+    if (selectorSet.selectors.size() == 0)
+    {
+        expectStartTag(entry, WsmNamespaces::WS_MAN, "Selector");
+    }
+
+    // Note: This "should" requirement is not implemented.
+    // DSP0226 R5.1.2.2-4: The Selector Name attribute shall not be duplicated
+    // at the same level of nesting.  If this occurs, the service should return
+    // a wsman:InvalidSelectors fault with the following detail code:
+    //     http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/
+    //         DuplicateSelectors
+
+    expectEndTag(WsmNamespaces::WS_MAN, "SelectorSet");
+
+    return true;
+}
+
+void WsmReader::getEPRElement(WsmEndpointReference& endpointReference)
+{
+    XmlEntry entry;
+
+    // DSP0227 Section 5. WS-Management default addressing model is based
+    // on WS-Addressing. It makes use of wsa:ReferenceParameter field
+    // (containing wsa:ResourceURI and wsa:SelectorSet) to identify objects.
+    // The use of other fields defined by WS-Addressing in not specified.
+
+    // wsa:Address is required by WS-Addressing
+    getElementStringValue(
+        WsmNamespaces::WS_ADDRESSING,
+        "Address",
+        endpointReference.address,
+        true);
+
+    expectStartTag(entry, WsmNamespaces::WS_ADDRESSING, "ReferenceParameters");
+
+    // Though DSP0227 does not explicitly require wsa:ResourceURI to be present,
+    // valid targets of operations must either have a class specific
+    // ResourceURI to target classes/instances or all classes URI to target
+    // the service itself.
+    getElementStringValue(
+        WsmNamespaces::WS_MAN,
+        "ResourceURI",
+        endpointReference.resourceUri,
+        true);
+
+    // wsa:SelectorSet is optional
+    if (testStartTag(entry, WsmNamespaces::WS_MAN, "SelectorSet"))
+    {
+        _parser.putBack(entry);
+        // Return value ignored; assumed to succeed because of precheck
+        getSelectorSetElement(*endpointReference.selectorSet);
+    }
+
+    expectEndTag(WsmNamespaces::WS_ADDRESSING, "ReferenceParameters");
+}
+
+Boolean WsmReader::getSelectorEPRElement(
+    WsmEndpointReference& endpointReference)
+{
+    // EPRs in selectors have enclosing wsa:EndpointReference tags
+    XmlEntry entry;
+    if (!testStartTag(
+            entry, WsmNamespaces::WS_ADDRESSING, "EndpointReference"))
+    {
+        return false;
+    }
+
+    getEPRElement(endpointReference);
+    expectEndTag(WsmNamespaces::WS_ADDRESSING, "EndpointReference");
+    return true;
+}
+
+
+Boolean WsmReader::getInstanceEPRElement(
+    WsmEndpointReference& endpointReference)
+{
+    XmlEntry entry;
+
+    if (!testStartTag(entry, WsmNamespaces::WS_ADDRESSING, "Address"))
+    {
+        return false;
+    }
+    else
+    {
+        _parser.putBack(entry);
+    }
+
+    getEPRElement(endpointReference);
+    return true;
+}
+
+void WsmReader::skipElement(XmlEntry& entry)
+{
+    const char* elementName = entry.text;
+
+    if (entry.type == XmlEntry::EMPTY_TAG)
+    {
+        return;
+    }
+
+    while (XmlReader::testStartTagOrEmptyTag(_parser, entry))
+    {
+        skipElement(entry);
+    }
+
+    // Skip content data, if present
+    XmlReader::testContentOrCData(_parser, entry);
+
+    XmlReader::expectEndTag(_parser, elementName);
+}
+
+inline void checkDuplicateHeader(
+    const char* elementName,
+    Boolean isDuplicate)
+{
+    // DSP0226 R13.1-9: If a request contains multiple SOAP headers with the
+    // same QName from WS-Management, WS-Addressing, or WS-Eventing, the
+    // service should not process them and should issue a
+    // wsa:InvalidMessageInformationHeaders fault if they are detected.
+    // (No SOAP headers are defined by the WS-Transfer and WS-Enumeration
+    // specifications.)
+
+    if (isDuplicate)
+    {
+        throw WsmFault(
+            WsmFault::wsa_InvalidMessageInformationHeader,
+            MessageLoaderParms(
+                "WsmServer.WsmReader.DUPLICATE_SOAP_HEADER",
+                "Request contains multiple $0 SOAP Header elements.",
+                elementName));
+    }
+}
+
+void WsmReader::decodeRequestSoapHeaders(
+    String& wsaMessageId,
+    String& wsaTo,
+    String& wsaAction,
+    String& wsaFrom,
+    String& wsaReplyTo,
+    String& wsaFaultTo,
+    String& wsmResourceUri,
+    WsmSelectorSet& wsmSelectorSet,
+    Uint32& wsmMaxEnvelopeSize,
+    AcceptLanguageList& wsmLocale,
+    Boolean& wsmRequestEpr)
+{
+    // Note: This method does not collect headers that should appear only in
+    // responses: wsa:RelatesTo, wsman:RequestedEPR.
+
+    XmlEntry entry;
+    Boolean gotEntry;
+
+    expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Header");
+
+    while ((gotEntry = _parser.next(entry)) &&
+           ((entry.type == XmlEntry::START_TAG) ||
+            (entry.type == XmlEntry::EMPTY_TAG)))
+    {
+        int nsType = entry.nsType;
+        const char* elementName = entry.localName;
+        Boolean needEndTag = (entry.type == XmlEntry::START_TAG);
+
+        if ((nsType == WsmNamespaces::WS_ADDRESSING) &&
+            (strcmp(elementName, "To") == 0))
+        {
+            checkDuplicateHeader(entry.text, wsaTo.size());
+            wsaTo = getElementContent(entry);
+        }
+        else if ((nsType == WsmNamespaces::WS_ADDRESSING) &&
+            (strcmp(elementName, "From") == 0))
+        {
+            checkDuplicateHeader(entry.text, wsaFrom.size());
+            wsaFrom = getElementContent(entry);
+        }
+        else if ((nsType == WsmNamespaces::WS_ADDRESSING) &&
+            (strcmp(elementName, "ReplyTo") == 0))
+        {
+            checkDuplicateHeader(entry.text, wsaReplyTo.size());
+            // ATTN: Reference parameters not handled yet.
+            // DSP0226 R5.4.2-5: Any reference parameters supplied in the
+            // wsa:ReplyTo address shall be included in the actual response
+            // message as top-level headers as specified in WS-Addressing
+            // unless the response is a fault.  If the response is a fault,
+            // the service should include the reference parameters but may
+            // omit these values if the resulting message size would exceed
+            // the encoding limits.
+            getElementStringValue(
+                WsmNamespaces::WS_ADDRESSING, "Address", wsaReplyTo, true);
+        }
+        else if ((nsType == WsmNamespaces::WS_ADDRESSING) &&
+            (strcmp(elementName, "FaultTo") == 0))
+        {
+            checkDuplicateHeader(entry.text, wsaFaultTo.size());
+            // ATTN: Reference parameters not handled yet.
+            // DSP0226 R5.4.3-4: Any reference parameters supplied in the
+            // wsa:FaultTo address should be included as top-level headers in
+            // the actual fault, as specified in the WS-Addressing
+            // specification.  In some cases, including this information would
+            // cause the fault to exceed encoding size limits, and thus may be
+            // omitted in those cases.
+            getElementStringValue(
+                WsmNamespaces::WS_ADDRESSING, "Address", wsaFaultTo, true);
+        }
+        else if ((nsType == WsmNamespaces::WS_ADDRESSING) &&
+            (strcmp(elementName, "Action") == 0))
+        {
+            checkDuplicateHeader(entry.text, wsaAction.size());
+            wsaAction = getElementContent(entry);
+        }
+        else if ((nsType == WsmNamespaces::WS_ADDRESSING) &&
+            (strcmp(elementName, "MessageID") == 0))
+        {
+            checkDuplicateHeader(entry.text, wsaMessageId.size());
+            wsaMessageId = getElementContent(entry);
+        }
+        else if ((nsType == WsmNamespaces::WS_MAN) &&
+            (strcmp(elementName, "ResourceURI") == 0))
+        {
+            checkDuplicateHeader(entry.text, wsmResourceUri.size());
+            wsmResourceUri = getElementContent(entry);
+        }
+        else if ((nsType == WsmNamespaces::WS_MAN) &&
+            (strcmp(elementName, "SelectorSet") == 0))
+        {
+            checkDuplicateHeader(entry.text, wsmSelectorSet.selectors.size());
+            _parser.putBack(entry);
+            getSelectorSetElement(wsmSelectorSet);
+            // The end tag has already been consumed.
+            needEndTag = false;
+        }
+        else if ((nsType == WsmNamespaces::WS_MAN) &&
+            (strcmp(elementName, "OperationTimeout") == 0))
+        {
+            if (mustUnderstand(entry))
+            {
+                // DSP0226 R6.1-3: If the service does not support user-defined
+                // timeouts, a wsman:UnsupportedFeature fault should be
+                // returned with the following detail code:
+                //     http://schemas.dmtf.org/wbem/wsman/faultDetail/
+                //         OperationTimeout
+
+                throw WsmFault(
+                    WsmFault::wsman_UnsupportedFeature,
+                    String::EMPTY,
+                    ContentLanguageList(),
+                    WSMAN_FAULTDETAIL_OPERATIONTIMEOUT);
+            }
+
+            // Note: It is not an error for a compliant service to ignore the
+            // timeout value or treat it as a hint if mustUnderstand is omitted.
+
+            skipElement(entry);
+            // The end tag, if any, has already been consumed.
+            needEndTag = false;
+        }
+        else if ((nsType == WsmNamespaces::WS_MAN) &&
+            (strcmp(elementName, "MaxEnvelopeSize") == 0))
+        {
+            checkDuplicateHeader(entry.text, wsmMaxEnvelopeSize > 0);
+
+            // DSP0226 R6.2-3: If the mustUnderstand attribute is set to
+            // "false", the service may ignore the header.
+            const char* content = getElementContent(entry);
+            if (*content == '+')
+            {
+                content++;
+            }
+            Uint64 value;
+            if (!StringConversion::decimalStringToUint64(content, value) ||
+                (value == 0) || (value > 0xFFFFFFFF))
+            {
+                throw WsmFault(
+                    WsmFault::wsa_InvalidMessageInformationHeader,
+                    MessageLoaderParms(
+                        "WsmServer.WsmReader.INVALID_MAXENVELOPESIZE_VALUE",
+                        "The MaxEnvelopeSize value \"$0\" is not a valid "
+                            "positive integer.",
+                        content));
+            }
+
+            // DSP0226 R6.2-4:  Services should reject any MaxEnvelopeSize
+            // value less than 8192 octets.  This number is the safe minimum
+            // in which faults can be reliably encoded for all character sets.
+            // If the requested size is less than this, the service should
+            // return a wsman:EncodingLimit fault with the following detail
+            // code:
+            //     http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/
+            //         MinimumEnvelopeLimit
+
+            if (value < WSM_MIN_MAXENVELOPESIZE_VALUE)
+            {
+                throw WsmFault(
+                    WsmFault::wsman_EncodingLimit,
+                    MessageLoaderParms(
+                        "WsmServer.WsmReader.MAXENVELOPESIZE_TOO_SMALL",
+                        "The MaxEnvelopeSize $0 is less than "
+                            "minimum allowable value of $1.",
+                        value, WSM_MIN_MAXENVELOPESIZE_VALUE),
+                    WSMAN_FAULTDETAIL_MINIMUMENVELOPELIMIT);
+            }
+            
+            wsmMaxEnvelopeSize = value & 0xFFFFFFFF;
+        }
+        else if ((nsType == WsmNamespaces::WS_MAN) &&
+            (strcmp(elementName, "Locale") == 0))
+        {
+            checkDuplicateHeader(entry.text, wsmLocale.size());
+
+            if (mustUnderstand(entry))
+            {
+                // DSP0226 R6.3-2: If the mustUnderstand attribute is set to
+                // "true", the service shall ensure that the replies contain
+                // localized information where appropriate, or else the service
+                // shall issue a wsman:UnsupportedFeature fault with the
+                // following detail code:
+                //     http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/
+                //         Locale
+                // A service may always fault if wsman:Locale contains
+                // s:mustUnderstand set to "true", because it may not be able
+                // to ensure that the reply is localized.
+
+                throw WsmFault(
+                    WsmFault::wsman_UnsupportedFeature,
+                    MessageLoaderParms(
+                        "WsmServer.WsmReader.LOCALE_NOT_ENSURED",
+                        "Translation of responses to a specified locale "
+                            "cannot be ensured."),
+                    WSMAN_FAULTDETAIL_LOCALE);
+            }
+
+            // DSP0226 R6.3-1 If the mustUnderstand attribute is omitted or set
+            // to "false", the service should use this value when composing the
+            // response message and adjust any localizable values accordingly.
+            // This use is recommended for most cases. The locale is treated as
+            // a hint in this case.
+
+            // DSP0226 R6.3-3: The value of the xml:lang attribute in the
+            // wsman:Locale header shall be a valid RFC 3066 language code.
+
+            String languageTag;
+            if (getAttributeValue(
+                    _parser.getLine(), entry, "xml:lang", languageTag, false))
+            {
+                wsmLocale.insert(LanguageTag(languageTag), Real32(1.0));
+            }
+        }
+        else if ((nsType == WsmNamespaces::WS_MAN) &&
+            (strcmp(elementName, "OptionSet") == 0))
+        {
+            // DSP0226 R6.4-3: If the mustUnderstand attribute is omitted from
+            // the OptionSet block, the service may ignore the entire
+            // wsman:OptionSet block. If it is present and the service does not
+            // support wsman:OptionSet, the service shall return a
+            // s:NotUnderstood fault.
+
+            if (mustUnderstand(entry))
+            {
+                throw SoapNotUnderstoodFault(
+                    _parser.getNamespace(nsType)->extendedName, elementName);
+            }
+
+            skipElement(entry);
+            // The end tag, if any, has already been consumed.
+            needEndTag = false;
+        }
+        else if ((nsType == WsmNamespaces::WS_MAN) &&
+            (strcmp(elementName, "RequestEPR") == 0))
+        {
+            checkDuplicateHeader(entry.text, wsmRequestEpr);
+            wsmRequestEpr = true;
+        }
+        else if ((nsType == WsmNamespaces::WS_MAN) &&
+            (strcmp(elementName, "FragmentTransfer") == 0))
+        {
+            // DSP0226 R7.7-1: A conformant service may support fragment-level
+            // WS-Transfer.  If the service supports fragment-level access, the
+            // service shall not behave as if normal WS-Transfer operations
+            // were in place but shall operate exclusively on the fragments
+            // specified.  If the service does not support fragment-level
+            // access, it shall return a wsman:UnsupportedFeature fault with
+            // the following detail code:
+            //     http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/
+            //         FragmentLevelAccess
+
+            if (mustUnderstand(entry))
+            {
+                throw WsmFault(
+                    WsmFault::wsman_UnsupportedFeature,
+                    String::EMPTY,
+                    ContentLanguageList(),
+                    WSMAN_FAULTDETAIL_FRAGMENTLEVELACCESS);
+            }
+
+            skipElement(entry);
+            // The end tag, if any, has already been consumed.
+            needEndTag = false;
+        }
+        else if (mustUnderstand(entry))
+        {
+            // DSP0226 R5.2-2: If a service cannot comply with a header
+            // marked with mustUnderstand="true", it shall issue an
+            // s:NotUnderstood fault.
+            throw SoapNotUnderstoodFault(
+                _parser.getNamespace(nsType)->extendedName, elementName);
+        }
+        else
+        {
+            skipElement(entry);
+            // The end tag, if any, has already been consumed.
+            needEndTag = false;
+        }
+
+        if (needEndTag)
+        {
+            expectEndTag(nsType, elementName);
+        }
+    }
+
+    if (gotEntry)
+    {
+        _parser.putBack(entry);
+    }
+
+    expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Header");
+}
+
+void WsmReader::getInstanceElement(WsmInstance& instance)
+{
+    XmlEntry entry;
+    Boolean isInstanceElement = false;
+    int nsClassType = 0;
+    const char* classNameTag = 0;
+
+    // The first tag should be the class name start tag.
+    if (_parser.next(entry) && (entry.type == XmlEntry::START_TAG))
+    {
+        XmlNamespace* ns = _parser.getNamespace(entry.nsType);
+        classNameTag = entry.localName;
+
+        // Class namespace must be of the following form:
+        // http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/<class name>
+        if (ns)
+        {
+            const char* pos = strrchr(ns->extendedName, '/');
+            if ((pos == ns->extendedName +
+                sizeof(WSM_RESOURCEURI_CIMSCHEMAV2) - 1) &&
+                (strncmp(ns->extendedName, WSM_RESOURCEURI_CIMSCHEMAV2,
+                    sizeof(WSM_RESOURCEURI_CIMSCHEMAV2) - 1) == 0) &&
+                (strcmp(pos + 1, classNameTag) == 0))
+            {
+                // All properties must be qualified with the class namespace
+                nsClassType = entry.nsType;
+                instance.setClassName(String(pos + 1));
+                isInstanceElement = true;
+            }
+        }
+    }
+
+    if (!isInstanceElement)
+    {
+        MessageLoaderParms mlParms(
+            "WsmServer.WsmReader.EXPECTED_INSTANCE_ELEMENT",
+            "Expecting an instance element.");
+        throw XmlValidationError(_parser.getLine(), mlParms);
+    }
+
+    String propName;
+    WsmValue propValue;
+    while (getPropertyElement(nsClassType, propName, propValue))
+    {
+        instance.addProperty(WsmProperty(propName, propValue));
+    }
+
+    expectEndTag(nsClassType, classNameTag);
+}
+
+
+Boolean WsmReader::getPropertyElement(
+    int nsType,
+    String& propName,
+    WsmValue& propValue)
+{
+    XmlEntry entry;
+    const char* propNameTag = 0;
+    Boolean firstTime = true;
+
+    // Initialize propValue to a null value string
+    propValue = WsmValue();
+
+    // The first time we enter this loop, propNameTag is NULL. It will
+    // give us any tag name in the given namespace. Subsequent iterations
+    // will get entries with the same name as retrieved in the first
+    // iteration.
+    while (testStartOrEmptyTag(entry, nsType, propNameTag))
+    {
+        // Look for xsi:nil="true" to determine of this entry represents
+        // a null value.
+        const XmlAttribute* attr =
+            entry.findAttribute(WsmNamespaces::XML_SCHEMA_INSTANCE, "nil");
+        Boolean isNilValue = (attr && strcmp(attr->value, "true") == 0);
+
+        // The only time it's OK to see a null entry is on the first iteration.
+        // The above indicates a null property value. If a null entry appears
+        // in a sequence representing an array, it's an error.
+        if ((isNilValue || propValue.isNull()) && !firstTime)
+        {
+            MessageLoaderParms mlParms(
+                "WsmServer.WsmReader.NULL_ARRAY_ELEMENTS",
+                "Setting array elements to null is not supported.");
+            throw XmlValidationError(_parser.getLine(), mlParms);
+        }
+
+        // If we haven't found xsi:nil="true" attribute and this is
+        // an empty tag, throw an exception: invalid property value.
+        if (entry.type == XmlEntry::EMPTY_TAG && !isNilValue)
+        {
+            MessageLoaderParms mlParms(
+                "WsmServer.WsmReader.MISSING_PROPERTY_VALUE",
+                "No value specified for non-null property $0.",
+                entry.text);
+            throw XmlValidationError(_parser.getLine(), mlParms);
+        }
+
+        if (firstTime)
+        {
+            firstTime = false;
+
+            // Set the property name
+            propNameTag = entry.localName;
+            propName = propNameTag;
+
+            if (isNilValue)
+            {
+                // A null element should be either an empty tag or a start
+                // tag followed by an end tag (no content).
+                if (entry.type == XmlEntry::START_TAG)
+                {
+                    expectEndTag(nsType, propNameTag);
+                }
+
+                // No need to set propValue - it's initialized to a null
+                // string value
+            }
+            else
+            {
+                PEGASUS_ASSERT(entry.type == XmlEntry::START_TAG);
+                getValueElement(propValue, nsType, propNameTag);
+            }
+        }
+        else
+        {
+            PEGASUS_ASSERT(entry.type == XmlEntry::START_TAG);
+            WsmValue val;
+            getValueElement(val, nsType, propNameTag);
+            propValue.add(val);
+        }
+    }
+
+    // If we never entered the main loop, it means that we haven't seen the
+    // right initial tags to indicate a class property. In this case firstTime
+    // is still set to true.
+    return !firstTime;
+}
+
+void WsmReader::getValueElement(
+    WsmValue& value, int nsType, const char* propNameTag)
+{
+    XmlEntry entry;
+
+    if (testEndTag(nsType, propNameTag))
+    {
+        // It's an empty tag, enter and empty sting value
+        value.set(String::EMPTY);
+    }
+    else
+    {
+        if (XmlReader::testContentOrCData(_parser, entry))
+        {
+            // Simple string content
+            value.set(String(entry.text));
+        }
+        else
+        {
+            // The value is either an EPR or an embedded instance.
+            WsmEndpointReference epr;
+            if (getInstanceEPRElement(epr))
+            {
+                value.set(epr);
+            }
+            else
+            {
+                // This must be an embedded instance
+                WsmInstance instance;
+                getInstanceElement(instance);
+                value.set(instance);
+            }
+        }
+        expectEndTag(nsType, propNameTag);
+    }
+}
+
+PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/WsmServer/WsmReader.h b/src/Pegasus/WsmServer/WsmReader.h
new file mode 100644 (file)
index 0000000..cb6dff8
--- /dev/null
@@ -0,0 +1,132 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_WsmReader_h
+#define Pegasus_WsmReader_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/XmlParser.h>
+#include <Pegasus/Common/AcceptLanguageList.h>
+#include <Pegasus/WsmServer/WsmInstance.h>
+#include <Pegasus/WsmServer/WsmSelectorSet.h>
+#include <Pegasus/WsmServer/WsmEndpointReference.h>
+#include <Pegasus/WsmServer/WsmUtils.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+class PEGASUS_WSMSERVER_LINKAGE WsmReader
+{
+public:
+
+    WsmReader(char* text);
+    ~WsmReader();
+
+    Boolean getXmlDeclaration(
+        const char*& xmlVersion, const char*& xmlEncoding);
+
+    Boolean testStartTag(
+        XmlEntry& entry,
+        int nsType,
+        const char* tagName = 0);
+    Boolean testStartOrEmptyTag(
+        XmlEntry& entry,
+        int nsType,
+        const char* tagName = 0);
+    Boolean testEndTag(int nsType, const char* tagName = 0);
+
+    void expectStartTag(
+        XmlEntry& entry,
+        int nsType,
+        const char* tagName);
+    void expectStartOrEmptyTag(
+        XmlEntry& entry,
+        int nsType,
+        const char* tagName);
+    void expectEndTag(
+        int nsType,
+        const char* tagName);
+    void expectContentOrCData(XmlEntry& entry);
+
+    Boolean getAttributeValue(
+        Uint32 lineNumber,
+        XmlEntry& entry,
+        const char* attributeName,
+        String& attributeValue,
+        Boolean required = true);
+
+    Boolean mustUnderstand(XmlEntry& entry);
+
+    const char* getElementContent(XmlEntry& entry);
+    Boolean getElementStringValue(
+        int nsType,
+        const char* tagName,
+        String& stringValue,
+        Boolean required = false);
+
+    Boolean getSelectorElement(WsmSelector& selector);
+    Boolean getSelectorSetElement(WsmSelectorSet& selectorSet);
+    void getEPRElement(WsmEndpointReference& endpointReference);
+    Boolean getSelectorEPRElement(WsmEndpointReference& endpointReference);
+    Boolean getInstanceEPRElement(WsmEndpointReference& endpointReference);
+
+    void skipElement(XmlEntry& entry);
+    Boolean next(XmlEntry& entry);
+
+    void decodeRequestSoapHeaders(
+        String& wsaMessageId,
+        String& wsaTo,
+        String& wsaAction,
+        String& wsaFrom,
+        String& wsaReplyTo,
+        String& wsaFaultTo,
+        String& wsmResourceUri,
+        WsmSelectorSet& wsmSelectorSet,
+        Uint32& wsmMaxEnvelopeSize,
+        AcceptLanguageList& wsmLocale,
+        Boolean& wsmRequestEpr);
+
+    void getInstanceElement(WsmInstance& instance);
+    Boolean getPropertyElement(
+        int nsType,
+        String& propName,
+        WsmValue& propValue);
+    void getValueElement(WsmValue& value, int nsType, const char* propNameTag);
+
+private:
+
+    XmlParser _parser;
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_WsmReader_h */
diff --git a/src/Pegasus/WsmServer/WsmRequest.h b/src/Pegasus/WsmServer/WsmRequest.h
new file mode 100644 (file)
index 0000000..c43d8db
--- /dev/null
@@ -0,0 +1,172 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_WsmRequest_h
+#define Pegasus_WsmRequest_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/OperationContext.h>
+#include <Pegasus/Common/AcceptLanguageList.h>
+#include <Pegasus/Common/ContentLanguageList.h>
+#include <Pegasus/Common/ArrayInternal.h>
+#include <Pegasus/Common/Message.h>
+#include <Pegasus/WsmServer/WsmSelectorSet.h>
+#include <Pegasus/WsmServer/WsmInstance.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+enum WsmOperationType
+{
+    WSM_FAULT,
+    SOAP_FAULT,
+
+    WSM_IDENTITY_IDENTIFY,
+
+    WS_TRANSFER_GET,
+    WS_TRANSFER_PUT,
+    WS_TRANSFER_CREATE,
+    WS_TRANSFER_DELETE,
+
+    WS_ENUMERATION_ENUMERATE,
+    WS_ENUMERATION_PULL,
+    WS_ENUMERATION_RELEASE
+    // etc.
+};
+
+class WsmRequest
+{
+public:
+
+    WsmRequest(
+        WsmOperationType type,
+        const String& messageId_)
+        : messageId(messageId_),
+          _type(type)
+    {
+    }
+
+    virtual ~WsmRequest()
+    {
+    }
+
+    WsmOperationType getType() const
+    {
+        return _type;
+    }
+
+    String messageId;
+    String authType;
+    String userName;
+    String ipAddress;
+    HttpMethod httpMethod;
+    AcceptLanguageList acceptLanguages;
+    ContentLanguageList contentLanguages;
+    Boolean httpCloseConnect;
+    Uint32 queueId;
+    Boolean requestEpr;
+    Uint32 maxEnvelopeSize;
+
+private:
+
+    WsmOperationType _type;
+};
+
+class WsmGetRequest : public WsmRequest
+{
+public:
+
+    WsmGetRequest(
+        const String& messageId,
+        const WsmEndpointReference& epr_)
+        : WsmRequest(WS_TRANSFER_GET, messageId),
+          epr(epr_)
+    {
+    }
+
+    WsmEndpointReference epr;
+};
+
+class WsmPutRequest : public WsmRequest
+{
+public:
+
+    WsmPutRequest(
+        const String& messageId,
+        const WsmEndpointReference& epr_,
+        const WsmInstance& instance_)
+        : WsmRequest(WS_TRANSFER_PUT, messageId),
+          epr(epr_),
+          instance(instance_)
+    {
+    }
+
+    WsmEndpointReference epr;
+    WsmInstance instance;
+};
+
+class WsmCreateRequest : public WsmRequest
+{
+public:
+
+    WsmCreateRequest(
+        const String& messageId,
+        const WsmEndpointReference& epr_,
+        const WsmInstance& instance_)
+        : WsmRequest(WS_TRANSFER_CREATE, messageId),
+          epr(epr_),
+          instance(instance_)
+    {
+    }
+
+    WsmEndpointReference epr;
+    WsmInstance instance;
+};
+
+class WsmDeleteRequest : public WsmRequest
+{
+public:
+
+    WsmDeleteRequest(
+        const String& messageId,
+        const WsmEndpointReference& epr_)
+        : WsmRequest(WS_TRANSFER_DELETE, messageId),
+          epr(epr_)
+    {
+    }
+
+    WsmEndpointReference epr;
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_WsmRequest_h */
diff --git a/src/Pegasus/WsmServer/WsmRequestDecoder.cpp b/src/Pegasus/WsmServer/WsmRequestDecoder.cpp
new file mode 100644 (file)
index 0000000..d4a1ed9
--- /dev/null
@@ -0,0 +1,670 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#include <cctype>
+#include <cstdio>
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/XmlParser.h>
+#include <Pegasus/Common/Tracer.h>
+#include <Pegasus/Common/CommonUTF.h>
+#include <Pegasus/Common/MessageLoader.h>
+#include <Pegasus/Common/AutoPtr.h>
+
+#include "WsmConstants.h"
+#include "WsmReader.h"
+#include "WsmWriter.h"
+#include "WsmProcessor.h"
+#include "WsmRequestDecoder.h"
+
+PEGASUS_NAMESPACE_BEGIN
+
+WsmRequestDecoder::WsmRequestDecoder(WsmProcessor* wsmProcessor)
+    : MessageQueueService(PEGASUS_QUEUENAME_WSMREQDECODER),
+      _wsmProcessor(wsmProcessor),
+      _serverTerminating(false)
+{
+}
+
+WsmRequestDecoder::~WsmRequestDecoder()
+{
+}
+
+void WsmRequestDecoder::sendResponse(
+    Uint32 queueId,
+    Buffer& message,
+    Boolean httpCloseConnect)
+{
+    MessageQueue* queue = MessageQueue::lookup(queueId);
+
+    if (queue)
+    {
+        AutoPtr<HTTPMessage> httpMessage(new HTTPMessage(message));
+        httpMessage->setCloseConnect(httpCloseConnect);
+        queue->enqueue(httpMessage.release());
+    }
+}
+
+void WsmRequestDecoder::sendHttpError(
+    Uint32 queueId,
+    const String& status,
+    const String& cimError,
+    const String& pegasusError,
+    Boolean httpCloseConnect)
+{
+    Buffer message;
+    message = WsmWriter::formatHttpErrorRspMessage(
+        status,
+        cimError,
+        pegasusError);
+
+    sendResponse(queueId, message, httpCloseConnect);
+}
+
+void WsmRequestDecoder::handleEnqueue(Message* message)
+{
+    PEGASUS_ASSERT(message);
+    PEGASUS_ASSERT(message->getType() == HTTP_MESSAGE);
+
+    handleHTTPMessage((HTTPMessage*)message);
+
+    delete message;
+}
+
+void WsmRequestDecoder::handleEnqueue()
+{
+    Message* message = dequeue();
+    if (message)
+        handleEnqueue(message);
+}
+
+//-----------------------------------------------------------------------------
+//
+// From the HTTP/1.1 Specification (RFC 2626):
+//
+// Both types of message consist of a start-line, zero or more header fields
+// (also known as "headers"), an empty line (i.e., a line with nothing
+// preceding the CRLF) indicating the end of the header fields, and possibly
+// a message-body.
+//
+//-----------------------------------------------------------------------------
+void WsmRequestDecoder::handleHTTPMessage(HTTPMessage* httpMessage)
+{
+    PEG_METHOD_ENTER(TRC_WSMSERVER, "WsmRequestDecoder::handleHTTPMessage()");
+
+    // Set the Accept-Language into the thread for this service.
+    // This will allow all code in this thread to get
+    // the languages for the messages returned to the client.
+    Thread::setLanguages(httpMessage->acceptLanguages);
+
+    // Save queueId:
+    Uint32 queueId = httpMessage->queueId;
+
+    // Save userName and authType:
+    String userName;
+    String authType;
+    Boolean httpCloseConnect = httpMessage->getCloseConnect();
+
+    PEG_TRACE((TRC_WSMSERVER, Tracer::LEVEL3,
+        "WsmRequestDecoder::handleHTTPMessage()- "
+            "httpMessage->getCloseConnect() returned %d",
+        httpCloseConnect));
+
+    userName = httpMessage->authInfo->getAuthenticatedUser();
+    authType = httpMessage->authInfo->getAuthType();
+
+    // Parse the HTTP message:
+    String startLine;
+    Array<HTTPHeader> headers;
+    char* content;
+    Uint32 contentLength;
+    String contentType;
+
+    httpMessage->parse(startLine, headers, contentLength);
+
+    // Parse the request line:
+    String methodName;
+    String requestUri;
+    String httpVersion;
+    HttpMethod httpMethod = HTTP_METHOD__POST;
+
+    HTTPMessage::parseRequestLine(
+        startLine, methodName, requestUri, httpVersion);
+
+    //  Set HTTP method for the request
+    if (methodName == "M-POST")
+    {
+        httpMethod = HTTP_METHOD_M_POST;
+    }
+
+    // Unsupported methods are caught in the HTTPAuthenticatorDelegator
+    PEGASUS_ASSERT(methodName == "M-POST" || methodName == "POST");
+
+    //  Mismatch of method and version is caught in HTTPAuthenticatorDelegator
+    PEGASUS_ASSERT(!((httpMethod == HTTP_METHOD_M_POST) &&
+                     (httpVersion == "HTTP/1.0")));
+
+    // Process M-POST and POST messages:
+    if (httpVersion == "HTTP/1.1")
+    {
+        // Validate the presence of a "Host" header.  The HTTP/1.1
+        // specification says this in section 14.23 regarding the Host
+        // header field:
+        //
+        //     All Internet-based HTTP/1.1 servers MUST respond with a 400 (Bad
+        //     Request) status code to any HTTP/1.1 request message which lacks
+        //     a Host header field.
+        //
+        // Note:  The Host header value is not validated.
+
+        String hostHeader;
+        Boolean hostHeaderFound = HTTPMessage::lookupHeader(
+            headers, "Host", hostHeader, false);
+
+        if (!hostHeaderFound)
+        {
+            MessageLoaderParms parms(
+                "Server.WsmRequestDecoder.MISSING_HOST_HEADER",
+                "HTTP request message lacks a Host header field.");
+            sendHttpError(
+                queueId,
+                HTTP_STATUS_BADREQUEST,
+                "",
+                MessageLoader::getMessage(parms),
+                httpCloseConnect);
+            PEG_METHOD_EXIT();
+            return;
+        }
+    }
+
+    // Calculate the beginning of the content from the message size and
+    // the content length.
+    content = (char*) httpMessage->message.getData() +
+        httpMessage->message.size() - contentLength;
+
+    // Validate the "Content-Type" header:
+    Boolean contentTypeHeaderFound = HTTPMessage::lookupHeader(
+        headers, "Content-Type", contentType, true);
+    String type;
+    String charset;
+
+    if (!contentTypeHeaderFound ||
+        !HTTPMessage::parseContentTypeHeader(contentType, type, charset) ||
+        (!String::equalNoCase(type, "application/soap+xml") &&
+         !String::equalNoCase(type, "text/xml")))
+    {
+        MessageLoaderParms parms(
+            "Server.WsmRequestDecoder.CONTENTTYPE_SYNTAX_ERROR",
+            "HTTP Content-Type header error.");
+        sendHttpError(
+            queueId,
+            HTTP_STATUS_BADREQUEST,
+            "",
+            MessageLoader::getMessage(parms),
+            httpCloseConnect);
+        PEG_METHOD_EXIT();
+        return;
+    }
+
+    if (!String::equalNoCase(charset, "utf-8"))
+    {
+        // DSP0226 R13.1-5:  A service shall emit Responses using the same
+        // encoding as the original request. If the service does not support
+        // the requested encoding or cannot determine the encoding, it should
+        // use UTF-8 encoding to return a wsman:EncodingLimit fault with the
+        // following detail code:
+        // http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/CharacterSet
+
+        WsmFault fault(
+            WsmFault::wsman_EncodingLimit,
+            String::EMPTY,
+            ContentLanguageList(),
+            WSMAN_FAULTDETAIL_CHARACTERSET);
+         _wsmProcessor->sendResponse(new WsmFaultResponse(
+             String::EMPTY, queueId, httpMethod, httpCloseConnect, fault));
+         PEG_METHOD_EXIT();
+         return;
+    }
+
+    // SoapAction header is optional, but if present, it must match
+    // the content of <wsa:Action>
+    String soapAction;
+    HTTPMessage::lookupHeader(headers, "SOAPAction", soapAction, true);
+
+    // Remove the quotes around the SOAPAction value
+    if ((soapAction.size() > 1) &&
+        (soapAction[0] == '\"') &&
+        (soapAction[soapAction.size()-1] == '\"'))
+    {
+        soapAction = soapAction.subString(1, soapAction.size() - 2);
+    }
+
+    // Validating content falls within UTF8
+    // (required to be compliant with section C12 of Unicode 4.0 spec,
+    // chapter 3.)
+    Uint32 count = 0;
+    while (count < contentLength)
+    {
+        if (!(isUTF8((char*) &content[count])))
+        {
+            MessageLoaderParms parms(
+                "Server.WsmRequestDecoder.INVALID_UTF8_CHARACTER",
+                "Invalid UTF-8 character detected.");
+            sendHttpError(
+                queueId,
+                HTTP_STATUS_BADREQUEST,
+                "request-not-valid",
+                MessageLoader::getMessage(parms),
+                httpCloseConnect);
+
+            PEG_METHOD_EXIT();
+            return;
+        }
+        UTF8_NEXT(content, count);
+    }
+
+    handleWsmMessage(
+        queueId,
+        httpMethod,
+        content,
+        contentLength,
+        soapAction,
+        authType,
+        userName,
+        httpMessage->ipAddress,
+        httpMessage->acceptLanguages,
+        httpMessage->contentLanguages,
+        httpCloseConnect);
+
+    PEG_METHOD_EXIT();
+}
+
+void WsmRequestDecoder::handleWsmMessage(
+    Uint32 queueId,
+    HttpMethod httpMethod,
+    char* content,
+    Uint32 contentLength,
+    String& soapAction,
+    const String& authType,
+    const String& userName,
+    const String& ipAddress,
+    const AcceptLanguageList& httpAcceptLanguages,
+    const ContentLanguageList& httpContentLanguages,
+    Boolean httpCloseConnect)
+{
+    PEG_METHOD_ENTER(TRC_WSMSERVER, "WsmRequestDecoder::handleWsmMessage()");
+
+    // If CIMOM is shutting down, return "Service Unavailable" response
+    if (_serverTerminating)
+    {
+        MessageLoaderParms parms(
+            "Server.WsmRequestDecoder.CIMSERVER_SHUTTING_DOWN",
+            "CIM Server is shutting down.");
+        sendHttpError(
+            queueId,
+            HTTP_STATUS_SERVICEUNAVAILABLE,
+            String::EMPTY,
+            MessageLoader::getMessage(parms),
+            httpCloseConnect);
+        PEG_METHOD_EXIT();
+        return;
+    }
+
+    WsmReader wsmReader(content);
+    XmlEntry entry;
+    AutoPtr<WsmRequest> request;
+    String wsaMessageId;
+
+    // Process <?xml ... >
+    try
+    {
+        // These values are currently unused
+        const char* xmlVersion = 0;
+        const char* xmlEncoding = 0;
+
+        // Note: WinRM does not send an XML declaration in its requests.
+        // This return value is ignored.
+        wsmReader.getXmlDeclaration(xmlVersion, xmlEncoding);
+
+        // Decode the SOAP envelope
+
+        wsmReader.expectStartTag(
+            entry, WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+
+        String wsaAction;
+        String wsaFrom;
+        String wsaReplyTo;
+        String wsaFaultTo;
+        WsmEndpointReference epr;
+        Uint32 wsmMaxEnvelopeSize = 0;
+        AcceptLanguageList wsmLocale;
+        Boolean wsmRequestEpr = false;
+
+        try
+        {
+            wsmReader.decodeRequestSoapHeaders(
+                wsaMessageId,
+                epr.address,
+                wsaAction,
+                wsaFrom,
+                wsaReplyTo,
+                wsaFaultTo,
+                epr.resourceUri,
+                *epr.selectorSet,
+                wsmMaxEnvelopeSize,
+                wsmLocale,
+                wsmRequestEpr);
+        }
+        catch (XmlException&)
+        {
+            // Do not treat this as an InvalidMessageInformationHeader fault.
+            throw;
+        }
+        catch (Exception& e)
+        {
+            throw WsmFault(
+                WsmFault::wsa_InvalidMessageInformationHeader,
+                e.getMessage(),
+                e.getContentLanguages());
+        }
+
+        // Set the Locale language into the thread for processing this request.
+        Thread::setLanguages(wsmLocale);
+
+        _checkRequiredHeader("wsa:To", epr.address.size());
+        _checkRequiredHeader("wsa:MessageID", wsaMessageId.size());
+        _checkRequiredHeader("wsa:Action", wsaAction.size());
+
+        if (soapAction.size() && (soapAction != wsaAction))
+        {
+            throw WsmFault(
+                WsmFault::wsa_MessageInformationHeaderRequired,
+                MessageLoaderParms(
+                    "WsmServer.WsmRequestDecoder.SOAPACTION_HEADER_MISMATCH",
+                    "The HTTP SOAPAction header value \"$0\" does not match "
+                        "the wsa:Action value \"$1\".",
+                    soapAction,
+                    wsaAction));
+        }
+
+        // Note: The wsa:To header is not validated.  DSP0226 section 5.3
+        // indicates that this header is primarily useful for routing through
+        // intermediaries.  The HTTPAuthenticatorDelegator examines the path
+        // specified in the HTTP start line.
+
+        // DSP0226 R5.3-1: The wsa:To header shall be present in all messages,
+        // whether requests, responses, or events. In the absence of other
+        // requirements, it is recommended that the network address for
+        // resources that require authentication be suffixed by the token
+        // sequence /wsman. If /wsman is used, unauthenticated access should
+        // not be allowed.
+        //     (1) <wsa:To> http://123.15.166.67/wsman </wsa:To>
+
+        // DSP0226 R5.3-2: In the absence of other requirements, it is
+        // recommended that the network address for resources that do not
+        // require authentication be suffixed by the token sequence
+        // /wsman-anon. If /wsman-anon is used, authenticated access shall
+        // not be required.
+        //     (1) <wsa:To> http://123.15.166.67/wsman-anon </wsa:To>
+
+        if (wsaReplyTo != WSM_ADDRESS_ANONYMOUS)
+        {
+            // DSP0226 R5.4.2-2: A conformant service may require that all
+            // responses be delivered over the same connection on which the
+            // request arrives.
+            throw WsmFault(
+                WsmFault::wsman_UnsupportedFeature,
+                MessageLoaderParms(
+                    "WsmServer.WsmRequestDecoder.REPLYTO_ADDRESS_NOT_ANONYMOUS",
+                    "Responses may only be delivered over the same connection "
+                        "on which the request arrives."),
+                WSMAN_FAULTDETAIL_ADDRESSINGMODE);
+        }
+
+        if (wsaFaultTo.size() && (wsaFaultTo != WSM_ADDRESS_ANONYMOUS))
+        {
+            // DSP0226 R5.4.3-3: A conformant service may require that all
+            // faults be delivered to the client over the same transport or
+            // connection on which the request arrives.
+            throw WsmFault(
+                WsmFault::wsman_UnsupportedFeature,
+                MessageLoaderParms(
+                    "WsmServer.WsmRequestDecoder.FAULTTO_ADDRESS_NOT_ANONYMOUS",
+                    "Responses may only be delivered over the same connection "
+                        "on which the request arrives."),
+                WSMAN_FAULTDETAIL_ADDRESSINGMODE);
+        }
+
+        //
+        // Parse the SOAP Body while decoding each action
+        //
+
+        if (wsaAction == WSM_ACTION_GET)
+        {
+            request.reset(_decodeWSTransferGet(
+                wsmReader,
+                wsaMessageId,
+                epr));
+        }
+        else if (wsaAction == WSM_ACTION_PUT)
+        {
+            request.reset(_decodeWSTransferPut(
+                wsmReader,
+                wsaMessageId,
+                epr));
+        }
+        else if (wsaAction == WSM_ACTION_CREATE)
+        {
+            request.reset(_decodeWSTransferCreate(
+                wsmReader,
+                wsaMessageId,
+                epr));
+        }
+        else if (wsaAction == WSM_ACTION_DELETE)
+        {
+            request.reset(_decodeWSTransferDelete(
+                wsmReader,
+                wsaMessageId,
+                epr));
+        }
+        else
+        {
+            throw WsmFault(
+                WsmFault::wsa_ActionNotSupported,
+                MessageLoaderParms(
+                    "WsmServer.WsmRequestDecoder.ACTION_NOT_SUPPORTED",
+                    "The wsa:Action value \"$0\" is not supported.",
+                    wsaAction));
+        }
+
+        wsmReader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+
+        request->authType = authType;
+        request->userName = userName;
+        request->ipAddress = ipAddress;
+        request->httpMethod = httpMethod;
+        // Note:  The HTTP Accept-Languages header is ignored
+        request->acceptLanguages = wsmLocale;
+        request->contentLanguages = httpContentLanguages;
+        request->httpCloseConnect = httpCloseConnect;
+        request->queueId = queueId;
+        request->requestEpr = wsmRequestEpr;
+        request->maxEnvelopeSize = wsmMaxEnvelopeSize;
+    }
+    catch (WsmFault& fault)
+    {
+        _wsmProcessor->sendResponse(new WsmFaultResponse(
+            wsaMessageId, queueId, httpMethod, httpCloseConnect, fault));
+        PEG_METHOD_EXIT();
+        return;
+    }
+    catch (SoapNotUnderstoodFault& fault)
+    {
+        _wsmProcessor->sendResponse(new SoapFaultResponse(
+            wsaMessageId, queueId, httpMethod, httpCloseConnect, fault));
+        PEG_METHOD_EXIT();
+        return;
+    }
+    catch (XmlException& e)
+    {
+        WsmFault fault(
+            WsmFault::wsman_SchemaValidationError,
+            e.getMessage(),
+            e.getContentLanguages());
+        _wsmProcessor->sendResponse(new WsmFaultResponse(
+            wsaMessageId, queueId, httpMethod, httpCloseConnect, fault));
+        PEG_METHOD_EXIT();
+        return;
+    }
+    catch (Exception& e)
+    {
+        WsmFault fault(
+            WsmFault::wsman_InternalError,
+            e.getMessage(),
+            e.getContentLanguages());
+        _wsmProcessor->sendResponse(new WsmFaultResponse(
+            wsaMessageId, queueId, httpMethod, httpCloseConnect, fault));
+        PEG_METHOD_EXIT();
+        return;
+    }
+    catch (const PEGASUS_STD(exception)& e)
+    {
+        WsmFault fault(WsmFault::wsman_InternalError, e.what());
+        _wsmProcessor->sendResponse(new WsmFaultResponse(
+            wsaMessageId, queueId, httpMethod, httpCloseConnect, fault));
+        PEG_METHOD_EXIT();
+        return;
+    }
+    catch (...)
+    {
+        WsmFault fault(WsmFault::wsman_InternalError);
+        _wsmProcessor->sendResponse(new WsmFaultResponse(
+            wsaMessageId, queueId, httpMethod, httpCloseConnect, fault));
+        PEG_METHOD_EXIT();
+        return;
+    }
+
+    _wsmProcessor->handleRequest(request.release());
+
+    PEG_METHOD_EXIT();
+}
+
+void WsmRequestDecoder::_checkRequiredHeader(
+    const char* headerName,
+    Boolean headerSpecified)
+{
+    if (!headerSpecified)
+    {
+        throw WsmFault(
+            WsmFault::wsa_MessageInformationHeaderRequired,
+            MessageLoaderParms(
+                "WsmServer.WsmRequestDecoder.MISSING_HEADER",
+                "Required SOAP header \"$0\" was not specified.",
+                headerName));
+    }
+}
+
+WsmGetRequest* WsmRequestDecoder::_decodeWSTransferGet(
+    WsmReader& wsmReader,
+    const String& messageId,
+    const WsmEndpointReference& epr)
+{
+    _checkRequiredHeader("wsman:ResourceURI", epr.resourceUri.size());
+
+    XmlEntry entry;
+    wsmReader.expectStartOrEmptyTag(
+        entry, WsmNamespaces::SOAP_ENVELOPE, "Body");
+    if (entry.type != XmlEntry::EMPTY_TAG)
+    {
+        wsmReader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Body");
+    }
+
+    return new WsmGetRequest(messageId, epr);
+}
+
+WsmPutRequest* WsmRequestDecoder::_decodeWSTransferPut(
+    WsmReader& wsmReader,
+    const String& messageId,
+    const WsmEndpointReference& epr)
+{
+    _checkRequiredHeader("wsman:ResourceURI", epr.resourceUri.size());
+
+    XmlEntry entry;
+    wsmReader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Body");
+
+    // The soap body must contain an XML representation of the updated instance
+    WsmInstance instance;
+    wsmReader.getInstanceElement(instance);
+
+    wsmReader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Body");
+
+    return new WsmPutRequest(messageId, epr, instance);
+}
+
+WsmCreateRequest* WsmRequestDecoder::_decodeWSTransferCreate(
+    WsmReader& wsmReader,
+    const String& messageId,
+    const WsmEndpointReference& epr)
+{
+    _checkRequiredHeader("wsman:ResourceURI", epr.resourceUri.size());
+
+    XmlEntry entry;
+    wsmReader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Body");
+
+    // The soap body must contain an XML representation of the new instance
+    WsmInstance instance;
+    wsmReader.getInstanceElement(instance);
+
+    wsmReader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Body");
+
+    return new WsmCreateRequest(messageId, epr, instance);
+}
+
+WsmDeleteRequest* WsmRequestDecoder::_decodeWSTransferDelete(
+    WsmReader& wsmReader,
+    const String& messageId,
+    const WsmEndpointReference& epr)
+{
+    _checkRequiredHeader("wsman:ResourceURI", epr.resourceUri.size());
+
+    XmlEntry entry;
+    wsmReader.expectStartOrEmptyTag(
+        entry, WsmNamespaces::SOAP_ENVELOPE, "Body");
+    if (entry.type != XmlEntry::EMPTY_TAG)
+    {
+        wsmReader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Body");
+    }
+
+    return new WsmDeleteRequest(messageId, epr);
+}
+
+PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/WsmServer/WsmRequestDecoder.h b/src/Pegasus/WsmServer/WsmRequestDecoder.h
new file mode 100644 (file)
index 0000000..e63acba
--- /dev/null
@@ -0,0 +1,128 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_WsmRequestDecoder_h
+#define Pegasus_WsmRequestDecoder_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/MessageQueueService.h>
+#include <Pegasus/Common/HTTPMessage.h>
+#include <Pegasus/Common/AcceptLanguageList.h>
+#include <Pegasus/Common/ContentLanguageList.h>
+#include <Pegasus/WsmServer/WsmRequest.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+class WsmReader;
+class WsmProcessor;
+
+/** This class decodes WS-Man operation requests and passes them down-stream.
+ */
+class WsmRequestDecoder : public MessageQueueService
+{
+public:
+
+    WsmRequestDecoder(WsmProcessor* wsmProcessor);
+
+    ~WsmRequestDecoder();
+
+    void sendResponse(
+        Uint32 queueId,
+        Buffer& message,
+        Boolean httpCloseConnect = false);
+
+    void sendHttpError(
+        Uint32 queueId,
+        const String& status,
+        const String& cimError = String::EMPTY,
+        const String& messageBody = String::EMPTY,
+        Boolean httpCloseConnect = false);
+
+    virtual void handleEnqueue(Message *);
+
+    virtual void handleEnqueue();
+
+    void handleHTTPMessage(HTTPMessage* httpMessage);
+
+    void handleWsmMessage(
+        Uint32 queueId,
+        HttpMethod httpMethod,
+        char* content,
+        Uint32 contentLength,
+        String& soapAction,
+        const String& authType,
+        const String& userName,
+        const String& ipAddress,
+        const AcceptLanguageList& httpAcceptLanguages,
+        const ContentLanguageList& httpContentLanguages,
+        Boolean httpCloseConnect);
+
+    // Sets the flag to indicate whether or not the CIMServer is shutting down.
+    void setServerTerminating(Boolean flag) { _serverTerminating = flag; }
+
+private:
+
+    void _checkRequiredHeader(
+        const char* headerName,
+        Boolean headerSpecified);
+
+    WsmGetRequest* _decodeWSTransferGet(
+        WsmReader& wsmReader,
+        const String& messageId,
+        const WsmEndpointReference& epr);
+
+    WsmPutRequest* _decodeWSTransferPut(
+        WsmReader& wsmReader,
+        const String& messageId,
+        const WsmEndpointReference& epr);
+
+    WsmCreateRequest* _decodeWSTransferCreate(
+        WsmReader& wsmReader,
+        const String& messageId,
+        const WsmEndpointReference& epr);
+
+    WsmDeleteRequest* _decodeWSTransferDelete(
+        WsmReader& wsmReader,
+        const String& messageId,
+        const WsmEndpointReference& epr);
+
+    // The queue to which to forward the decoded WsmRequests.
+    WsmProcessor* _wsmProcessor;
+
+    // Flag to indicate whether or not the CIMServer is shutting down.
+    Boolean _serverTerminating;
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_WsmRequestDecoder_h */
diff --git a/src/Pegasus/WsmServer/WsmResponse.h b/src/Pegasus/WsmServer/WsmResponse.h
new file mode 100644 (file)
index 0000000..0c27309
--- /dev/null
@@ -0,0 +1,347 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_WsmResponse_h
+#define Pegasus_WsmResponse_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/ArrayInternal.h>
+#include <Pegasus/Common/ContentLanguageList.h>
+#include <Pegasus/WsmServer/WsmRequest.h>
+#include <Pegasus/WsmServer/WsmFault.h>
+#include <Pegasus/WsmServer/WsmInstance.h>
+#include <Pegasus/WsmServer/WsmUtils.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+class WsmResponse
+{
+protected:
+
+    WsmResponse(
+        WsmOperationType type,
+        const WsmRequest* request,
+        const ContentLanguageList& contentLanguages)
+        : _type(type),
+          _messageId(WsmUtils::getMessageId()),
+          _relatesTo(request->messageId),
+          _queueId(request->queueId),
+          _httpMethod(request->httpMethod),
+          _httpCloseConnect(request->httpCloseConnect),
+          _maxEnvelopeSize(request->maxEnvelopeSize),
+          _contentLanguages(contentLanguages)
+    {
+    }
+
+    WsmResponse(
+        WsmOperationType type,
+        const String& relatesTo,
+        Uint32 queueId,
+        HttpMethod httpMethod,
+        Boolean httpCloseConnect,
+        const ContentLanguageList& contentLanguages)
+        : _type(type),
+          _messageId(WsmUtils::getMessageId()),
+          _relatesTo(relatesTo),
+          _queueId(queueId),
+          _httpMethod(httpMethod),
+          _httpCloseConnect(httpCloseConnect),
+          _maxEnvelopeSize(0),
+          _contentLanguages(contentLanguages)
+    {
+    }
+
+public:
+
+    virtual ~WsmResponse()
+    {
+    }
+
+    WsmOperationType getType() const
+    {
+        return _type;
+    }
+
+    String& getMessageId()
+    {
+        return _messageId;
+    }
+
+    String& getRelatesTo()
+    {
+        return _relatesTo;
+    }
+
+    Uint32 getQueueId() const
+    {
+        return _queueId;
+    }
+
+    HttpMethod getHttpMethod() const
+    {
+        return _httpMethod;
+    }
+
+    Boolean getHttpCloseConnect() const
+    {
+        return _httpCloseConnect;
+    }
+
+    Uint32 getMaxEnvelopeSize() const
+    {
+        return _maxEnvelopeSize;
+    }
+
+    ContentLanguageList& getContentLanguages()
+    {
+        return _contentLanguages;
+    }
+
+private:
+
+    WsmResponse(const WsmResponse&);
+    WsmResponse& operator=(const WsmResponse&);
+
+    WsmOperationType _type;
+    String _messageId;
+    String _relatesTo;
+    Uint32 _queueId;
+    HttpMethod _httpMethod;
+    Boolean _httpCloseConnect;
+    Uint32 _maxEnvelopeSize;
+    ContentLanguageList _contentLanguages;
+};
+
+class WsmFaultResponse : public WsmResponse
+{
+public:
+
+    WsmFaultResponse(
+        const String& relatesTo,
+        Uint32 queueId,
+        HttpMethod httpMethod,
+        Boolean httpCloseConnect,
+        const WsmFault& fault)
+        : WsmResponse(
+              WSM_FAULT,
+              relatesTo,
+              queueId,
+              httpMethod,
+              httpCloseConnect,
+              fault.getReasonLanguage()),
+          _fault(fault)
+    {
+    }
+
+    WsmFaultResponse(
+        const WsmRequest* request,
+        const WsmFault& fault)
+        : WsmResponse(
+              WSM_FAULT,
+              request,
+              fault.getReasonLanguage()),
+          _fault(fault)
+    {
+    }
+
+    ~WsmFaultResponse()
+    {
+    }
+
+    WsmFault& getFault()
+    {
+        return _fault;
+    }
+
+private:
+
+    WsmFault _fault;
+};
+
+class SoapFaultResponse : public WsmResponse
+{
+public:
+
+    SoapFaultResponse(
+        const String& relatesTo,
+        Uint32 queueId,
+        HttpMethod httpMethod,
+        Boolean httpCloseConnect,
+        const SoapNotUnderstoodFault& fault)
+        : WsmResponse(
+              SOAP_FAULT,
+              relatesTo,
+              queueId,
+              httpMethod,
+              httpCloseConnect,
+              fault.getMessageLanguage()),
+          _fault(fault)
+    {
+    }
+
+    ~SoapFaultResponse()
+    {
+    }
+
+    SoapNotUnderstoodFault& getFault()
+    {
+        return _fault;
+    }
+
+private:
+
+    SoapNotUnderstoodFault _fault;
+};
+
+class WsmGetResponse : public WsmResponse
+{
+public:
+
+    WsmGetResponse(
+        const WsmInstance& inst,
+        const WsmGetRequest* request,
+        const ContentLanguageList& contentLanguages)
+        : WsmResponse(
+              WS_TRANSFER_GET,
+              request,
+              contentLanguages),
+          _instance(inst)
+    {
+    }
+
+    ~WsmGetResponse()
+    {
+    }
+
+    WsmInstance& getInstance()
+    {
+        return _instance;
+    }
+
+private:
+
+    WsmInstance _instance;
+};
+
+class WsmPutResponse : public WsmResponse
+{
+public:
+
+    WsmPutResponse(
+        const WsmPutRequest* request,
+        const ContentLanguageList& contentLanguages)
+        : WsmResponse(
+              WS_TRANSFER_PUT,
+              request,
+              contentLanguages),
+          _reference(request->epr),
+          _requestedEPR(request->requestEpr)
+    {
+    }
+
+    ~WsmPutResponse()
+    {
+    }
+
+    WsmEndpointReference& getEPR()
+    {
+        return _reference;
+    }
+
+    Boolean getRequestedEPR()
+    {
+        return _requestedEPR;
+    }
+
+private:
+
+    // The client can request the potentially updated EPR by specifying the
+    // wsman:RequestEPR header.  CIM does not allow a ModifyInstance operation
+    // to change key values, though, so this will always be the same as the
+    // EPR in the request.
+    WsmEndpointReference _reference;
+    Boolean _requestedEPR;
+};
+
+class WsmCreateResponse : public WsmResponse
+{
+public:
+
+    WsmCreateResponse(
+        const WsmEndpointReference& ref,
+        const WsmCreateRequest* request,
+        const ContentLanguageList& contentLanguages)
+        : WsmResponse(
+              WS_TRANSFER_CREATE,
+              request,
+              contentLanguages),
+          _reference(ref)
+    {
+    }
+
+    ~WsmCreateResponse()
+    {
+    }
+
+    WsmEndpointReference& getEPR()
+    {
+        return _reference;
+    }
+
+private:
+
+    WsmEndpointReference _reference;
+};
+
+class WsmDeleteResponse : public WsmResponse
+{
+public:
+
+    WsmDeleteResponse(
+        const WsmDeleteRequest* request,
+        const ContentLanguageList& contentLanguages)
+        : WsmResponse(
+              WS_TRANSFER_DELETE,
+              request,
+              contentLanguages)
+    {
+    }
+
+    ~WsmDeleteResponse()
+    {
+    }
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_WsmResponse_h */
diff --git a/src/Pegasus/WsmServer/WsmResponseEncoder.cpp b/src/Pegasus/WsmServer/WsmResponseEncoder.cpp
new file mode 100644 (file)
index 0000000..1b82854
--- /dev/null
@@ -0,0 +1,354 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#include <cctype>
+#include <cstdio>
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/HTTPConnection.h>
+#include <Pegasus/Common/HTTPMessage.h>
+#include <Pegasus/Common/Tracer.h>
+#include <Pegasus/Common/AutoPtr.h>
+#include <Pegasus/Common/MessageLoader.h>
+
+#include "WsmConstants.h"
+#include "WsmReader.h"
+#include "WsmWriter.h"
+#include "WsmResponseEncoder.h"
+
+PEGASUS_USING_STD;
+
+PEGASUS_NAMESPACE_BEGIN
+
+WsmResponseEncoder::WsmResponseEncoder()
+{
+}
+
+WsmResponseEncoder::~WsmResponseEncoder()
+{
+}
+
+void WsmResponseEncoder::sendResponse(
+    WsmResponse* response,
+    const String& action,
+    Buffer* bodygiven,
+    Buffer* extraHeaders)
+{
+    PEG_METHOD_ENTER(TRC_WSMSERVER, "WsmResponseEncoder::sendResponse");
+    PEG_TRACE((TRC_WSMSERVER, Tracer::LEVEL3,
+        "WsmResponseEncoder::sendResponse(): action = %s",
+        (const char*)action.getCString()));
+
+    if (!response)
+    {
+        PEG_METHOD_EXIT();
+        return;
+    }
+
+    Uint32 queueId = response->getQueueId();
+    Boolean httpCloseConnect = response->getHttpCloseConnect();
+
+    PEG_TRACE((TRC_WSMSERVER, Tracer::LEVEL3,
+        "WsmResponseEncoder::sendResponse()- "
+            "response->getHttpCloseConnect() returned %d",
+        httpCloseConnect));
+
+    MessageQueue* queue = MessageQueue::lookup(queueId);
+    if (!queue)
+    {
+        PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL2,
+            "ERROR: non-existent queueId = %u, response not sent.", queueId));
+        PEG_METHOD_EXIT();
+        return;
+    }
+    PEGASUS_ASSERT(dynamic_cast<HTTPConnection*>(queue) != 0);
+
+    HttpMethod httpMethod = response->getHttpMethod();
+    String messageId = response->getMessageId();
+    String relatesTo = response->getRelatesTo();
+    Buffer message;
+
+    // Note: the language is ALWAYS passed empty to the xml formatters because
+    // it is HTTPConnection that needs to make the decision of whether to add
+    // the languages to the HTTP message.
+    ContentLanguageList contentLanguage;
+
+    Uint32 httpHeaderSize = 0;
+    Buffer bodylocal, headerslocal;
+    Buffer& body = bodygiven ? *bodygiven : bodylocal;
+    Buffer& headers = extraHeaders ? *extraHeaders : headerslocal;
+
+    if (response->getType() == SOAP_FAULT)
+    {
+        message = WsmWriter::formatSoapFault(
+            ((SoapFaultResponse*) response)->getFault(),
+            messageId,
+            relatesTo,
+            httpMethod,
+            httpHeaderSize);
+    }
+    else if (response->getType() == WSM_FAULT)
+    {
+        message = WsmWriter::formatWsmFault(
+            ((WsmFaultResponse*) response)->getFault(),
+            messageId,
+            relatesTo,
+            httpMethod,
+            httpHeaderSize);
+    }
+    else
+    {
+        // else non-error condition
+        try
+        {
+            message = WsmWriter::formatWsmRspMessage(
+                action,
+                messageId,
+                relatesTo,
+                httpMethod,
+                contentLanguage,
+                body,
+                headers,
+                httpHeaderSize);
+        }
+        catch (PEGASUS_STD(bad_alloc)&)
+        {
+            WsmFault fault(WsmFault::wsman_InternalError,
+                MessageLoaderParms(
+                    "WsmServer.WsmResponseEncoder.OUT_OF_MEMORY",
+                    "A System error has occurred. Please retry the "
+                        "WS-Management operation at a later time."));
+            WsmFaultResponse outofmem(relatesTo, queueId, httpMethod,
+                httpCloseConnect, fault);
+
+            // try again with new error and no body
+            body.clear();
+            sendResponse(&outofmem);
+            PEG_METHOD_EXIT();
+            return;
+        }
+    }
+
+    // If MaxEnvelopeSize is not set, it's never been specified 
+    // in the request
+    if (response->getMaxEnvelopeSize() &&
+        message.size() - httpHeaderSize > response->getMaxEnvelopeSize())
+    {
+        // try again with new error and no body
+        body.clear();
+
+        if (response->getType() == WSM_FAULT ||
+            response->getType() == SOAP_FAULT)
+        {
+            WsmFault fault(WsmFault::wsman_EncodingLimit,
+                MessageLoaderParms(
+                    "WsmServer.WsmResponseEncoder.FAULT_MAX_ENV_SIZE_EXCEEDED",
+                    "Fault response could not be encoded within requested "
+                    "envelope size limits."),
+                WSMAN_FAULTDETAIL_MAXENVELOPESIZE);
+            WsmFaultResponse faultResponse(relatesTo, queueId, httpMethod,
+                httpCloseConnect, fault);
+
+            sendResponse(&faultResponse);
+        }
+        else
+        {
+            // DSP0226 R6.2-2:  If the mustUnderstand attribute is set to
+            // "true", the service shall comply with the request.  If the
+            // response would exceed the maximum size, the service should
+            // return a wsman:EncodingLimit fault.  Because a service might
+            // execute the operation prior to knowing the response size, the
+            // service should undo any effects of the operation before
+            // issuing the fault.  If the operation cannot be reversed (such
+            // as a destructive wxf:Put or wxf:Delete, or a wxf:Create), the
+            // service shall indicate that the operation succeeded in the
+            // wsman:EncodingLimit fault with the following detail code:
+            //     http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/
+            //         UnreportableSuccess
+
+            WsmFault fault(WsmFault::wsman_EncodingLimit,
+                MessageLoaderParms(
+                    "WsmServer.WsmResponseEncoder.UNREPORTABLE_SUCCESS",
+                    "Success response could not be encoded within "
+                    "requested envelope size limits."),
+                WSMAN_FAULTDETAIL_UNREPORTABLESUCCESS);
+            WsmFaultResponse faultResponse(relatesTo, queueId, httpMethod,
+                httpCloseConnect, fault);
+
+            sendResponse(&faultResponse);
+        }
+
+        PEG_METHOD_EXIT();
+        return;
+    }
+
+    // Note: WS-Management responses are never sent in chunks, so there is no
+    // need to check dynamic_cast<HTTPConnection*>(queue)->isChunkRequested().
+    // HTTPMessage::isComplete() defaults to true, and we leave it that way.
+
+    AutoPtr<HTTPMessage> httpMessage(new HTTPMessage(message));
+
+    if (response->getType() == SOAP_FAULT)
+    {
+        httpMessage->contentLanguages =
+            ((SoapFaultResponse*) response)->getFault().getMessageLanguage();
+    }
+    else if (response->getType() == WSM_FAULT)
+    {
+        httpMessage->contentLanguages =
+            ((WsmFaultResponse*) response)->getFault().getReasonLanguage();
+    }
+    else
+    {
+        httpMessage->contentLanguages = response->getContentLanguages();
+    }
+
+    httpMessage->setCloseConnect(httpCloseConnect);
+    queue->enqueue(httpMessage.release());
+
+    PEG_METHOD_EXIT();
+}
+
+void WsmResponseEncoder::enqueue(WsmResponse* response)
+{
+    PEG_METHOD_ENTER(TRC_WSMSERVER, "WsmResponseEncoder::enqueue()");
+    PEGASUS_ASSERT(response);
+
+    PEG_TRACE((TRC_WSMSERVER, Tracer::LEVEL3,
+        "WsmResponseEncoder::enqueue()- "
+            "response->getHttpCloseConnect() returned %d",
+        response->getHttpCloseConnect()));
+
+    switch (response->getType())
+    {
+        case WS_TRANSFER_GET:
+            _encodeGetResponse((WsmGetResponse*) response);
+            break;
+
+        case WS_TRANSFER_PUT:
+            _encodePutResponse((WsmPutResponse*) response);
+            break;
+
+        case WS_TRANSFER_CREATE:
+            _encodeCreateResponse((WsmCreateResponse*) response);
+            break;
+
+        case WS_TRANSFER_DELETE:
+            _encodeDeleteResponse((WsmDeleteResponse*) response);
+            break;
+
+        case WSM_FAULT:
+            _encodeWsmFaultResponse((WsmFaultResponse*) response);
+            break;
+
+        case SOAP_FAULT:
+            _encodeSoapFaultResponse((SoapFaultResponse*) response);
+            break;
+
+        default:
+            // Unexpected message type
+            PEGASUS_ASSERT(0);
+            break;
+    }
+
+    PEG_METHOD_EXIT();
+}
+
+void WsmResponseEncoder::_encodeGetResponse(WsmGetResponse* response)
+{
+    Buffer body;
+    WsmWriter::appendInstanceElement(body, response->getInstance());
+    sendResponse(response, WSM_ACTION_GET_RESPONSE, &body);
+}
+
+void WsmResponseEncoder::_encodePutResponse(WsmPutResponse* response)
+{
+    Buffer body;
+    Buffer headers;
+
+    // DSP0226 R6.5-1:  A service receiving a message that contains the
+    // wsman:RequestEPR header block should return a response that contains
+    // a wsman:RequestedEPR header block.  This block contains the most recent
+    // EPR of the resource being accessed or a status code if the service
+    // cannot determine or return the EPR.  This EPR reflects any identity
+    // changes that may have occurred as a result of the current operation, as
+    // set forth in the following behavior.  The header block in the
+    // corresponding response message has the following format:
+    //     <wsman:RequestedEPR...>
+    //       [ <wsa:EndpointReference>
+    //          wsa:EndpointReferenceType
+    //       </wsa:EndpointReference> |
+    //       <wsman:EPRInvalid/> |
+    //       <wsman:EPRUnknown/> ]
+    //     </wsman:RequestedEPR>
+    if (response->getRequestedEPR())
+    {
+        WsmWriter::appendStartTag(
+            headers, WsmNamespaces::WS_MAN, STRLIT("RequestedEPR"));
+        WsmWriter::appendStartTag(
+            headers, WsmNamespaces::WS_ADDRESSING, STRLIT("EndpointReference"));
+        WsmWriter::appendEPRElement(headers, response->getEPR());
+        WsmWriter::appendEndTag(
+            headers, WsmNamespaces::WS_ADDRESSING, STRLIT("EndpointReference"));
+        WsmWriter::appendEndTag(
+            headers, WsmNamespaces::WS_MAN, STRLIT("RequestedEPR"));
+    }
+    sendResponse(response, WSM_ACTION_PUT_RESPONSE, &body, &headers);
+}
+
+void WsmResponseEncoder::_encodeCreateResponse(WsmCreateResponse* response)
+{
+    Buffer body;
+    WsmWriter::appendStartTag(
+        body, WsmNamespaces::WS_TRANSFER, STRLIT("ResourceCreated"));
+    WsmWriter::appendEPRElement(body, response->getEPR());
+    WsmWriter::appendEndTag(
+        body, WsmNamespaces::WS_TRANSFER, STRLIT("ResourceCreated"));
+    sendResponse(response, WSM_ACTION_CREATE_RESPONSE, &body);
+}
+
+void WsmResponseEncoder::_encodeDeleteResponse(WsmDeleteResponse* response)
+{
+    sendResponse(response, WSM_ACTION_DELETE_RESPONSE);
+}
+
+void WsmResponseEncoder::_encodeWsmFaultResponse(WsmFaultResponse* response)
+{
+    sendResponse(response);
+}
+
+void WsmResponseEncoder::_encodeSoapFaultResponse(SoapFaultResponse* response)
+{
+    sendResponse(response);
+}
+
+PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/WsmServer/WsmResponseEncoder.h b/src/Pegasus/WsmServer/WsmResponseEncoder.h
new file mode 100644 (file)
index 0000000..a762e00
--- /dev/null
@@ -0,0 +1,71 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_WsmResponseEncoder_h
+#define Pegasus_WsmResponseEncoder_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/WsmServer/WsmResponse.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+/** This class encodes WS-Man operation requests and passes them up-stream.
+ */
+class WsmResponseEncoder
+{
+public:
+
+    WsmResponseEncoder();
+    ~WsmResponseEncoder();
+
+    void sendResponse(
+        WsmResponse* response,
+        const String& action = String::EMPTY,
+        Buffer* bodygiven = 0,
+        Buffer* extraHeaders = 0);
+
+    void enqueue(WsmResponse* response);
+
+private:
+
+    void _encodeGetResponse(WsmGetResponse* response);
+    void _encodePutResponse(WsmPutResponse* response);
+    void _encodeCreateResponse(WsmCreateResponse* response);
+    void _encodeDeleteResponse(WsmDeleteResponse* response);
+    void _encodeWsmFaultResponse(WsmFaultResponse* response);
+    void _encodeSoapFaultResponse(SoapFaultResponse* response);
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_WsmResponseEncoder_h */
diff --git a/src/Pegasus/WsmServer/WsmSelectorSet.h b/src/Pegasus/WsmServer/WsmSelectorSet.h
new file mode 100644 (file)
index 0000000..8b86466
--- /dev/null
@@ -0,0 +1,81 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _Pegasus_WsmSelectorSet_h
+#define _Pegasus_WsmSelectorSet_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/String.h>
+#include <Pegasus/Common/ArrayInternal.h>
+#include <Pegasus/WsmServer/WsmEndpointReference.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+struct WsmSelector
+{
+    enum Type { VALUE, EPR };
+
+    String name;
+    Type type;
+    String value;
+    WsmEndpointReference epr;
+
+    WsmSelector()
+        : type(VALUE)
+    {
+    }
+
+    WsmSelector(const String& name_, const String& value_)
+        : name(name_),
+          type(VALUE),
+          value(value_)
+    {
+    }
+
+    WsmSelector(const String& name_, const WsmEndpointReference& epr_)
+        : name(name_),
+          type(EPR),
+          epr(epr_)
+    {
+    }
+};
+
+class WsmSelectorSet
+{
+public:
+    Array<WsmSelector> selectors;
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif /* _Pegasus_WsmSelectorSet_h */
diff --git a/src/Pegasus/WsmServer/WsmToCimRequestMapper.cpp b/src/Pegasus/WsmServer/WsmToCimRequestMapper.cpp
new file mode 100644 (file)
index 0000000..5c572b0
--- /dev/null
@@ -0,0 +1,962 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#include <cctype>
+#include <cstdio>
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/Tracer.h>
+#include <Pegasus/Common/MessageLoader.h>
+#include <Pegasus/Common/CIMNameUnchecked.h>
+#include <Pegasus/Common/StringConversion.h>
+#include <Pegasus/Common/XmlReader.h>
+#include <Pegasus/Common/XmlWriter.h>
+#include <Pegasus/Common/HostLocator.h>
+#include <Pegasus/WsmServer/WsmConstants.h>
+#include <Pegasus/WsmServer/WsmFault.h>
+#include "WsmToCimRequestMapper.h"
+
+PEGASUS_NAMESPACE_BEGIN
+
+WsmToCimRequestMapper::WsmToCimRequestMapper(CIMRepository* repository)
+    : _repository(repository)
+{
+}
+
+WsmToCimRequestMapper::~WsmToCimRequestMapper()
+{
+}
+
+CIMOperationRequestMessage* WsmToCimRequestMapper::mapToCimRequest(
+    WsmRequest* request)
+{
+    AutoPtr<CIMOperationRequestMessage> cimRequest;
+
+    switch (request->getType())
+    {
+        case WS_TRANSFER_GET:
+            cimRequest.reset(mapToCimGetInstanceRequest(
+                (WsmGetRequest*) request));
+            break;
+
+        case WS_TRANSFER_PUT:
+            cimRequest.reset(mapToCimModifyInstanceRequest(
+                (WsmPutRequest*) request));
+            break;
+
+        case WS_TRANSFER_CREATE:
+            cimRequest.reset(mapToCimCreateInstanceRequest(
+                (WsmCreateRequest*) request));
+            break;
+
+        case WS_TRANSFER_DELETE:
+            cimRequest.reset(mapToCimDeleteInstanceRequest(
+                (WsmDeleteRequest*) request));
+            break;
+
+        default:
+            PEGASUS_ASSERT(0);
+    }
+
+    if (cimRequest.get())
+    {
+        cimRequest->operationContext.insert(
+            IdentityContainer(request->userName));
+        cimRequest->operationContext.set(
+            AcceptLanguageListContainer(request->acceptLanguages));
+        cimRequest->operationContext.set(
+            ContentLanguageListContainer(request->contentLanguages));
+        cimRequest->setHttpMethod(request->httpMethod);
+        cimRequest->setCloseConnect(request->httpCloseConnect);
+    }
+
+    return cimRequest.release();
+}
+
+CIMGetInstanceRequestMessage*
+    WsmToCimRequestMapper::mapToCimGetInstanceRequest(
+        WsmGetRequest* request)
+{
+    CIMNamespaceName nameSpace;
+    CIMObjectPath instanceName;
+
+    _disallowAllClassesResourceUri(request->epr.resourceUri);
+
+    // EPR to object path does a generic conversion, including conversion
+    // of EPR address to host and namespace selector to CIM namespace.
+    // For GetInstance operation instance name should only contain a
+    // class name and key bindings.
+    convertEPRToObjectPath(request->epr, instanceName);
+    nameSpace = instanceName.getNameSpace();
+    instanceName.setNameSpace(CIMNamespaceName());
+    instanceName.setHost(String::EMPTY);
+
+    CIMGetInstanceRequestMessage* cimRequest =
+        new CIMGetInstanceRequestMessage(
+            XmlWriter::getNextMessageId(),
+            nameSpace,
+            instanceName,
+            false,
+            false,
+            false,
+            CIMPropertyList(),
+            QueueIdStack(request->queueId),
+            request->authType,
+            request->userName);
+    cimRequest->ipAddress = request->ipAddress;
+
+    return cimRequest;
+}
+
+CIMModifyInstanceRequestMessage*
+    WsmToCimRequestMapper::mapToCimModifyInstanceRequest(
+        WsmPutRequest* request)
+{
+    CIMNamespaceName nameSpace;
+    CIMObjectPath instanceName;
+
+    _disallowAllClassesResourceUri(request->epr.resourceUri);
+
+    // EPR to object path does a generic conversion, including conversion
+    // of EPR address to host and namespace selector to CIM namespace.
+    // For ModifyInstance operation instance name should only contain a
+    // class name and key bindings.
+    convertEPRToObjectPath(request->epr, instanceName);
+    nameSpace = instanceName.getNameSpace();
+    instanceName.setNameSpace(CIMNamespaceName());
+    instanceName.setHost(String::EMPTY);
+
+    CIMInstance instance;
+    convertWsmToCimInstance(request->instance, nameSpace, instance);
+    instance.setPath(instanceName);
+
+    CIMModifyInstanceRequestMessage* cimRequest =
+        new CIMModifyInstanceRequestMessage(
+            XmlWriter::getNextMessageId(),
+            nameSpace,
+            instance,
+            false, // includeQualifiers
+            CIMPropertyList(),
+            QueueIdStack(request->queueId),
+            request->authType,
+            request->userName);
+
+    cimRequest->ipAddress = request->ipAddress;
+
+    return cimRequest;
+}
+
+CIMCreateInstanceRequestMessage*
+    WsmToCimRequestMapper::mapToCimCreateInstanceRequest(
+        WsmCreateRequest* request)
+{
+    CIMNamespaceName nameSpace;
+    CIMObjectPath instanceName;
+
+    // EPR to object path does a generic conversion, including conversion
+    // of EPR address to host and namespace selector to CIM namespace.
+    // For CreateInstance operation instance name should only contain a
+    // class name and key bindings.
+    convertEPRToObjectPath(request->epr, instanceName);
+    nameSpace = instanceName.getNameSpace();
+    instanceName.setNameSpace(CIMNamespaceName());
+    instanceName.setHost(String::EMPTY);
+
+    CIMInstance instance;
+    convertWsmToCimInstance(request->instance, nameSpace, instance);
+
+    CIMCreateInstanceRequestMessage* cimRequest =
+        new CIMCreateInstanceRequestMessage(
+            XmlWriter::getNextMessageId(),
+            nameSpace,
+            instance,
+            QueueIdStack(request->queueId),
+            request->authType,
+            request->userName);
+    cimRequest->ipAddress = request->ipAddress;
+
+    return cimRequest;
+}
+
+CIMDeleteInstanceRequestMessage*
+    WsmToCimRequestMapper::mapToCimDeleteInstanceRequest(
+        WsmDeleteRequest* request)
+{
+    CIMNamespaceName nameSpace;
+    CIMObjectPath instanceName;
+
+    _disallowAllClassesResourceUri(request->epr.resourceUri);
+
+    // EPR to object path does a generic conversion, including conversion
+    // of EPR address to host and namespace selector to CIM namespace.
+    // For DeleteInstance operation instance name should only contain a
+    // class name and key bindings.
+    convertEPRToObjectPath(request->epr, instanceName);
+    nameSpace = instanceName.getNameSpace();
+    instanceName.setNameSpace(CIMNamespaceName());
+    instanceName.setHost(String::EMPTY);
+
+    CIMDeleteInstanceRequestMessage* cimRequest =
+        new CIMDeleteInstanceRequestMessage(
+            XmlWriter::getNextMessageId(),
+            nameSpace,
+            instanceName,
+            QueueIdStack(request->queueId),
+            request->authType,
+            request->userName);
+    cimRequest->ipAddress = request->ipAddress;
+
+    return cimRequest;
+}
+
+void WsmToCimRequestMapper::_disallowAllClassesResourceUri(
+    const String& resourceUri)
+{
+    // DSP0227 R6-1:  A service should return a wsa:ActionNotSupported fault
+    // if the "all classes" ResourceURI is used with any of the WS-Transfer
+    // operations, even if this ResourceURI is supported for enumerations or
+    // eventing.
+
+    if (resourceUri == WSM_RESOURCEURI_ALLCLASSES)
+    {
+        throw WsmFault(
+            WsmFault::wsa_ActionNotSupported,
+            MessageLoaderParms(
+                "WsmServer.WsmToCimRequestMapper.ALLCLASSES_URI_NOT_ALLOWED",
+                "The \"all classes\" ResourceURI cannot be used with this "
+                    "operation."),
+            WSMAN_FAULTDETAIL_ACTIONMISMATCH);
+    }
+}
+
+CIMName WsmToCimRequestMapper::convertResourceUriToClassName(
+    const String& resourceUri)
+{
+    static const String RESOURCEURI_PREFIX =
+        String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/";
+
+    if (String::compare(
+            resourceUri,
+            RESOURCEURI_PREFIX,
+            RESOURCEURI_PREFIX.size()) == 0)
+    {
+        String className = resourceUri.subString(RESOURCEURI_PREFIX.size());
+
+        if (CIMName::legal(className))
+        {
+            return CIMNameUnchecked(className);
+        }
+    }
+
+    throw WsmFault(
+        WsmFault::wsa_DestinationUnreachable,
+        MessageLoaderParms(
+            "WsmServer.WsmToCimRequestMapper.UNRECOGNIZED_RESOURCEURI",
+            "Unrecognized ResourceURI value: $0.",
+            resourceUri),
+        WSMAN_FAULTDETAIL_INVALIDRESOURCEURI);
+}
+
+String WsmToCimRequestMapper::convertEPRAddressToHostname(const String& addr)
+{
+    // EPR address is formed by adding '/wsman' to the host name.
+    // E.g. http://localhost:5988/wsman
+    // Extract the host name from the EPR address
+    String hostName;
+    if (addr != WSM_ADDRESS_ANONYMOUS)
+    {
+        Uint32 pos1 = 0;
+        if (String::compare(addr, "http://", 7) == 0)
+            pos1 = 7;
+        else if (String::compare(addr, "https://", 8) == 0)
+            pos1 = 8;
+
+        Uint32 pos2 = addr.reverseFind('/');
+        if (pos1 != 0 && pos2 != PEG_NOT_FOUND && pos2 > pos1)
+        {
+            // The string between "http[s]://" and "/wsman" must be 
+            // the host name
+            HostLocator hostLoc(addr.subString(pos1, pos2 - pos1));
+            if (hostLoc.isValid())
+            {
+                hostName = hostLoc.getHost();
+            }
+        }
+
+        if (hostName.size() == 0)
+        {
+            // Invalid host name
+            throw WsmFault(
+                WsmFault::wsa_InvalidMessageInformationHeader,
+                MessageLoaderParms(
+                    "WsmServer.WsmToCimRequestMapper.INVALID_EPR_ADDRESS",
+                    "The EPR address \"$0\" is not valid", addr),
+                    WSMAN_FAULTDETAIL_INVALIDVALUE);
+        }
+    }
+    return hostName;
+}
+
+void WsmToCimRequestMapper::convertEPRToObjectPath(
+    const WsmEndpointReference& epr,
+    CIMObjectPath& objectPath)
+{
+    Array<CIMKeyBinding> keyBindings;
+    CIMNamespaceName namespaceName;
+
+    // Convert the ResourceURI to a CIM class name
+    CIMName className = convertResourceUriToClassName(epr.resourceUri);
+
+    PEGASUS_ASSERT(epr.selectorSet);
+
+    // Determine the namespace from the selector set
+    for (Uint32 i = 0, n = epr.selectorSet->selectors.size(); i < n; i++)
+    {
+        if (String::equalNoCase(
+                epr.selectorSet->selectors[i].name, "__cimnamespace"))
+        {
+            if (epr.selectorSet->selectors[i].type != WsmSelector::VALUE)
+            {
+                throw WsmFault(
+                    WsmFault::wsman_InvalidSelectors,
+                    MessageLoaderParms(
+                        "WsmServer.WsmToCimRequestMapper."
+                            "SELECTOR_TYPE_MISMATCH",
+                        "Selector \"$0\" is not of the correct type.",
+                        epr.selectorSet->selectors[i].name),
+                    WSMAN_FAULTDETAIL_TYPEMISMATCH);
+            }
+
+            if (!CIMNamespaceName::legal(epr.selectorSet->selectors[i].value))
+            {
+                throw WsmFault(
+                    WsmFault::wsman_InvalidSelectors,
+                    MessageLoaderParms(
+                        "WsmServer.WsmToCimRequestMapper."
+                            "INVALID_SELECTOR_VALUE",
+                        "The value \"$0\" is not valid for selector \"$1\".",
+                        epr.selectorSet->selectors[i].value,
+                        epr.selectorSet->selectors[i].name),
+                    WSMAN_FAULTDETAIL_INVALIDVALUE);
+            }
+
+            namespaceName = epr.selectorSet->selectors[i].value;
+            break;
+        }
+    }
+
+    if (namespaceName.isNull())
+    {
+        namespaceName = PEGASUS_DEFAULT_WSM_NAMESPACE;
+    }
+
+    CIMClass cimClass = _repository->getClass(
+        namespaceName,
+        className,
+        false /*localOnly*/);
+
+    for (Uint32 i = 0, n = epr.selectorSet->selectors.size(); i < n; i++)
+    {
+        if (!String::equalNoCase(
+                epr.selectorSet->selectors[i].name, "__cimnamespace"))
+        {
+            Uint32 propertyPos;
+
+            if (!CIMName::legal(epr.selectorSet->selectors[i].name) ||
+                ((propertyPos = cimClass.findProperty(CIMNameUnchecked(
+                    epr.selectorSet->selectors[i].name))) == PEG_NOT_FOUND))
+            {
+                throw WsmFault(
+                    WsmFault::wsman_InvalidSelectors,
+                    MessageLoaderParms(
+                        "WsmServer.WsmToCimRequestMapper.UNEXPECTED_SELECTOR",
+                        "Selector \"$0\" is not expected for a resource of "
+                            "class $1 in namespace $2.",
+                        epr.selectorSet->selectors[i].name,
+                        className.getString(),
+                        namespaceName.getString()),
+                    WSMAN_FAULTDETAIL_UNEXPECTEDSELECTORS);
+            }
+
+            CIMProperty property = cimClass.getProperty(propertyPos);
+            CIMKeyBinding newKeyBinding(
+                CIMNameUnchecked(epr.selectorSet->selectors[i].name),
+                property.getValue());
+
+            if (((newKeyBinding.getType() == CIMKeyBinding::REFERENCE) &&
+                 (epr.selectorSet->selectors[i].type != WsmSelector::EPR)) ||
+                ((newKeyBinding.getType() != CIMKeyBinding::REFERENCE) &&
+                 (epr.selectorSet->selectors[i].type == WsmSelector::EPR)))
+            {
+                throw WsmFault(
+                    WsmFault::wsman_InvalidSelectors,
+                    MessageLoaderParms(
+                        "WsmServer.WsmToCimRequestMapper."
+                            "SELECTOR_TYPE_MISMATCH",
+                        "Selector \"$0\" is not of the correct type.",
+                        epr.selectorSet->selectors[i].name),
+                    WSMAN_FAULTDETAIL_TYPEMISMATCH);
+            }
+
+            if (epr.selectorSet->selectors[i].type == WsmSelector::VALUE)
+            {
+                newKeyBinding.setValue(epr.selectorSet->selectors[i].value);
+            }
+            else
+            {
+                CIMObjectPath reference;
+                convertEPRToObjectPath(
+                    epr.selectorSet->selectors[i].epr,
+                    reference);
+                newKeyBinding.setValue(reference.toString());
+            }
+
+            keyBindings.append(newKeyBinding);
+        }
+    }
+
+    objectPath = CIMObjectPath(
+        convertEPRAddressToHostname(epr.address),
+        namespaceName,
+        className,
+        keyBindings);
+}
+
+void WsmToCimRequestMapper::convertWsmToCimInstance(
+    WsmInstance& wsmInstance,
+    const CIMNamespaceName& nameSpace,
+    CIMInstance& cimInstance)
+{
+    CIMName className(wsmInstance.getClassName());
+    CIMClass cimClass =
+        _repository->getClass(nameSpace, className, false /* localOnly */);
+
+    cimInstance = CIMInstance(className);
+    for (Uint32 i = 0, n = wsmInstance.getPropertyCount(); i < n; i++)
+    {
+        WsmProperty& wsmProperty = wsmInstance.getProperty(i);
+        const String& wsmPropName = wsmProperty.getName();
+        WsmValue& wsmPropValue = wsmProperty.getValue();
+
+        if (CIMName::legal(wsmPropName))
+        {
+            Uint32 cimPropIdx = cimClass.findProperty(CIMName(wsmPropName));
+            if (cimPropIdx != PEG_NOT_FOUND)
+            {
+                CIMProperty cimProperty = cimClass.getProperty(cimPropIdx);
+                CIMValue cimPropValue(cimProperty.getValue());
+
+                convertWsmToCimValue(wsmPropValue, nameSpace, cimPropValue);
+                cimProperty.setValue(cimPropValue);
+                cimInstance.addProperty(cimProperty);
+                continue;
+            }
+        }
+
+        throw WsmFault(
+            WsmFault::wsman_SchemaValidationError,
+            MessageLoaderParms(
+                "WsmServer.WsmToCimRequestMapper.NO_SUCH_PROPERTY",
+                "The $0 property does not exist.",
+                wsmPropName));
+    }
+}
+
+void WsmToCimRequestMapper::convertWsmToCimValue(
+    WsmValue& wsmValue,
+    const CIMNamespaceName& nameSpace,
+    CIMValue& cimValue)
+{
+    if (wsmValue.isNull())
+    {
+        cimValue.setNullValue(
+            cimValue.getType(), cimValue.isArray(), cimValue.getArraySize());
+        return;
+    }
+
+    if (cimValue.isArray())
+    {
+        wsmValue.toArray();
+        switch (wsmValue.getType())
+        {
+            case WSMTYPE_REFERENCE:
+            {
+                Array<WsmEndpointReference> eprs;
+                Array<CIMObjectPath> objPaths;
+                wsmValue.get(eprs);
+                for (Uint32 i = 0, n = eprs.size(); i < n; i++)
+                {
+                    CIMObjectPath objPath;
+                    convertEPRToObjectPath(eprs[i], objPath);
+                    objPaths.append(objPath);
+                }
+                cimValue.set(objPaths);
+                break;
+            }
+
+            case WSMTYPE_INSTANCE:
+            {
+                Array<WsmInstance> wsmInst;
+                Array<CIMInstance> cimInst;
+                wsmValue.get(wsmInst);
+                for (Uint32 i = 0, n = wsmInst.size(); i < n; i++)
+                {
+                    CIMInstance inst;
+                    convertWsmToCimInstance(wsmInst[i], nameSpace, inst);
+                    cimInst.append(inst);
+                }
+                cimValue.set(cimInst);
+                break;
+            }
+
+            case WSMTYPE_OTHER:
+            {
+                Array<String> strs;
+                wsmValue.get(strs);
+                convertStringArrayToCimValue(
+                    strs, cimValue.getType(), cimValue);
+                break;
+            }
+
+            default:
+            {
+                PEGASUS_ASSERT(0);
+            }
+        }
+    }
+    else
+    {
+        if (wsmValue.isArray())
+        {
+            throw TypeMismatchException();
+        }
+
+        switch (wsmValue.getType())
+        {
+            case WSMTYPE_REFERENCE:
+            {
+                WsmEndpointReference epr;
+                CIMObjectPath objPath;
+                wsmValue.get(epr);
+                convertEPRToObjectPath(epr, objPath);
+                cimValue.set(objPath);
+                break;
+            }
+
+            case WSMTYPE_INSTANCE:
+            {
+                WsmInstance wsmInst;
+                CIMInstance cimInst;
+                wsmValue.get(wsmInst);
+                convertWsmToCimInstance(wsmInst, nameSpace, cimInst);
+                cimValue.set(cimInst);
+                break;
+            }
+
+            case WSMTYPE_OTHER:
+            {
+                String str;
+                wsmValue.get(str);
+                convertStringToCimValue(str, cimValue.getType(), cimValue);
+                break;
+            }
+
+            default:
+            {
+                PEGASUS_ASSERT(0);
+            }
+        }
+    }
+}
+
+void WsmToCimRequestMapper::convertStringToCimValue(
+    const String& str,
+    CIMType cimType,
+    CIMValue& cimValue)
+{
+    switch (cimType)
+    {
+        case CIMTYPE_BOOLEAN:
+        {
+            Boolean val;
+            if (String::compare(str, "true") == 0 || 
+                String::compare(str, "1") == 0)
+            {
+                val = 1;
+            }
+            else if (String::compare(str, "false") == 0 ||
+                     String::compare(str, "0") == 0)
+            {
+                val = 0;
+            }
+            else
+            {
+                throw WsmFault(
+                    WsmFault::wxf_InvalidRepresentation,
+                    MessageLoaderParms(
+                        "WsmServer.WsmToCimRequestMapper.INVALID_BOOLEAN_VALUE",
+                        "The boolean value \"$0\" is not valid", str),
+                    WSMAN_FAULTDETAIL_INVALIDVALUE);
+            }
+            cimValue.set(val);
+            break;
+        }
+
+        case CIMTYPE_UINT8:
+        case CIMTYPE_UINT16:
+        case CIMTYPE_UINT32:
+        case CIMTYPE_UINT64:
+        {
+            Uint64 val;
+            if (!XmlReader::stringToUnsignedInteger(
+                (const char*) str.getCString(), val))
+            {
+                throw WsmFault(
+                    WsmFault::wxf_InvalidRepresentation,
+                    MessageLoaderParms(
+                        "WsmServer.WsmToCimRequestMapper.INVALID_UI_VALUE",
+                        "The unsigned integer value \"$0\" is not valid", str),
+                    WSMAN_FAULTDETAIL_INVALIDVALUE);
+            }
+
+            switch (cimType)
+            {
+                case CIMTYPE_UINT8:
+                {
+                    if (!StringConversion::checkUintBounds(val, cimType))
+                    {
+                        throw WsmFault(
+                            WsmFault::wxf_InvalidRepresentation,
+                            MessageLoaderParms(
+                                "WsmServer.WsmToCimRequestMapper."
+                                "VALUE_OUT_OF_RANGE",
+                                "The $0 value \"$1\" is out of range",
+                                "Uint8", str),
+                            WSMAN_FAULTDETAIL_INVALIDVALUE);
+                    }
+                    cimValue.set(Uint8(val));
+                    break;
+                }
+                case CIMTYPE_UINT16:
+                {
+                    if (!StringConversion::checkUintBounds(val, cimType))
+                    {
+                        throw WsmFault(
+                            WsmFault::wxf_InvalidRepresentation,
+                            MessageLoaderParms(
+                                "WsmServer.WsmToCimRequestMapper."
+                                "VALUE_OUT_OF_RANGE",
+                                "The $0 value \"$1\" is out of range",
+                                "Uint16", str),
+                            WSMAN_FAULTDETAIL_INVALIDVALUE);
+                    }
+                    cimValue.set(Uint16(val));
+                    break;
+                }
+                case CIMTYPE_UINT32:
+                {
+                    if (!StringConversion::checkUintBounds(val, cimType))
+                    {
+                        throw WsmFault(
+                            WsmFault::wxf_InvalidRepresentation,
+                            MessageLoaderParms(
+                                "WsmServer.WsmToCimRequestMapper."
+                                "VALUE_OUT_OF_RANGE",
+                                "The $0 value \"$1\" is out of range",
+                                "Uint32", str),
+                            WSMAN_FAULTDETAIL_INVALIDVALUE);
+                    }
+                    cimValue.set(Uint32(val));
+                    break;
+                }
+                case CIMTYPE_UINT64:
+                {
+                    cimValue.set(Uint64(val));
+                    break;
+                }
+                default:
+                {
+                    PEGASUS_ASSERT(0);
+                }
+            }
+            break;
+        }
+
+        case CIMTYPE_SINT8:
+        case CIMTYPE_SINT16:
+        case CIMTYPE_SINT32:
+        case CIMTYPE_SINT64:
+        {
+            Sint64 val;
+            if (!XmlReader::stringToSignedInteger(
+                (const char*) str.getCString(), val))
+            {
+                throw WsmFault(
+                    WsmFault::wxf_InvalidRepresentation,
+                    MessageLoaderParms(
+                        "WsmServer.WsmToCimRequestMapper.INVALID_SI_VALUE",
+                        "The signed integer value \"$0\" is not valid", str),
+                    WSMAN_FAULTDETAIL_INVALIDVALUE);
+            }
+
+            switch (cimType)
+            {
+                case CIMTYPE_SINT8:
+                {
+                    if (!StringConversion::checkSintBounds(val, cimType))
+                    {
+                        throw WsmFault(
+                            WsmFault::wxf_InvalidRepresentation,
+                            MessageLoaderParms(
+                                "WsmServer.WsmToCimRequestMapper."
+                                "VALUE_OUT_OF_RANGE",
+                                "The $0 value \"$1\" is out of range",
+                                "Sint8", str),
+                            WSMAN_FAULTDETAIL_INVALIDVALUE);
+                    }
+                    cimValue.set(Sint8(val));
+                    break;
+                }
+                case CIMTYPE_SINT16:
+                {
+                    if (!StringConversion::checkSintBounds(val, cimType))
+                    {
+                        throw WsmFault(
+                            WsmFault::wxf_InvalidRepresentation,
+                            MessageLoaderParms(
+                                "WsmServer.WsmToCimRequestMapper."
+                                "VALUE_OUT_OF_RANGE",
+                                "The $0 value \"$1\" is out of range",
+                                "Sint16", str),
+                            WSMAN_FAULTDETAIL_INVALIDVALUE);
+                    }
+                    cimValue.set(Sint16(val));
+                    break;
+                }
+                case CIMTYPE_SINT32:
+                {
+                    if (!StringConversion::checkSintBounds(val, cimType))
+                    {
+                        throw WsmFault(
+                            WsmFault::wxf_InvalidRepresentation,
+                            MessageLoaderParms(
+                                "WsmServer.WsmToCimRequestMapper."
+                                "VALUE_OUT_OF_RANGE",
+                                "The $0 value \"$1\" is out of range",
+                                "Sint32", str),
+                            WSMAN_FAULTDETAIL_INVALIDVALUE);
+                    }
+                    cimValue.set(Sint32(val));
+                    break;
+                }
+                case CIMTYPE_SINT64:
+                {
+                    cimValue.set(Sint64(val));
+                    break;
+                }
+                default:
+                {
+                    PEGASUS_ASSERT(0);
+                }
+            }
+            break;
+        }
+
+        case CIMTYPE_REAL32:
+        {
+            Real64 val;
+            if (!StringConversion::stringToReal64(
+                (const char*) str.getCString(), val))
+            {
+                throw WsmFault(
+                    WsmFault::wxf_InvalidRepresentation,
+                    MessageLoaderParms(
+                        "WsmServer.WsmToCimRequestMapper.INVALID_RN_VALUE",
+                        "The real number value \"$0\" is not valid", str),
+                    WSMAN_FAULTDETAIL_INVALIDVALUE);
+            }
+            cimValue.set(Real32(val));
+            break;
+        }
+
+        case CIMTYPE_REAL64:
+        {
+            Real64 val;
+            if (!StringConversion::stringToReal64(
+                (const char*) str.getCString(), val))
+            {
+                throw WsmFault(
+                    WsmFault::wxf_InvalidRepresentation,
+                    MessageLoaderParms(
+                        "WsmServer.WsmToCimRequestMapper.INVALID_RN_VALUE",
+                        "The real number value \"$0\" is not valid", str),
+                    WSMAN_FAULTDETAIL_INVALIDVALUE);
+            }
+            cimValue.set(val);
+            break;
+        }
+
+        case CIMTYPE_CHAR16:
+        {
+            if (str.size() != 1)
+            {
+                throw WsmFault(
+                    WsmFault::wxf_InvalidRepresentation,
+                    MessageLoaderParms(
+                        "WsmServer.WsmToCimRequestMapper.INVALID_CHAR16_VALUE",
+                        "The char16 value \"$0\" is not valid", str),
+                    WSMAN_FAULTDETAIL_INVALIDVALUE);
+            }
+            cimValue.set(str[0]);
+            break;
+        }
+
+        case CIMTYPE_STRING:
+        {
+            cimValue.set(str);
+            break;
+        }
+
+        case CIMTYPE_DATETIME:
+        {
+            CIMDateTime tmp;
+            try
+            {
+                tmp.set(str);
+            }
+            catch (InvalidDateTimeFormatException&)
+            {
+                throw WsmFault(
+                    WsmFault::wxf_InvalidRepresentation,
+                    MessageLoaderParms(
+                        "WsmServer.WsmToCimRequestMapper.INVALID_DT_VALUE",
+                        "The datetime value \"$0\" is not valid", str),
+                    WSMAN_FAULTDETAIL_INVALIDVALUE);
+            }
+            cimValue.set(tmp);
+            break;
+        }
+
+        default:
+        {
+            PEGASUS_ASSERT(0);
+        }
+    }
+}
+
+template<class T>
+void _convertStringArrayToCimValueAux(
+    const Array<String>& strs,
+    CIMType cimType,
+    CIMValue& cimValue)
+{
+    Array<T> arr;
+    for (Uint32 i = 0, n = strs.size(); i < n; i++)
+    {
+        T val;
+        CIMValue tmp;
+        WsmToCimRequestMapper::convertStringToCimValue(strs[i], cimType, tmp);
+        tmp.get(val);
+        arr.append(val);
+    }
+    cimValue.set(arr);
+}
+
+void WsmToCimRequestMapper::convertStringArrayToCimValue(
+    const Array<String>& strs,
+    CIMType cimType,
+    CIMValue& cimValue)
+{
+        switch (cimValue.getType())
+        {
+            case CIMTYPE_BOOLEAN:
+                _convertStringArrayToCimValueAux<Boolean>(
+                    strs, cimType, cimValue);
+                break;
+            case CIMTYPE_UINT8:
+                _convertStringArrayToCimValueAux<Uint8>(
+                    strs, cimType, cimValue);
+                break;
+            case CIMTYPE_SINT8:
+                _convertStringArrayToCimValueAux<Sint8>(
+                    strs, cimType, cimValue);
+                break;
+            case CIMTYPE_UINT16:
+                _convertStringArrayToCimValueAux<Uint16>(
+                    strs, cimType, cimValue);
+                break;
+            case CIMTYPE_SINT16:
+                _convertStringArrayToCimValueAux<Sint16>(
+                    strs, cimType, cimValue);
+                break;
+            case CIMTYPE_UINT32:
+                _convertStringArrayToCimValueAux<Uint32>(
+                    strs, cimType, cimValue);
+                break;
+            case CIMTYPE_SINT32:
+                _convertStringArrayToCimValueAux<Sint32>(
+                    strs, cimType, cimValue);
+                break;
+            case CIMTYPE_UINT64:
+                _convertStringArrayToCimValueAux<Uint64>(
+                    strs, cimType, cimValue);
+                break;
+            case CIMTYPE_SINT64:
+                _convertStringArrayToCimValueAux<Sint64>(
+                    strs, cimType, cimValue);
+                break;
+            case CIMTYPE_REAL32:
+                _convertStringArrayToCimValueAux<Real32>(
+                    strs, cimType, cimValue);
+                break;
+            case CIMTYPE_REAL64:
+                _convertStringArrayToCimValueAux<Real64>(
+                    strs, cimType, cimValue);
+                break;
+            case CIMTYPE_CHAR16:
+                _convertStringArrayToCimValueAux<Char16>(
+                    strs, cimType, cimValue);
+                break;
+            case CIMTYPE_STRING:
+                _convertStringArrayToCimValueAux<String>(
+                    strs, cimType, cimValue);
+                break;
+            case CIMTYPE_DATETIME:
+                _convertStringArrayToCimValueAux<CIMDateTime>(
+                    strs, cimType, cimValue);
+                break;
+            default:
+                PEGASUS_ASSERT(0);
+        }
+}
+
+PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/WsmServer/WsmToCimRequestMapper.h b/src/Pegasus/WsmServer/WsmToCimRequestMapper.h
new file mode 100644 (file)
index 0000000..7844b70
--- /dev/null
@@ -0,0 +1,101 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_WsmToCimRequestMapper_h
+#define Pegasus_WsmToCimRequestMapper_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/CIMMessage.h>
+#include <Pegasus/Repository/CIMRepository.h>
+#include <Pegasus/WsmServer/WsmRequest.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+/**
+    Converts WsmRequest messages to CIMOperationRequestMessages.
+*/
+class PEGASUS_WSMSERVER_LINKAGE WsmToCimRequestMapper
+{
+public:
+
+    WsmToCimRequestMapper(CIMRepository* repository);
+    ~WsmToCimRequestMapper();
+
+    CIMOperationRequestMessage* mapToCimRequest(WsmRequest* request);
+
+    CIMGetInstanceRequestMessage* mapToCimGetInstanceRequest(
+        WsmGetRequest* request);
+    CIMModifyInstanceRequestMessage* mapToCimModifyInstanceRequest(
+        WsmPutRequest* request);
+    CIMCreateInstanceRequestMessage* mapToCimCreateInstanceRequest(
+        WsmCreateRequest* request);
+    CIMDeleteInstanceRequestMessage* mapToCimDeleteInstanceRequest(
+        WsmDeleteRequest* request);
+
+    CIMName convertResourceUriToClassName(const String& resourceUri);
+    String convertEPRAddressToHostname(const String& addr);
+
+    void convertWsmToCimValue(
+        WsmValue& wsmValue,
+        const CIMNamespaceName& nameSpace,
+        CIMValue& cimValue);
+
+    static void convertStringToCimValue(
+        const String& str,
+        CIMType cimType,
+        CIMValue& cimValue);
+
+    void convertStringArrayToCimValue(
+        const Array<String>& strs,
+        CIMType cimType,
+        CIMValue& cimValue);
+
+    void convertWsmToCimInstance(
+        WsmInstance& wsmInstance,
+        const CIMNamespaceName& nameSpace,
+        CIMInstance& cimInstance);
+
+    void convertEPRToObjectPath(
+        const WsmEndpointReference& epr,
+        CIMObjectPath& objectPath);
+
+private:
+
+    CIMRepository* _repository;
+
+    void _disallowAllClassesResourceUri(const String& resourceUri);
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_WsmToCimRequestMapper_h */
diff --git a/src/Pegasus/WsmServer/WsmUtils.cpp b/src/Pegasus/WsmServer/WsmUtils.cpp
new file mode 100644 (file)
index 0000000..46c9828
--- /dev/null
@@ -0,0 +1,175 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#include <Pegasus/Common/String.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include "WsmUtils.h"
+
+PEGASUS_NAMESPACE_BEGIN
+
+XmlNamespace WsmNamespaces::supportedNamespaces[] =
+{
+    {
+        "SOAP-ENV",
+        "http://www.w3.org/2003/05/soap-envelope",
+        SOAP_ENVELOPE,
+        0
+    },
+    {
+        "SOAP-ENC",
+        "http://www.w3.org/2003/05/soap-encoding",
+        SOAP_ENCODING,
+        0
+    },
+    {
+        "xml",
+        "http://www.w3.org/XML/1998/namespace",
+        XML_NAMESPACE,
+        0
+    },
+    {
+        "xsi",
+        "http://www.w3.org/2001/XMLSchema-instance",
+        XML_SCHEMA_INSTANCE,
+        0
+    },
+    {
+        "xsd",
+        "http://www.w3.org/2001/XMLSchema",
+        XML_SCHEMA,
+        0
+    },
+    {
+        "wsman",
+        "http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd",
+        WS_MAN,
+        0
+    },
+    {
+        "wsmb",
+        "http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd",
+        WS_CIM_BINDING,
+        0
+    },
+    {
+        "wsa",
+        "http://schemas.xmlsoap.org/ws/2004/08/addressing",
+        WS_ADDRESSING,
+        0
+    },
+    {
+        "wxf",
+        "http://schemas.xmlsoap.org/ws/2004/09/transfer",
+        WS_TRANSFER,
+        0
+    },
+    {
+        "wsen",
+        "http://schemas.xmlsoap.org/ws/2004/09/enumeration",
+        WS_ENUMERATION,
+        0
+    },
+    {
+        "wse",
+        "http://schemas.xmlsoap.org/ws/2004/08/eventing",
+        WS_EVENTING,
+        0
+    },
+    {
+        "wsp",
+        "http://schemas.xmlsoap.org/ws/2004/09/policy",
+        WS_POLICY,
+        0
+    },
+    {
+        "wsdl",
+        "http://schemas.xmlsoap.org/wsdl",
+        WSDL,
+        0
+    },
+    {
+        "wscim",
+        "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2",
+        WS_CIM_SCHEMA,
+        0
+    },
+    {0, 0, LAST, 0}
+};
+
+
+String WsmUtils::getMessageId()
+{
+    // DSP0226 R5.4.4-1: The MessageID and RelatesTo URIs may be of any format,
+    // as long as they are valid URIs according to RFC 3986.  Two URIs are
+    // considered different even if the characters in the URIs differ only by
+    // case.
+    //
+    // The following two formats are endorsed by this specification.  The first
+    // is considered a best practice because it is backed by IETF RFC 4122:
+    //     urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+    //     or
+    //     uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+    //
+    // In these formats, each x is an uppercase or lowercase hexadecimal digit
+    // (lowercase is required by RFC 4122); there are no spaces or other
+    // tokens.  The value may be a DCE-style universally unique identifier
+    // (UUID) with provable uniqueness properties in this format, however, it
+    // is not necessary to have provable uniqueness properties in the URIs
+    // used in the wsa:MessageID and wsa:RelatesTo headers.
+    //
+    // Regardless of format, the URI should not exceed the maximum defined in
+    // R13.1-6. [sic]
+
+    // DSP0226 R5.4.4-2: The MessageID should be generated according to any
+    // algorithm that ensures that no two MessageIDs are repeated.  Because
+    // the value is treated as case-sensitive (R5.4.4-1), confusion can arise
+    // if the same value is reused differing only in case.  As a result, the
+    // service shall not create or employ MessageID values that differ only in
+    // case.  For any message transmitted by the service, the MessageID shall
+    // not be reused.
+
+    // Note: This algorithm could be improved, but provable uniqueness is not
+    // required (see above).
+
+    char uuid[42];
+    sprintf(uuid, "uuid:%08X-%04X-%04X-%04X-%08X%04X",
+        rand(),
+        rand() & 0xFFFF,
+        rand() & 0xFFFF,
+        rand() & 0xFFFF,
+        rand(),
+        rand() & 0xFFFF);
+    return String(uuid, 41);
+}
+
+PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/WsmServer/WsmUtils.h b/src/Pegasus/WsmServer/WsmUtils.h
new file mode 100644 (file)
index 0000000..aa032d7
--- /dev/null
@@ -0,0 +1,93 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_WsmUtils_h
+#define Pegasus_WsmUtils_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/String.h>
+#include <Pegasus/Common/XmlParser.h>
+#include <Pegasus/WsmServer/Linkage.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+class PEGASUS_WSMSERVER_LINKAGE WsmNamespaces
+{
+public:
+
+    enum Type
+    {
+        UNKNOWN = -1,
+
+        SOAP_ENVELOPE = 0,
+        SOAP_ENCODING,
+        XML_NAMESPACE,
+        XML_SCHEMA_INSTANCE,
+        XML_SCHEMA,
+        WS_MAN,
+        WS_CIM_BINDING,
+        WS_ADDRESSING,
+        WS_TRANSFER,
+        WS_ENUMERATION,
+        WS_EVENTING,
+        WS_POLICY,
+        WSDL,
+        WS_CIM_SCHEMA,
+
+        COUNT,
+        LAST = COUNT
+    };
+
+    static XmlNamespace supportedNamespaces[];
+
+private:
+
+    WsmNamespaces();
+};
+
+
+class PEGASUS_WSMSERVER_LINKAGE WsmUtils
+{
+public:
+
+    static String getMessageId();
+
+private:
+
+    WsmUtils();
+};
+
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_WsmUtils_h */
diff --git a/src/Pegasus/WsmServer/WsmValue.cpp b/src/Pegasus/WsmServer/WsmValue.cpp
new file mode 100644 (file)
index 0000000..5abbdf6
--- /dev/null
@@ -0,0 +1,462 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#include <Pegasus/Common/Exception.h>
+#include <Pegasus/Common/PegasusAssert.h>
+
+#include "WsmValue.h"
+#include "WsmEndpointReference.h"
+#include "WsmInstance.h"
+
+PEGASUS_NAMESPACE_BEGIN
+
+WsmValue::WsmValue()
+    : _type(WSMTYPE_OTHER),
+      _isArray(false),
+      _isNull(true)
+{
+    _rep.str = 0;
+}
+
+WsmValue::WsmValue(const WsmValue& val)
+    : _type(WSMTYPE_OTHER),
+      _isArray(false),
+      _isNull(true)
+{
+    *this = val;
+}
+
+WsmValue::WsmValue(const WsmEndpointReference& ref)
+    : _type(WSMTYPE_REFERENCE),
+      _isArray(false),
+      _isNull(false)
+{
+    _rep.ref = new WsmEndpointReference(ref);
+}
+
+WsmValue::WsmValue(const Array<WsmEndpointReference>& ref)
+    : _type(WSMTYPE_REFERENCE),
+      _isArray(true),
+      _isNull(false)
+{
+    _rep.refa = new Array<WsmEndpointReference>(ref);
+}
+
+WsmValue::WsmValue(const WsmInstance& inst)
+    : _type(WSMTYPE_INSTANCE),
+      _isArray(false),
+      _isNull(false)
+{
+    _rep.inst = new WsmInstance(inst);
+}
+
+WsmValue::WsmValue(const Array<WsmInstance>& inst)
+    : _type(WSMTYPE_INSTANCE),
+      _isArray(true),
+      _isNull(false)
+{
+    _rep.insta = new Array<WsmInstance>(inst);
+}
+
+WsmValue::WsmValue(const String& str)
+    : _type(WSMTYPE_OTHER),
+      _isArray(false),
+      _isNull(false)
+{
+    _rep.str = new String(str);
+}
+
+WsmValue::WsmValue(const Array<String>& str)
+    : _type(WSMTYPE_OTHER),
+      _isArray(true),
+      _isNull(false)
+{
+    _rep.stra = new Array<String>(str);
+}
+
+WsmValue& WsmValue::operator=(const WsmValue& val)
+{
+    if (this == &val)
+    {
+        return *this;
+    }
+
+    _release();
+
+    if (!val._isNull)
+    {
+        if (val._isArray)
+        {
+            switch (val._type)
+            {
+                case WSMTYPE_REFERENCE:
+                    _rep.refa = new Array<WsmEndpointReference>(*val._rep.refa);
+                    break;
+
+                case WSMTYPE_INSTANCE:
+                    _rep.insta = new Array<WsmInstance>(*val._rep.insta);
+                    break;
+
+                case WSMTYPE_OTHER:
+                    _rep.stra = new Array<String>(*val._rep.stra);
+                    break;
+
+                default:
+                    PEGASUS_ASSERT(0);
+                    break;
+            }
+        }
+        else
+        {
+            switch (val._type)
+            {
+                case WSMTYPE_REFERENCE:
+                    _rep.ref = new WsmEndpointReference(*val._rep.ref);
+                    break;
+
+                case WSMTYPE_INSTANCE:
+                    _rep.inst = new WsmInstance(*val._rep.inst);
+                    break;
+
+                case WSMTYPE_OTHER:
+                    _rep.str = new String(*val._rep.str);
+                    break;
+
+                default:
+                    PEGASUS_ASSERT(0);
+                    break;
+            }
+        }
+    }
+
+    _type = val._type;
+    _isArray = val._isArray;
+    _isNull = val._isNull;
+
+    return *this;
+}
+
+Uint32 WsmValue::getArraySize()
+{
+    if (!_isArray)
+        return 0;
+
+    switch (_type)
+    {
+        case WSMTYPE_REFERENCE:
+            return _rep.refa->size();
+
+        case WSMTYPE_INSTANCE:
+            return _rep.insta->size();
+
+        case WSMTYPE_OTHER:
+            return _rep.stra->size();
+
+        default:
+            PEGASUS_ASSERT(0);
+    }
+}
+
+void WsmValue::_release()
+{
+    if (_isNull)
+        return;
+
+    if (_isArray)
+    {
+        switch (_type)
+        {
+            case WSMTYPE_REFERENCE:
+                delete _rep.refa;
+                break;
+
+            case WSMTYPE_INSTANCE:
+                delete _rep.insta;
+                break;
+
+            case WSMTYPE_OTHER:
+                delete _rep.stra;
+                break;
+
+            default:
+                PEGASUS_ASSERT(0);
+                break;
+        }
+    }
+    else
+    {
+        switch (_type)
+        {
+            case WSMTYPE_REFERENCE:
+                delete _rep.ref;
+                break;
+
+            case WSMTYPE_INSTANCE:
+                delete _rep.inst;
+                break;
+
+            case WSMTYPE_OTHER:
+                delete _rep.str;
+                break;
+
+            default:
+                PEGASUS_ASSERT(0);
+                break;
+        }
+    }
+}
+
+void WsmValue::get(WsmEndpointReference& ref) const
+{
+    if (_type != WSMTYPE_REFERENCE || _isArray)
+        throw TypeMismatchException();
+
+    if (!_isNull)
+        ref = *_rep.ref;
+}
+
+void WsmValue::get(Array<WsmEndpointReference>& ref) const
+{
+    if (_type != WSMTYPE_REFERENCE || !_isArray)
+        throw TypeMismatchException();
+
+    if (!_isNull)
+        ref = *_rep.refa;
+}
+
+void WsmValue::get(WsmInstance& inst) const
+{
+    if (_type != WSMTYPE_INSTANCE || _isArray)
+        throw TypeMismatchException();
+
+    if (!_isNull)
+        inst = *_rep.inst;
+}
+
+void WsmValue::get(Array<WsmInstance>& inst) const
+{
+    if (_type != WSMTYPE_INSTANCE || !_isArray)
+        throw TypeMismatchException();
+
+    if (!_isNull)
+        inst = *_rep.insta;
+}
+
+void WsmValue::get(String& str) const
+{
+    if (_type != WSMTYPE_OTHER || _isArray)
+        throw TypeMismatchException();
+
+    if (!_isNull)
+        str = *_rep.str;
+}
+
+void WsmValue::get(Array<String>& str) const
+{
+    if (_type != WSMTYPE_OTHER || !_isArray)
+        throw TypeMismatchException();
+
+    if (!_isNull)
+        str = *_rep.stra;
+}
+
+void WsmValue::set(const WsmEndpointReference& ref)
+{
+    _release();
+    _type = WSMTYPE_REFERENCE;
+    _isArray = false;
+    _isNull = false;
+    _rep.ref = new WsmEndpointReference(ref);
+}
+
+void WsmValue::set(const Array<WsmEndpointReference>& ref)
+{
+    _release();
+    _type = WSMTYPE_REFERENCE;
+    _isArray = true;
+    _isNull = false;
+    _rep.refa = new Array<WsmEndpointReference>(ref);
+}
+
+void WsmValue::set(const WsmInstance& inst)
+{
+    _release();
+    _type = WSMTYPE_INSTANCE;
+    _isArray = false;
+    _isNull = false;
+    _rep.inst = new WsmInstance(inst);
+}
+
+void WsmValue::set(const Array<WsmInstance>& inst)
+{
+    _release();
+    _type = WSMTYPE_INSTANCE;
+    _isArray = true;
+    _isNull = false;
+    _rep.insta = new Array<WsmInstance>(inst);
+}
+
+void WsmValue::set(const String& str)
+{
+    _release();
+    _type = WSMTYPE_OTHER;
+    _isArray = false;
+    _isNull = false;
+    _rep.str = new String(str);
+}
+
+void WsmValue::set(const Array<String>& str)
+{
+    _release();
+    _type = WSMTYPE_OTHER;
+    _isArray = true;
+    _isNull = false;
+    _rep.stra = new Array<String>(str);
+}
+
+void WsmValue::setNull()
+{
+    _release();
+    _type = WSMTYPE_OTHER;
+    _isArray = false;
+    _isNull = true;
+}
+
+void WsmValue::add(const WsmValue& val)
+{
+    PEGASUS_ASSERT(!val._isArray);
+
+    if (_type != val._type)
+        throw TypeMismatchException();
+
+    if (_isArray)
+    {
+        switch (_type)
+        {
+            case WSMTYPE_REFERENCE:
+            {
+                _rep.refa->append(*val._rep.ref);
+                break;
+            }
+            case WSMTYPE_INSTANCE:
+            {
+                _rep.insta->append(*val._rep.inst);
+                break;
+            }
+            case WSMTYPE_OTHER:
+            {
+                _rep.stra->append(*val._rep.str);
+                break;
+            }
+            default:
+            {
+                PEGASUS_ASSERT(0);
+                break;
+            }
+        }
+    }
+    else
+    {
+        switch (_type)
+        {
+            case WSMTYPE_REFERENCE:
+            {
+                Array<WsmEndpointReference> ref;
+                ref.append(*_rep.ref);
+                ref.append(*val._rep.ref);
+                set(ref);
+                break;
+            }
+            case WSMTYPE_INSTANCE:
+            {
+                Array<WsmInstance> inst;
+                inst.append(*_rep.inst);
+                inst.append(*val._rep.inst);
+                set(inst);
+                break;
+            }
+            case WSMTYPE_OTHER:
+            {
+                Array<String> str;
+                str.append(*_rep.str);
+                str.append(*val._rep.str);
+                set(str);
+                break;
+            }
+            default:
+            {
+                PEGASUS_ASSERT(0);
+                break;
+            }
+        }
+    }
+}
+
+
+void WsmValue::toArray()
+{
+    if (_isArray)
+        return;
+
+    switch (_type)
+    {
+        case WSMTYPE_REFERENCE:
+        {
+            Array<WsmEndpointReference> ref;
+            ref.append(*_rep.ref);
+            set(ref);
+            break;
+        }
+        case WSMTYPE_INSTANCE:
+        {
+            Array<WsmInstance> inst;
+            inst.append(*_rep.inst);
+            set(inst);
+            break;
+        }
+        case WSMTYPE_OTHER:
+        {
+            Array<String> str;
+            str.append(*_rep.str);
+            set(str);
+            break;
+        }
+        default:
+        {
+            PEGASUS_ASSERT(0);
+            break;
+        }
+    }
+}
+
+PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/WsmServer/WsmValue.h b/src/Pegasus/WsmServer/WsmValue.h
new file mode 100644 (file)
index 0000000..3b9d0f0
--- /dev/null
@@ -0,0 +1,119 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_WsmValue_h
+#define Pegasus_WsmValue_h
+
+#include <Pegasus/Common/String.h>
+#include <Pegasus/Common/ArrayInternal.h>
+#include <Pegasus/WsmServer/Linkage.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+class WsmEndpointReference;
+class WsmInstance;
+
+enum WsmType
+{
+    WSMTYPE_REFERENCE,
+    WSMTYPE_OBJECT,
+    WSMTYPE_INSTANCE,
+    WSMTYPE_OTHER
+};
+
+
+class PEGASUS_WSMSERVER_LINKAGE WsmValue
+{
+public:
+
+    WsmValue();
+    WsmValue(const WsmEndpointReference& ref);
+    WsmValue(const Array<WsmEndpointReference>& ref);
+    WsmValue(const WsmInstance& inst);
+    WsmValue(const Array<WsmInstance>& inst);
+    WsmValue(const String& str);
+    WsmValue(const Array<String>& str);
+    WsmValue(const WsmValue& val);
+
+    ~WsmValue()
+    {
+        _release();
+    }
+
+    WsmValue& operator=(const WsmValue& val);
+
+    Boolean isArray() const { return _isArray; }
+    Boolean isNull() const { return _isNull; }
+    void setNull();
+    WsmType getType() const { return _type; }
+    Uint32 getArraySize();
+
+    void toArray();
+    void add(const WsmValue& val);
+
+    void get(WsmEndpointReference& ref) const;
+    void get(Array<WsmEndpointReference>& ref) const;
+    void get(WsmInstance& inst) const;
+    void get(Array<WsmInstance>& inst) const;
+    void get(String& str) const;
+    void get(Array<String>& str) const;
+
+    void set(const WsmEndpointReference& ref);
+    void set(const Array<WsmEndpointReference>& ref);
+    void set(const WsmInstance& inst);
+    void set(const Array<WsmInstance>& inst);
+    void set(const String& str);
+    void set(const Array<String>& str);
+
+private:
+
+    void _release();
+
+    WsmType _type;
+    Boolean _isArray;
+    Boolean _isNull;
+
+    union WsmValueRep
+    {
+        WsmEndpointReference* ref;
+        Array<WsmEndpointReference>* refa;
+        WsmInstance* inst;
+        Array<WsmInstance>* insta;
+        Array<String>* stra;
+        String* str;
+    } _rep;
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_WsmValue_h */
diff --git a/src/Pegasus/WsmServer/WsmWriter.cpp b/src/Pegasus/WsmServer/WsmWriter.cpp
new file mode 100644 (file)
index 0000000..ff53b63
--- /dev/null
@@ -0,0 +1,583 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#include <cstdlib>
+#include <cstdio>
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/Constants.h>
+#include <Pegasus/Common/XmlWriter.h>
+#include <Pegasus/Common/Buffer.h>
+#include <Pegasus/Common/StrLit.h>
+#include <Pegasus/Common/StringConversion.h>
+#include "WsmConstants.h"
+#include "WsmUtils.h"
+#include "WsmWriter.h"
+#include "WsmSelectorSet.h"
+
+PEGASUS_NAMESPACE_BEGIN
+
+inline void _writeNewlineForReadability(Buffer& out)
+{
+    // Uncomment this statement for XML response readability.
+    //out << '\n';
+}
+
+//-----------------------------------------------------------------------------
+//
+// WsmWriter::formatHttpErrorRspMessage()
+//
+//-----------------------------------------------------------------------------
+
+Buffer WsmWriter::formatHttpErrorRspMessage(
+    const String& status,
+    const String& cimError,
+    const String& errorDetail)
+{
+    return XmlWriter::formatHttpErrorRspMessage(status, cimError, errorDetail);
+}
+
+Buffer WsmWriter::formatSoapFault(
+    const SoapNotUnderstoodFault& fault,
+    const String& messageId,
+    const String& relatesTo,
+    HttpMethod httpMethod,
+    Uint32& httpHeaderSize)
+{
+    Buffer out(WSM_MIN_MAXENVELOPESIZE_VALUE);
+    String action = String(WsmNamespaces::supportedNamespaces[
+        WsmNamespaces::WS_ADDRESSING].extendedName) + String("/fault");
+    ContentLanguageList msgLang = fault.getMessageLanguage();
+
+    _appendHTTPResponseHeader(out, action, httpMethod, msgLang, true);
+    httpHeaderSize = out.size();
+
+    _appendSoapEnvelopeStart(out);
+    _appendSoapHeaderStart(out);
+
+    // Append the 'NotUnderstood' tag
+    out << STRLIT("<");
+    out << WsmNamespaces::supportedNamespaces[
+        WsmNamespaces::SOAP_ENVELOPE].localName;
+    out << STRLIT(":NotUnderstood qname=\"ns:");
+    out << fault.getHeaderName();
+    out << STRLIT("\" xmlns:ns=\"");
+    out << fault.getNamespace();
+    out << STRLIT("\"/>");
+    _writeNewlineForReadability(out);
+
+    _appendSoapHeader(out, action, messageId, relatesTo);
+    _appendSoapHeaderEnd(out);
+    _appendSoapBodyStart(out);
+
+    appendStartTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Fault"));
+    appendStartTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Code"));
+    String codeValue = String(WsmNamespaces::supportedNamespaces[
+        WsmNamespaces::SOAP_ENVELOPE].localName) + String(":MustUnderstand");
+    appendTagValue(
+        out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Value"), codeValue);
+    appendEndTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Code"));
+
+    String msg = fault.getMessage();
+    if (msg.size() != 0)
+    {
+        String lang;
+        if (msgLang.size() == 0)
+            lang = "en-US";
+        else
+            lang = msgLang.getLanguageTag(0).toString();
+
+        appendStartTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Reason"));
+        appendTagValue(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Text"),
+            msg, "xml:lang", lang);
+        appendEndTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Reason"));
+    }
+
+    appendEndTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Fault"));
+    _appendSoapBodyEnd(out);
+    _appendSoapEnvelopeEnd(out);
+    return out;
+}
+
+Buffer WsmWriter::formatWsmFault(
+    const WsmFault& fault,
+    const String& messageId,
+    const String& relatesTo,
+    HttpMethod httpMethod,
+    Uint32& httpHeaderSize)
+{
+    Buffer out(WSM_MIN_MAXENVELOPESIZE_VALUE);
+    String action(fault.getAction());
+    ContentLanguageList reasonLang = fault.getReasonLanguage();
+
+    _appendHTTPResponseHeader(out, action, httpMethod, reasonLang, true);
+    httpHeaderSize = out.size();
+
+    _appendSoapEnvelopeStart(out);
+    _appendSoapHeaderStart(out);
+    _appendSoapHeader(out, action, messageId, relatesTo);
+    _appendSoapHeaderEnd(out);
+    _appendSoapBodyStart(out);
+
+    appendStartTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Fault"));
+    appendStartTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Code"));
+    appendTagValue(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Value"),
+        fault.getCode());
+    appendStartTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Subcode"));
+    appendTagValue(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Value"),
+        fault.getSubcode());
+    appendEndTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Subcode"));
+    appendEndTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Code"));
+
+    String reason = fault.getReason();
+    if (reason.size() != 0)
+    {
+        String lang;
+        if (reasonLang.size() == 0)
+            lang = "en-US";
+        else
+            lang = reasonLang.getLanguageTag(0).toString();
+
+        appendStartTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Reason"));
+        appendTagValue(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Text"),
+                       reason, "xml:lang", lang);
+        appendEndTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Reason"));
+    }
+
+    String detail = fault.getFaultDetail();
+    if (detail.size() != 0)
+    {
+        appendStartTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Detail"));
+        appendTagValue(
+            out, WsmNamespaces::WS_MAN, STRLIT("FaultDetail"), detail);
+        appendEndTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Detail"));
+    }
+
+    appendEndTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Fault"));
+    _appendSoapBodyEnd(out);
+    _appendSoapEnvelopeEnd(out);
+    return out;
+}
+
+Buffer WsmWriter::formatWsmRspMessage(
+    const String& action,
+    const String& messageId,
+    const String& relatesTo,
+    HttpMethod httpMethod,
+    const ContentLanguageList& contentLanguages,
+    const Buffer& body,
+    const Buffer& headers,
+    Uint32& httpHeaderSize)
+{
+    Buffer out(WSM_MIN_MAXENVELOPESIZE_VALUE);
+
+    _appendHTTPResponseHeader(
+        out, action, httpMethod, contentLanguages, false);
+    httpHeaderSize = out.size();
+
+    _appendSoapEnvelopeStart(out, contentLanguages);
+    _appendSoapHeaderStart(out);
+    _appendSoapHeader(out, action, messageId, relatesTo);
+    out << headers;
+    _appendSoapHeaderEnd(out);
+    _appendSoapBodyStart(out);
+    out << body;
+    _appendSoapBodyEnd(out);
+    _appendSoapEnvelopeEnd(out);
+
+    return out;
+}
+
+void WsmWriter::appendInstanceElement(
+    Buffer& out,
+    WsmInstance& instance)
+{
+    // Class opening element:
+    out << STRLIT("<class:") << instance.getClassName();
+    out << STRLIT(" xmlns:class=\"");
+    out << WsmNamespaces::supportedNamespaces[WsmNamespaces::WS_CIM_SCHEMA].
+        extendedName;
+    out << STRLIT("/") << instance.getClassName();
+    out << STRLIT("\">");
+    _writeNewlineForReadability(out);
+
+    // Properties:
+    for (Uint32 i = 0, n = instance.getPropertyCount(); i < n; i++)
+        appendPropertyElement(out, instance.getProperty(i));
+
+    // Class closing element:
+    out << STRLIT("</class:") << instance.getClassName() << STRLIT(">");
+    _writeNewlineForReadability(out);
+}
+
+void WsmWriter::appendPropertyElement(
+    Buffer& out,
+    WsmProperty& property)
+{
+    WsmValue val = property.getValue();
+    String propName = property.getName();
+
+    if (val.isNull())
+    {
+        out << STRLIT("<class:") << propName;
+        out << " " << WsmNamespaces::supportedNamespaces[
+            WsmNamespaces::XML_SCHEMA_INSTANCE].localName;
+        out << STRLIT(":nil=\"true\"/>");
+        return;
+    }
+
+    if (val.isArray())
+    {
+        switch (val.getType())
+        {
+            case WSMTYPE_REFERENCE:
+            {
+                Array<WsmEndpointReference> eprs;
+                val.get(eprs);
+                for (Uint32 i = 0, n = eprs.size(); i < n; i++)
+                {
+                    out << STRLIT("<class:") << propName << STRLIT(">");
+                    _writeNewlineForReadability(out);
+                    appendEPRElement(out, eprs[i]);
+                    out << STRLIT("</class:") << propName << STRLIT(">");
+                    _writeNewlineForReadability(out);
+                }
+                break;
+            }
+            case WSMTYPE_INSTANCE:
+            {
+                Array<WsmInstance> instances;
+                val.get(instances);
+                for (Uint32 i = 0, n = instances.size(); i < n; i++)
+                {
+                    out << STRLIT("<class:") << propName << STRLIT(">");
+                    _writeNewlineForReadability(out);
+                    appendInstanceElement(out, instances[i]);
+                    out << STRLIT("</class:") << propName << STRLIT(">");
+                    _writeNewlineForReadability(out);
+                }
+                break;
+            }
+            case WSMTYPE_OTHER:
+            {
+                Array<String> strs;
+                val.get(strs);
+                for (Uint32 i = 0, n = strs.size(); i < n; i++)
+                {
+                    out << STRLIT("<class:") << propName << STRLIT(">");
+                    _writeNewlineForReadability(out);
+                    appendStringElement(out, strs[i]);
+                    out << STRLIT("</class:") << propName << STRLIT(">");
+                    _writeNewlineForReadability(out);
+                }
+                break;
+            }
+            default:
+            {
+                PEGASUS_ASSERT(0);
+            }
+        }
+    }
+    else
+    {
+        switch (val.getType())
+        {
+            case WSMTYPE_REFERENCE:
+            {
+                WsmEndpointReference epr;
+                val.get(epr);
+                out << STRLIT("<class:") << propName << STRLIT(">");
+                _writeNewlineForReadability(out);
+                appendEPRElement(out, epr);
+                out << STRLIT("</class:") << propName << STRLIT(">");
+                _writeNewlineForReadability(out);
+                break;
+            }
+            case WSMTYPE_INSTANCE:
+            {
+                WsmInstance instance;
+                val.get(instance);
+                out << STRLIT("<class:") << propName << STRLIT(">");
+                _writeNewlineForReadability(out);
+                appendInstanceElement(out, instance);
+                out << STRLIT("</class:") << propName << STRLIT(">");
+                _writeNewlineForReadability(out);
+                break;
+            }
+            case WSMTYPE_OTHER:
+            {
+                String str;
+                val.get(str);
+                out << STRLIT("<class:") << propName << STRLIT(">");
+                _writeNewlineForReadability(out);
+                appendStringElement(out, str);
+                out << STRLIT("</class:") << propName << STRLIT(">");
+                _writeNewlineForReadability(out);
+                break;
+            }
+            default:
+            {
+                PEGASUS_ASSERT(0);
+            }
+        }
+    }
+}
+
+void WsmWriter::appendEPRElement(
+    Buffer& out,
+    const WsmEndpointReference& epr)
+{
+    appendTagValue(
+        out, WsmNamespaces::WS_ADDRESSING, STRLIT("Address"), epr.address);
+    appendStartTag(
+        out, WsmNamespaces::WS_ADDRESSING, STRLIT("ReferenceParameters"));
+    appendTagValue(
+        out, WsmNamespaces::WS_MAN, STRLIT("ResourceURI"), epr.resourceUri);
+
+    if (epr.selectorSet && epr.selectorSet->selectors.size() > 0)
+    {
+        appendStartTag(out, WsmNamespaces::WS_MAN, STRLIT("SelectorSet"));
+        for (Uint32 i = 0, n = epr.selectorSet->selectors.size(); i < n; i++)
+        {
+            WsmSelector selector = epr.selectorSet->selectors[i];
+            appendStartTag(out, WsmNamespaces::WS_MAN, STRLIT("Selector"),
+                "Name", selector.name);
+            if (selector.type == WsmSelector::EPR)
+            {
+                appendStartTag(out,
+                    WsmNamespaces::WS_ADDRESSING,
+                    STRLIT("EndpointReference"));
+                appendEPRElement(out, selector.epr);
+                appendEndTag(out,
+                    WsmNamespaces::WS_ADDRESSING,
+                    STRLIT("EndpointReference"));
+            }
+            else
+            {
+                out << selector.value;
+                _writeNewlineForReadability(out);
+            }
+            appendEndTag(out, WsmNamespaces::WS_MAN, STRLIT("Selector"));
+        }
+        appendEndTag(out, WsmNamespaces::WS_MAN, STRLIT("SelectorSet"));
+    }
+    appendEndTag(
+        out, WsmNamespaces::WS_ADDRESSING, STRLIT("ReferenceParameters"));
+}
+
+void WsmWriter::appendStringElement(
+    Buffer& out,
+    const String& str)
+{
+    out << str;
+    _writeNewlineForReadability(out);
+}
+
+void WsmWriter::appendStartTag(
+    Buffer& out,
+    WsmNamespaces::Type nsType,
+    const StrLit& tagName,
+    const char* attrName,
+    const String& attrValue)
+{
+    out << STRLIT("<");
+    out << WsmNamespaces::supportedNamespaces[nsType].localName;
+    out << STRLIT(":") << tagName;
+    if (attrName)
+    {
+        out << STRLIT(" ") << attrName << STRLIT("=");
+        out << STRLIT("\"") << attrValue << STRLIT("\"");
+    }
+    out << STRLIT(">");
+    _writeNewlineForReadability(out);
+}
+
+void WsmWriter::appendEndTag(
+    Buffer& out,
+    WsmNamespaces::Type nsType,
+    const StrLit& tagName)
+{
+    out << STRLIT("</");
+    out << WsmNamespaces::supportedNamespaces[nsType].localName;
+    out << STRLIT(":") << tagName << STRLIT(">");
+    _writeNewlineForReadability(out);
+}
+
+void WsmWriter::appendTagValue(
+    Buffer& out,
+    WsmNamespaces::Type nsType,
+    const StrLit& tagName,
+    const String& value,
+    const char* attrName,
+    const String& attrValue)
+{
+    appendStartTag(out, nsType, tagName, attrName, attrValue);
+    out << value;
+    _writeNewlineForReadability(out);
+    appendEndTag(out, nsType, tagName);
+}
+
+void WsmWriter::_appendHTTPResponseHeader(
+    Buffer& out,
+    const String& action,
+    HttpMethod httpMethod,
+    const ContentLanguageList& contentLanguages,
+    Boolean isFault,
+    Uint32 contentLength)
+{
+    if (isFault)
+    {
+        out << STRLIT("HTTP/1.1 " HTTP_STATUS_INTERNALSERVERERROR "\r\n");
+    }
+    else
+    {
+        out << STRLIT("HTTP/1.1 " HTTP_STATUS_OK "\r\n");
+    }
+
+    out << STRLIT("Content-Type: application/soap+xml;charset=UTF-8\r\n");
+    OUTPUT_CONTENTLENGTH(out, contentLength);
+
+    if (contentLanguages.size() > 0)
+    {
+        out << STRLIT("Content-Language: ") << contentLanguages
+            << STRLIT("\r\n");
+    }
+    if (httpMethod == HTTP_METHOD_M_POST)
+    {
+        char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
+
+        out << STRLIT("Ext:\r\n");
+        out << STRLIT("Cache-Control: no-cache\r\n");
+        out << STRLIT("Man: urn:schemas-xmlsoap-org:soap.v1; ns=") << nn
+            << STRLIT("\r\n");
+        out << nn << STRLIT("-SOAPAction: ") << action << STRLIT("\r\n");
+    }
+    else
+    {
+        out << STRLIT("SOAPAction: ");
+        out << action << STRLIT("\r\n");
+    }
+    out << STRLIT("\r\n");
+
+    out << STRLIT("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
+    _writeNewlineForReadability(out);
+}
+
+void WsmWriter::_appendSoapEnvelopeStart(
+    Buffer& out,
+    const ContentLanguageList& contentLanguages)
+{
+    out << STRLIT("<");
+    out << WsmNamespaces::supportedNamespaces[
+        WsmNamespaces::SOAP_ENVELOPE].localName;
+    out << STRLIT(":Envelope");
+
+    // DSP0226 R6.3-4: In any response, event, or singleton message, the
+    // service should include the xml:lang attribute in the s:Envelope (or
+    // other elements) to signal to the receiver that localized content
+    // appears in the body of the message. This attribute may be omitted
+    // if no descriptive content appears in the body. Including the
+    // xml:lang attribute is not an error, even if no descriptive content
+    // occurs.
+
+    if (contentLanguages.size() > 0)
+    {
+        out << STRLIT(" xml:lang=\"");
+        out << contentLanguages.getLanguageTag(0).toString() << STRLIT("\"");
+    }
+
+    for (Uint32 i = 0; i < WsmNamespaces::LAST; i++)
+    {
+        _writeNewlineForReadability(out);
+        out << STRLIT(" xmlns:");
+        out << WsmNamespaces::supportedNamespaces[i].localName;
+        out << STRLIT("=\"");
+        out << WsmNamespaces::supportedNamespaces[i].extendedName;
+        out << STRLIT("\"");
+    }
+    out << STRLIT(">");
+    _writeNewlineForReadability(out);
+}
+
+void WsmWriter::_appendSoapEnvelopeEnd(Buffer& out)
+{
+    appendEndTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Envelope"));
+}
+
+void WsmWriter::_appendSoapHeaderStart(Buffer& out)
+{
+    appendStartTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Header"));
+}
+
+void WsmWriter::_appendSoapHeaderEnd(Buffer& out)
+{
+    appendEndTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Header"));
+}
+
+void WsmWriter::_appendSoapBodyStart(Buffer& out)
+{
+    appendStartTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Body"));
+}
+
+void WsmWriter::_appendSoapBodyEnd(Buffer& out)
+{
+    appendEndTag(out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Body"));
+}
+
+void WsmWriter::_appendSoapHeader(
+    Buffer& out,
+    const String& action,
+    const String& messageId,
+    const String& relatesTo)
+{
+    // Add <wsa:To> entry
+    appendStartTag(out, WsmNamespaces::WS_ADDRESSING, STRLIT("To"));
+    // Note: The reply is always written on the requestor's connection.
+    // The WsmRequestDecoder checks that the wsa:ReplyTo header is anonymous.
+    out << STRLIT(WSM_ADDRESS_ANONYMOUS);
+    _writeNewlineForReadability(out);
+    appendEndTag(out, WsmNamespaces::WS_ADDRESSING, STRLIT("To"));
+
+    // Add <wsa:Action> entry
+    appendTagValue(out, WsmNamespaces::WS_ADDRESSING, STRLIT("Action"), action);
+
+    // Add <wsa:MessageID> entry
+    appendTagValue(
+        out, WsmNamespaces::WS_ADDRESSING, STRLIT("MessageID"), messageId);
+
+    // Add <wsa:RelatesTo> entry
+    appendTagValue(
+        out, WsmNamespaces::WS_ADDRESSING, STRLIT("RelatesTo"), relatesTo);
+}
+
+PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/WsmServer/WsmWriter.h b/src/Pegasus/WsmServer/WsmWriter.h
new file mode 100644 (file)
index 0000000..79beca8
--- /dev/null
@@ -0,0 +1,146 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_WsmWriter_h
+#define Pegasus_WsmWriter_h
+
+#include <iostream>
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/InternalException.h>
+#include <Pegasus/Common/ArrayInternal.h>
+#include <Pegasus/Common/String.h>
+#include <Pegasus/Common/ContentLanguageList.h>
+#include <Pegasus/Common/Message.h>
+#include <Pegasus/Common/Buffer.h>
+#include <Pegasus/Common/StrLit.h>
+#include <Pegasus/Common/XmlGenerator.h>
+#include <Pegasus/WsmServer/WsmUtils.h>
+#include <Pegasus/WsmServer/WsmInstance.h>
+#include <Pegasus/WsmServer/WsmProperty.h>
+#include <Pegasus/WsmServer/WsmValue.h>
+#include <Pegasus/WsmServer/WsmFault.h>
+#include <Pegasus/WsmServer/WsmEndpointReference.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+class PEGASUS_WSMSERVER_LINKAGE WsmWriter : public XmlGenerator
+{
+public:
+
+    static Buffer formatSoapFault(
+        const SoapNotUnderstoodFault& fault,
+        const String& messageId,
+        const String& relatesTo,
+        HttpMethod httpMethod,
+        Uint32& httpHeaderSize);
+
+    static Buffer formatWsmFault(
+        const WsmFault& fault,
+        const String& messageId,
+        const String& relatesTo,
+        HttpMethod httpMethod,
+        Uint32& httpHeaderSize);
+
+    static Buffer formatHttpErrorRspMessage(
+        const String& status,
+        const String& cimError = String::EMPTY,
+        const String& errorDetail = String::EMPTY);
+
+    static Buffer formatWsmRspMessage(
+        const String& action,
+        const String& messageId,
+        const String& relatesTo,
+        HttpMethod httpMethod,
+        const ContentLanguageList& contentLanguages,
+        const Buffer& body,
+        const Buffer& headers,
+        Uint32& httpHeaderSize);
+
+    static void appendInstanceElement(
+        Buffer& out, WsmInstance& instance);
+    static void appendPropertyElement(
+        Buffer& out, WsmProperty& property);
+    static void appendEPRElement(
+        Buffer& out, const WsmEndpointReference& epr);
+    static void appendStringElement(
+        Buffer& out, const String& str);
+
+    static void appendStartTag(
+        Buffer& out,
+        WsmNamespaces::Type nsType,
+        const StrLit& tagName,
+        const char* attrName = 0,
+        const String& attrValue = String::EMPTY);
+    static void appendEndTag(
+        Buffer& out,
+        WsmNamespaces::Type nsType,
+        const StrLit& tagName);
+    static void appendTagValue(
+        Buffer& out,
+        WsmNamespaces::Type nsType,
+        const StrLit& tagName,
+        const String& value,
+        const char* attrName = 0,
+        const String& attrValue = String::EMPTY);
+
+private:
+
+    WsmWriter();
+
+    static void _appendHTTPResponseHeader(
+        Buffer& out,
+        const String& action,
+        HttpMethod httpMethod,
+        const ContentLanguageList& contentLanguages,
+        Boolean isFault,
+        Uint32 contentLength = 0);
+
+    static void _appendSoapEnvelopeStart(
+        Buffer& out,
+        const ContentLanguageList& contentLanguages = ContentLanguageList());
+    static void _appendSoapEnvelopeEnd(Buffer& out);
+    static void _appendSoapHeaderStart(Buffer& out);
+    static void _appendSoapHeaderEnd(Buffer& out);
+    static void _appendSoapBodyStart(Buffer& out);
+    static void _appendSoapBodyEnd(Buffer& out);
+
+    static void _appendSoapHeader(
+        Buffer& out,
+        const String& action,
+        const String& messageId,
+        const String& relatesTo);
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_WsmWriter_h */
diff --git a/src/Pegasus/WsmServer/tests/CimToWsmMapper/CimToWsmMapper.cpp b/src/Pegasus/WsmServer/tests/CimToWsmMapper/CimToWsmMapper.cpp
new file mode 100644 (file)
index 0000000..4a49edf
--- /dev/null
@@ -0,0 +1,552 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/WsmServer/WsmConstants.h>
+#include <Pegasus/WsmServer/WsmUtils.h>
+#include <Pegasus/WsmServer/WsmReader.h>
+#include <Pegasus/WsmServer/WsmWriter.h>
+#include <Pegasus/WsmServer/WsmValue.h>
+#include <Pegasus/WsmServer/WsmEndpointReference.h>
+#include <Pegasus/WsmServer/WsmInstance.h>
+#include <Pegasus/WsmServer/WsmSelectorSet.h>
+#include <Pegasus/WsmServer/CimToWsmResponseMapper.h>
+
+PEGASUS_USING_PEGASUS;
+PEGASUS_USING_STD;
+
+static Boolean verbose;
+
+/* This template provides a set of tests of simple CIMValues (excluding
+   reference and embedded instance types). */
+template<class T>
+void testSimpleType(const T& x)
+{
+    CimToWsmResponseMapper mapper;
+
+    WsmValue wsmValue;
+    String wsmStr, cimStr;
+    CIMValue cimValue(x);
+    cimStr = cimValue.toString();
+    if (cimValue.getType() == CIMTYPE_BOOLEAN)
+    {
+        cimStr.toLower();
+    }
+    mapper.convertCimToWsmValue(cimValue, wsmValue);
+    wsmValue.get(wsmStr);
+    if (wsmValue.getType() != WSMTYPE_OTHER || wsmValue.isArray() || 
+        wsmValue.isNull() || wsmStr != cimStr)
+    {
+        throw Exception(String("Unvalid ") + 
+            String(cimTypeToString(cimValue.getType())) + 
+            String(" conversion"));
+    }
+}
+
+static void _testValues(void)
+{
+    // Test simple data types
+    testSimpleType((Sint8)-4);
+    testSimpleType((Sint16)-44);
+    testSimpleType((Sint32)-444);
+    testSimpleType((Sint64)-4444);
+    testSimpleType((Uint8)4);
+    testSimpleType((Uint16)44);
+    testSimpleType((Uint32)444);
+    testSimpleType((Uint64)4444);
+    testSimpleType(Boolean(true));
+    testSimpleType(Boolean(false));
+    testSimpleType(Char16('Z'));
+    testSimpleType(Real32(1.5));
+    testSimpleType(Real64(55.5));
+    testSimpleType(Uint64(123456789));
+    testSimpleType(Sint64(-123456789));
+    testSimpleType(String("Hello world"));
+    testSimpleType(CIMDateTime("19991224120000.000000+360"));
+
+    CimToWsmResponseMapper mapper;
+
+    // Test embedded instances
+    {
+        WsmInstance wsmInst;
+        WsmValue wsmValue;
+        CIMInstance cimInst(CIMName("MyClass"));
+        cimInst.
+            addProperty(CIMProperty(CIMName("message"), String("Goodbye")));
+        cimInst.addProperty(CIMProperty(CIMName("count"), Uint32(55)));
+        cimInst.addProperty(CIMProperty(CIMName("flag"), Boolean(true)));
+        CIMValue cimValue(cimInst);
+        mapper.convertCimToWsmValue(cimValue, wsmValue);
+        wsmValue.get(wsmInst);
+        if (wsmInst.getClassName() != "MyClass" ||
+            wsmInst.getPropertyCount() != 3)
+            throw Exception("Invalid instance conversion");
+        
+        String str1, str2, str3;
+        wsmInst.getProperty(0).getValue().get(str1);
+        wsmInst.getProperty(1).getValue().get(str2);
+        wsmInst.getProperty(2).getValue().get(str3);
+        if (wsmInst.getProperty(0).getName() != "message" ||
+            wsmInst.getProperty(1).getName() != "count" ||
+            wsmInst.getProperty(2).getName() != "flag" ||
+            str1 != "Goodbye" || str2 != "55" || str3 != "true")
+            throw Exception("Invalid instance conversion");
+    }
+
+    // Test embedded objects
+    {
+        WsmInstance wsmInst;
+        WsmValue wsmValue;
+        CIMInstance cimInst(CIMName("MyClass"));
+        cimInst.
+            addProperty(CIMProperty(CIMName("message"), String("Goodbye")));
+        cimInst.addProperty(CIMProperty(CIMName("count"), Uint32(55)));
+        cimInst.addProperty(CIMProperty(CIMName("flag"), Boolean(true)));
+        CIMObject cimObj(cimInst);
+        CIMValue cimValue(cimObj);
+        mapper.convertCimToWsmValue(cimValue, wsmValue);
+        wsmValue.get(wsmInst);
+        if (wsmInst.getClassName() != "MyClass" ||
+            wsmInst.getPropertyCount() != 3)
+            throw Exception("Invalid instance conversion");
+        
+        String str1, str2, str3;
+        wsmInst.getProperty(0).getValue().get(str1);
+        wsmInst.getProperty(1).getValue().get(str2);
+        wsmInst.getProperty(2).getValue().get(str3);
+        if (wsmInst.getProperty(0).getName() != "message" ||
+            wsmInst.getProperty(1).getName() != "count" ||
+            wsmInst.getProperty(2).getName() != "flag" ||
+            str1 != "Goodbye" || str2 != "55" || str3 != "true")
+            throw Exception("Invalid instance conversion");
+    }
+
+    // Tests references
+    {
+        WsmEndpointReference epr;
+        WsmValue wsmValue;
+        CIMObjectPath op("//atp:77/root/cimv25:TennisPlayer.last=\"Rafter\"");
+        CIMValue cimValue(op);
+        mapper.convertCimToWsmValue(cimValue, wsmValue);
+        wsmValue.get(epr);
+        if (epr.address != "http://atp:77/wsman" ||
+            epr.resourceUri != 
+            "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/TennisPlayer" ||
+            epr.selectorSet->selectors.size() != 2 ||
+            epr.selectorSet->selectors[0].name != "__cimnamespace" ||
+            epr.selectorSet->selectors[0].value != "root/cimv25" ||
+            epr.selectorSet->selectors[1].name != "last" ||
+            epr.selectorSet->selectors[1].value != "Rafter")
+            throw Exception("Invalid EPR conversion");
+    }
+}
+
+/* This template provides a set of tests of array CIMValues (excluding
+   reference and embedded instance types). */
+template<class T>
+void testArrayType(const Array<T>& x)
+{
+    CimToWsmResponseMapper mapper;
+
+    WsmValue wsmValue;
+    Array<String> arr;
+    CIMValue cimValue(x);
+    mapper.convertCimToWsmValue(cimValue, wsmValue);
+    wsmValue.get(arr);
+
+    if (wsmValue.getType() != WSMTYPE_OTHER || !wsmValue.isArray() || 
+        wsmValue.isNull() || x.size() != arr.size())
+        throw Exception(String("Unvalid ") + 
+            String(cimTypeToString(cimValue.getType())) + 
+            String(" conversion"));
+
+    for (Uint32 i = 0; i < x.size(); i++)
+    {
+        String cimStr;
+        CIMValue val(x[i]);
+        cimStr = val.toString();
+        if (val.getType() == CIMTYPE_BOOLEAN)
+        {
+            cimStr.toLower();
+        }
+        if (cimStr != arr[i])
+            throw Exception(String("Unvalid ") + 
+                String(cimTypeToString(cimValue.getType())) + 
+                String(" conversion"));
+    }
+}
+
+static void _testArrayValues(void)
+{
+    // Test arrays of simple types
+    Array<Sint8> s8_arr;
+    s8_arr.append(-11);
+    s8_arr.append(-22);
+    testArrayType(s8_arr);
+
+    Array<Sint16> s16_arr;
+    s16_arr.append(-111);
+    s16_arr.append(-222);
+    testArrayType(s16_arr);
+
+    Array<Sint32> s32_arr;
+    s32_arr.append(-1111);
+    s32_arr.append(-2222);
+    testArrayType(s32_arr);
+
+    Array<Sint64> s64_arr;
+    s64_arr.append(-11111);
+    s64_arr.append(-22222);
+    testArrayType(s64_arr);
+
+    Array<Uint8> u8_arr;
+    u8_arr.append(11);
+    u8_arr.append(22);
+    testArrayType(u8_arr);
+
+    Array<Uint16> u16_arr;
+    u16_arr.append(111);
+    u16_arr.append(222);
+    testArrayType(u16_arr);
+
+    Array<Uint32> u32_arr;
+    u32_arr.append(1111);
+    u32_arr.append(2222);
+    testArrayType(u32_arr);
+
+    Array<Uint64> u64_arr;
+    u64_arr.append(11111);
+    u64_arr.append(22222);
+    testArrayType(u64_arr);
+
+    Array<Boolean> b_arr;
+    b_arr.append(true);
+    b_arr.append(false);
+    testArrayType(b_arr);
+
+    Array<Real32> r32_arr;
+    r32_arr.append(Real32(1.5));
+    r32_arr.append(Real32(2.5));
+    testArrayType(r32_arr);
+
+    Array<Real64> r64_arr;
+    r64_arr.append(Real64(11.5));
+    r64_arr.append(Real64(12.5));
+    testArrayType(r64_arr);
+
+    Array<Char16> c16_arr;
+    c16_arr.append(Char16('Z'));
+    c16_arr.append(Char16('X'));
+    testArrayType(c16_arr);
+
+    Array<CIMDateTime> dt_arr;
+    dt_arr.append(CIMDateTime("19991224120000.000000+360"));
+    dt_arr.append(CIMDateTime("20001224120000.000000+360"));
+    testArrayType(dt_arr);
+
+    Array<String> str_arr;
+    str_arr.append("Test string 1");
+    str_arr.append("Test string 2");
+    testArrayType(str_arr);
+
+    CimToWsmResponseMapper mapper;
+
+    // Test arrays of instances
+    {
+        Array<WsmInstance> wsmInstArray;
+        Array<CIMInstance> cimInstArray;
+        WsmValue wsmValue;
+
+        CIMInstance cimInst1(CIMName("MyClass1"));
+        cimInst1.addProperty(CIMProperty(CIMName("prop1"), String("value1")));
+        cimInst1.addProperty(CIMProperty(CIMName("prop2"), String("value2")));
+        cimInstArray.append(cimInst1);
+        CIMInstance cimInst2(CIMName("MyClass2"));
+        cimInst2.addProperty(CIMProperty(CIMName("prop3"), String("value3")));
+        cimInst2.addProperty(CIMProperty(CIMName("prop4"), String("value4")));
+        cimInstArray.append(cimInst2);
+        CIMValue cimValue(cimInstArray);
+        mapper.convertCimToWsmValue(cimValue, wsmValue);
+        wsmValue.get(wsmInstArray);
+
+        if (wsmInstArray.size() != 2 ||
+            wsmInstArray[0].getClassName() != "MyClass1" ||
+            wsmInstArray[0].getPropertyCount() != 2 ||
+            wsmInstArray[1].getClassName() != "MyClass2" ||
+            wsmInstArray[1].getPropertyCount() != 2)
+            throw Exception("Invalid instance array conversion");
+
+        String str1, str2, str3, str4;
+        wsmInstArray[0].getProperty(0).getValue().get(str1);
+        wsmInstArray[0].getProperty(1).getValue().get(str2);
+        wsmInstArray[1].getProperty(0).getValue().get(str3);
+        wsmInstArray[1].getProperty(1).getValue().get(str4);
+
+        if (wsmInstArray[0].getProperty(0).getName() != "prop1" ||
+            wsmInstArray[0].getProperty(1).getName() != "prop2" ||
+            wsmInstArray[1].getProperty(0).getName() != "prop3" ||
+            wsmInstArray[1].getProperty(1).getName() != "prop4" ||
+            str1 != "value1" || str2 != "value2" || 
+            str3 != "value3" || str4 != "value4")
+            throw Exception("Invalid instance conversion");
+    }
+
+    // Test arrays of objects
+    {
+        Array<WsmInstance> wsmInstArray;
+        Array<CIMObject> cimObjArray;
+        WsmValue wsmValue;
+
+        CIMInstance cimInst1(CIMName("MyClass1"));
+        cimInst1.addProperty(CIMProperty(CIMName("prop1"), String("value1")));
+        cimInst1.addProperty(CIMProperty(CIMName("prop2"), String("value2")));
+        cimObjArray.append(CIMObject(cimInst1));
+        CIMInstance cimInst2(CIMName("MyClass2"));
+        cimInst2.addProperty(CIMProperty(CIMName("prop3"), String("value3")));
+        cimInst2.addProperty(CIMProperty(CIMName("prop4"), String("value4")));
+        cimObjArray.append(CIMObject(cimInst2));
+        CIMValue cimValue(cimObjArray);
+        mapper.convertCimToWsmValue(cimValue, wsmValue);
+        wsmValue.get(wsmInstArray);
+
+        if (wsmInstArray.size() != 2 ||
+            wsmInstArray[0].getClassName() != "MyClass1" ||
+            wsmInstArray[0].getPropertyCount() != 2 ||
+            wsmInstArray[1].getClassName() != "MyClass2" ||
+            wsmInstArray[1].getPropertyCount() != 2)
+            throw Exception("Invalid instance array conversion");
+
+        String str1, str2, str3, str4;
+        wsmInstArray[0].getProperty(0).getValue().get(str1);
+        wsmInstArray[0].getProperty(1).getValue().get(str2);
+        wsmInstArray[1].getProperty(0).getValue().get(str3);
+        wsmInstArray[1].getProperty(1).getValue().get(str4);
+
+        if (wsmInstArray[0].getProperty(0).getName() != "prop1" ||
+            wsmInstArray[0].getProperty(1).getName() != "prop2" ||
+            wsmInstArray[1].getProperty(0).getName() != "prop3" ||
+            wsmInstArray[1].getProperty(1).getName() != "prop4" ||
+            str1 != "value1" || str2 != "value2" || 
+            str3 != "value3" || str4 != "value4")
+            throw Exception("Invalid instance conversion");
+    }
+
+    // Test arrays of EPRs
+    {
+        Array<WsmEndpointReference> eprArray;
+        Array<CIMObjectPath> opArray;
+        WsmValue wsmValue;
+
+        CIMObjectPath op1("//atp:11/root/cimv1:Player.last=\"Marleau\"");
+        CIMObjectPath op2("//atp:22/root/cimv2:Player.last=\"Thornton\"");
+        opArray.append(op1);
+        opArray.append(op2);
+        CIMValue cimValue(opArray);
+        mapper.convertCimToWsmValue(cimValue, wsmValue);
+        wsmValue.get(eprArray);
+
+        if (eprArray[0].address != "http://atp:11/wsman" ||
+            eprArray[0].resourceUri != 
+                "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Player" ||
+            eprArray[0].selectorSet->selectors.size() != 2 ||
+            eprArray[0].selectorSet->selectors[0].name != "__cimnamespace" ||
+            eprArray[0].selectorSet->selectors[0].value != "root/cimv1" ||
+            eprArray[0].selectorSet->selectors[1].name != "last" ||
+            eprArray[0].selectorSet->selectors[1].value != "Marleau" ||
+            eprArray[1].address != "http://atp:22/wsman" ||
+            eprArray[1].resourceUri != 
+                "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Player" ||
+            eprArray[1].selectorSet->selectors.size() != 2 ||
+            eprArray[1].selectorSet->selectors[0].name != "__cimnamespace" ||
+            eprArray[1].selectorSet->selectors[0].value != "root/cimv2" ||
+            eprArray[1].selectorSet->selectors[1].name != "last" ||
+            eprArray[1].selectorSet->selectors[1].value != "Thornton")
+            throw Exception("Invalid EPR conversion");
+    }
+}
+
+static void _testExceptions(void)
+{
+    CimToWsmResponseMapper mapper;
+
+    CIMException e1(CIM_ERR_FAILED, "failed");
+    WsmFault f1 = mapper.mapCimExceptionToWsmFault(e1);
+    PEGASUS_TEST_ASSERT(f1.getCode() == "SOAP-ENV:Receiver");
+    PEGASUS_TEST_ASSERT(f1.getSubcode() == "wsman:InternalError");
+    PEGASUS_TEST_ASSERT(f1.getReason() == "CIM_ERR_FAILED: failed");
+
+    CIMException e2(CIM_ERR_CLASS_HAS_CHILDREN, "class has children");
+    WsmFault f2 = mapper.mapCimExceptionToWsmFault(e2);
+    PEGASUS_TEST_ASSERT(f2.getCode() == "SOAP-ENV:Receiver");
+    PEGASUS_TEST_ASSERT(f2.getSubcode() == "wsman:InternalError");
+    PEGASUS_TEST_ASSERT(f2.getReason() == 
+        "CIM_ERR_CLASS_HAS_CHILDREN: class has children");
+
+    CIMException e3(CIM_ERR_CLASS_HAS_INSTANCES, "class has instances");
+    WsmFault f3 = mapper.mapCimExceptionToWsmFault(e3);
+    PEGASUS_TEST_ASSERT(f3.getCode() == "SOAP-ENV:Receiver");
+    PEGASUS_TEST_ASSERT(f3.getSubcode() == "wsman:InternalError");
+    PEGASUS_TEST_ASSERT(f3.getReason() == 
+        "CIM_ERR_CLASS_HAS_INSTANCES: class has instances");
+
+    CIMException e4(CIM_ERR_INVALID_SUPERCLASS, "invalid superclass");
+    WsmFault f4 = mapper.mapCimExceptionToWsmFault(e4);
+    PEGASUS_TEST_ASSERT(f4.getCode() == "SOAP-ENV:Receiver");
+    PEGASUS_TEST_ASSERT(f4.getSubcode() == "wsman:InternalError");
+    PEGASUS_TEST_ASSERT(f4.getReason() == 
+        "CIM_ERR_INVALID_SUPERCLASS: invalid superclass");
+
+    CIMException e5(CIM_ERR_METHOD_NOT_FOUND, "method not found");
+    WsmFault f5 = mapper.mapCimExceptionToWsmFault(e5);
+    PEGASUS_TEST_ASSERT(f5.getCode() == "SOAP-ENV:Receiver");
+    PEGASUS_TEST_ASSERT(f5.getSubcode() == "wsman:InternalError");
+    PEGASUS_TEST_ASSERT(f5.getReason() == 
+        "CIM_ERR_METHOD_NOT_FOUND: method not found");
+
+    CIMException e6(CIM_ERR_METHOD_NOT_AVAILABLE, "method not available");
+    WsmFault f6 = mapper.mapCimExceptionToWsmFault(e6);
+    PEGASUS_TEST_ASSERT(f6.getCode() == "SOAP-ENV:Receiver");
+    PEGASUS_TEST_ASSERT(f6.getSubcode() == "wsman:InternalError");
+    PEGASUS_TEST_ASSERT(f6.getReason() == 
+        "CIM_ERR_METHOD_NOT_AVAILABLE: method not available");
+
+    CIMException e7(CIM_ERR_NO_SUCH_PROPERTY, "no such property");
+    WsmFault f7 = mapper.mapCimExceptionToWsmFault(e7);
+    PEGASUS_TEST_ASSERT(f7.getCode() == "SOAP-ENV:Receiver");
+    PEGASUS_TEST_ASSERT(f7.getSubcode() == "wsman:InternalError");
+    PEGASUS_TEST_ASSERT(f7.getReason() == 
+        "CIM_ERR_NO_SUCH_PROPERTY: no such property");
+
+    CIMException e8(CIM_ERR_TYPE_MISMATCH, "type mismatch");
+    WsmFault f8 = mapper.mapCimExceptionToWsmFault(e8);
+    PEGASUS_TEST_ASSERT(f8.getCode() == "SOAP-ENV:Receiver");
+    PEGASUS_TEST_ASSERT(f8.getSubcode() == "wsman:InternalError");
+    PEGASUS_TEST_ASSERT(f8.getReason() == 
+        "CIM_ERR_TYPE_MISMATCH: type mismatch");
+
+    CIMException e9(CIM_ERR_ACCESS_DENIED, "access denied");
+    WsmFault f9 = mapper.mapCimExceptionToWsmFault(e9);
+    PEGASUS_TEST_ASSERT(f9.getCode() == "SOAP-ENV:Sender");
+    PEGASUS_TEST_ASSERT(f9.getSubcode() == "wsman:AccessDenied");
+    PEGASUS_TEST_ASSERT(f9.getReason() == 
+        "CIM_ERR_ACCESS_DENIED: access denied");
+
+    CIMException e10(CIM_ERR_ALREADY_EXISTS, "already exists");
+    WsmFault f10 = mapper.mapCimExceptionToWsmFault(e10);
+    PEGASUS_TEST_ASSERT(f10.getCode() == "SOAP-ENV:Sender");
+    PEGASUS_TEST_ASSERT(f10.getSubcode() == "wsman:AlreadyExists");
+    PEGASUS_TEST_ASSERT(f10.getReason() == 
+        "CIM_ERR_ALREADY_EXISTS: already exists");
+
+    CIMException e11(CIM_ERR_INVALID_CLASS, "invalid class");
+    WsmFault f11 = mapper.mapCimExceptionToWsmFault(e11);
+    PEGASUS_TEST_ASSERT(f11.getCode() == "SOAP-ENV:Sender");
+    PEGASUS_TEST_ASSERT(f11.getSubcode() == "wsa:DestinationUnreachable");
+    PEGASUS_TEST_ASSERT(f11.getReason() == 
+        "CIM_ERR_INVALID_CLASS: invalid class");
+    PEGASUS_TEST_ASSERT(f11.getFaultDetail() == 
+        WSMAN_FAULTDETAIL_INVALIDRESOURCEURI);
+
+    CIMException e12(CIM_ERR_INVALID_NAMESPACE, "invalid namespace");
+    WsmFault f12 = mapper.mapCimExceptionToWsmFault(e12);
+    PEGASUS_TEST_ASSERT(f12.getCode() == "SOAP-ENV:Sender");
+    PEGASUS_TEST_ASSERT(f12.getSubcode() == "wsa:DestinationUnreachable");
+    PEGASUS_TEST_ASSERT(f12.getReason() == 
+        "CIM_ERR_INVALID_NAMESPACE: invalid namespace");
+
+    CIMException e13(CIM_ERR_INVALID_PARAMETER, "invalid parameter");
+    WsmFault f13 = mapper.mapCimExceptionToWsmFault(e13);
+    PEGASUS_TEST_ASSERT(f13.getCode() == "SOAP-ENV:Sender");
+    PEGASUS_TEST_ASSERT(f13.getSubcode() == "wsman:InvalidParameter");
+    PEGASUS_TEST_ASSERT(f13.getReason() == 
+        "CIM_ERR_INVALID_PARAMETER: invalid parameter");
+
+    CIMException e14(CIM_ERR_INVALID_QUERY, "invalid query");
+    WsmFault f14 = mapper.mapCimExceptionToWsmFault(e14);
+    PEGASUS_TEST_ASSERT(f14.getCode() == "SOAP-ENV:Sender");
+    PEGASUS_TEST_ASSERT(f14.getSubcode() == "wsen:CannotProcessFilter");
+    PEGASUS_TEST_ASSERT(f14.getReason() == 
+        "CIM_ERR_INVALID_QUERY: invalid query");
+
+    CIMException e15(CIM_ERR_NOT_FOUND, "not found");
+    WsmFault f15 = mapper.mapCimExceptionToWsmFault(e15);
+    PEGASUS_TEST_ASSERT(f15.getCode() == "SOAP-ENV:Sender");
+    PEGASUS_TEST_ASSERT(f15.getSubcode() == "wsa:DestinationUnreachable");
+    PEGASUS_TEST_ASSERT(f15.getReason() == "CIM_ERR_NOT_FOUND: not found");
+
+    CIMException e16(CIM_ERR_NOT_SUPPORTED, "not supported");
+    WsmFault f16 = mapper.mapCimExceptionToWsmFault(e16);
+    PEGASUS_TEST_ASSERT(f16.getCode() == "SOAP-ENV:Sender");
+    PEGASUS_TEST_ASSERT(f16.getSubcode() == "wsa:ActionNotSupported");
+    PEGASUS_TEST_ASSERT(f16.getReason() == 
+        "CIM_ERR_NOT_SUPPORTED: not supported");
+    PEGASUS_TEST_ASSERT(f16.getFaultDetail() == 
+        WSMAN_FAULTDETAIL_ACTIONMISMATCH);
+
+    CIMException e17(CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED, 
+        "query language not supported");
+    WsmFault f17 = mapper.mapCimExceptionToWsmFault(e17);
+    PEGASUS_TEST_ASSERT(f17.getCode() == "SOAP-ENV:Sender");
+    PEGASUS_TEST_ASSERT(f17.getSubcode() == "wsen:FilteringNotSupported");
+    PEGASUS_TEST_ASSERT(f17.getReason() == 
+        "CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED: query language not supported");
+}
+
+int main(int argc, char** argv)
+{
+    verbose = getenv("PEGASUS_TEST_VERBOSE") ? true : false;
+
+    try
+    {
+        if (verbose)
+            cout << "Testing simple values." << endl;
+        _testValues();
+
+        if (verbose)
+            cout << "Testing array values." << endl;
+        _testArrayValues();
+
+
+        if (verbose)
+            cout << "Testing exceptions." << endl;
+        _testExceptions();
+    }
+
+    catch(Exception& e)
+    {
+        cerr << "Error: " << e.getMessage() << endl;
+        exit(1);
+    }
+
+    cout << argv[0] << " +++++ passed all tests" << endl;
+
+    return 0;
+}
diff --git a/src/Pegasus/WsmServer/tests/CimToWsmMapper/Makefile b/src/Pegasus/WsmServer/tests/CimToWsmMapper/Makefile
new file mode 100644 (file)
index 0000000..58cc419
--- /dev/null
@@ -0,0 +1,47 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#// 
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//==============================================================================
+ROOT = ../../../../..
+DIR = Pegasus/WsmServer/tests/CimToWsmMapper
+include $(ROOT)/mak/config.mak
+include ../libraries.mak
+
+LOCAL_DEFINES = -DPEGASUS_INTERNALONLY
+
+PROGRAM = TestCimToWsmMapper
+
+SOURCES = CimToWsmMapper.cpp
+
+include $(ROOT)/mak/program.mak
+
+tests:
+       $(PROGRAM)
+
+poststarttests:
diff --git a/src/Pegasus/WsmServer/tests/Makefile b/src/Pegasus/WsmServer/tests/Makefile
new file mode 100644 (file)
index 0000000..06c3c0d
--- /dev/null
@@ -0,0 +1,40 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#// 
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//==============================================================================
+include $(PEGASUS_ROOT)/mak/config.mak
+
+DIRS = \
+    WsmValue \
+    WsmReader \
+    WsmWriter \
+    WsmToCimMapper \
+    CimToWsmMapper
+
+include $(PEGASUS_ROOT)/mak/recurse.mak
diff --git a/src/Pegasus/WsmServer/tests/WsmReader/Makefile b/src/Pegasus/WsmServer/tests/WsmReader/Makefile
new file mode 100644 (file)
index 0000000..245d691
--- /dev/null
@@ -0,0 +1,47 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#// 
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//==============================================================================
+ROOT = ../../../../..
+DIR = Pegasus/WsmServer/tests/WsmReader
+include $(ROOT)/mak/config.mak
+include ../libraries.mak
+
+LOCAL_DEFINES = -DPEGASUS_INTERNALONLY
+
+PROGRAM = TestWsmReader
+
+SOURCES = WsmReader.cpp
+
+include $(ROOT)/mak/program.mak
+
+tests:
+       $(PROGRAM)
+
+poststarttests:
diff --git a/src/Pegasus/WsmServer/tests/WsmReader/WsmReader.cpp b/src/Pegasus/WsmServer/tests/WsmReader/WsmReader.cpp
new file mode 100644 (file)
index 0000000..a7ade4b
--- /dev/null
@@ -0,0 +1,903 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//%/////////////////////////////////////////////////////////////////////////////
+
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/Common/FileSystem.h>
+#include <Pegasus/Common/String.h>
+
+#include <Pegasus/WsmServer/WsmConstants.h>
+#include <Pegasus/WsmServer/WsmReader.h>
+#include <Pegasus/WsmServer/WsmWriter.h>
+#include <Pegasus/WsmServer/WsmValue.h>
+#include <Pegasus/WsmServer/WsmEndpointReference.h>
+#include <Pegasus/WsmServer/WsmInstance.h>
+#include <Pegasus/WsmServer/WsmSelectorSet.h>
+
+PEGASUS_USING_PEGASUS;
+PEGASUS_USING_STD;
+
+static Boolean verbose;
+
+static void _testSelectors(WsmReader& reader)
+{
+    XmlEntry entry;
+    reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+
+    //
+    // This section tests acceptable input for selectors/EPRs
+    //
+    WsmSelector sel;
+
+    // Test regular value selector
+    if (!reader.getSelectorElement(sel))
+        throw Exception("Expected selector element.");
+
+    if (sel.type != WsmSelector::VALUE || sel.name != "first" || 
+        sel.value != "John")
+        throw Exception(
+            "Invalid selector element. Expected name=first, value=John");
+
+    // Test empty value selector
+    if (!reader.getSelectorElement(sel))
+        throw Exception("Expected selector element.");
+
+    if (sel.type != WsmSelector::VALUE || sel.name != "last" || 
+        sel.value != String::EMPTY)
+        throw Exception("Expected value selector: name=last, value=<empty>");
+
+    // Test EPR selector
+    if (!reader.getSelectorElement(sel))
+        throw Exception("Expected selector element.");
+
+    if (sel.type != WsmSelector::EPR || sel.name != "CityOfBirth" ||
+        sel.epr.address != "http://www.acme.com:5988/wsman" ||
+        sel.epr.resourceUri != "City" ||
+        sel.epr.selectorSet->selectors[0].name != "Name" ||
+        sel.epr.selectorSet->selectors[0].value != "San Jose" ||
+        sel.epr.selectorSet->selectors[1].name != "State" ||
+        sel.epr.selectorSet->selectors[1].value != "CA")
+        throw Exception("Expected EPR selector: name=CityOfBirth");
+
+    // Test recursive EPR selector
+    if (!reader.getSelectorElement(sel))
+        throw Exception("Expected selector element.");
+
+    // Now we need to veryfy this thing...
+    if (sel.type != WsmSelector::EPR || sel.name != "Recursive_0" ||
+        sel.epr.address != "http://www.acme_0.com:5988/wsman" ||
+        sel.epr.resourceUri != "ResourceURI_0")
+        throw Exception("Invalid recursive EPR at level 0.");
+
+    WsmSelector& sel_1 = sel.epr.selectorSet->selectors[0];
+    if (sel_1.type != WsmSelector::EPR || sel_1.name != "Recursive_1" ||
+        sel_1.epr.address != "http://www.acme_1.com:5988/wsman" ||
+        sel_1.epr.resourceUri != "ResourceURI_1")
+        throw Exception("Invalid recursive EPR at level 1.");
+
+    WsmSelector& sel_2 = sel_1.epr.selectorSet->selectors[0];
+    if (sel_2.type != WsmSelector::EPR || sel_2.name != "Recursive_2" ||
+        sel_2.epr.address != "http://www.acme_2.com:5988/wsman" ||
+        sel_2.epr.resourceUri != "ResourceURI_2" ||
+        sel_2.epr.selectorSet->selectors[0].name != "Name" ||
+        sel_2.epr.selectorSet->selectors[0].value != "San Jose" ||
+        sel_2.epr.selectorSet->selectors[1].name != "State" ||
+        sel_2.epr.selectorSet->selectors[1].value != "CA")
+        throw Exception("Invalid recursive EPR at level 2.");
+}
+
+static void _testSelectorErrors(WsmReader& reader)
+{
+    XmlEntry entry;
+    WsmSelector sel;
+
+    //
+    // This section tests exceptions in Selectors
+    //
+
+    // Test no Name attrubute in a selector
+    try {
+        if (reader.getSelectorElement(sel))
+            throw Exception("Expected no Name attrubute exception.");
+    }
+    catch (XmlException& e) {
+        reader.expectContentOrCData(entry);
+        reader.expectEndTag(WsmNamespaces::WS_MAN, "Selector");
+    }
+
+    // Test unexpected content in a selector
+    try {
+        if (reader.getSelectorElement(sel))
+            throw Exception("Expected bad content exception.");
+    }
+    catch (XmlException& e) {
+        reader.expectEndTag(WsmNamespaces::WS_MAN, "Selector");
+    }
+
+    // Test empty selector set
+    WsmSelectorSet selSet;
+    try {
+        if (reader.getSelectorSetElement(selSet))
+            throw Exception("Expected empty selector set exception.");
+    }
+    catch (XmlException& e) {
+    }
+    
+    // Test garbage in a selector set
+    try {
+        if (reader.getSelectorSetElement(selSet))
+            throw Exception("Expected garbage in selector set exception.");
+    }
+    catch (XmlException& e) {
+        reader.expectEndTag(WsmNamespaces::WS_MAN, "SelectorSet");
+    }
+    
+    // Test more garbage in a selector set
+    try {
+        if (reader.getSelectorSetElement(selSet))
+            throw Exception("Expected garbage in selector set exception.");
+    }
+    catch (XmlException& e) {
+        reader.expectEndTag(WsmNamespaces::WS_MAN, "SelectorSet");
+    }
+
+    //
+    // This section tests exceptions in EPRs
+    //
+
+    WsmEndpointReference epr;
+
+    // wsa:Address1 element is incorrect
+    try {
+        if (reader.getSelectorEPRElement(epr))
+            throw Exception("Expected garbage in selector EPR exception.");
+    }
+    catch (XmlException& e) {
+        while (reader.next(entry) && (entry.type != XmlEntry::END_TAG ||
+               entry.nsType != WsmNamespaces::WS_ADDRESSING ||
+               strcmp(entry.localName, "EndpointReference") != 0));
+    }
+
+    // missing wsa:ReferenceParameters element
+    try {
+        if (reader.getSelectorEPRElement(epr))
+            throw Exception("Expected garbage in selector EPR exception.");
+    }
+    catch (XmlException& e) {
+        while (reader.next(entry) && (entry.type != XmlEntry::END_TAG ||
+               entry.nsType != WsmNamespaces::WS_ADDRESSING ||
+               strcmp(entry.localName, "EndpointReference") != 0));
+    }
+
+    // ATTN WSMAN: It's unclear which elements of an EPR are optional. 
+    // The implementation hasn't been finalized yet...
+    // Add test points for exceptions in EPR XML.
+
+
+    reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+}
+
+static void _testProperties(WsmReader& reader)
+{
+    XmlEntry entry;
+    reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+
+    //
+    // This section tests valid simple (non-array) properties
+    //
+
+    {
+        WsmInstance inst;
+        reader.getInstanceElement(inst);
+        if (inst.getPropertyCount() != 7)
+            throw Exception("Expected 7 properties.");
+
+        {
+            WsmProperty& prop = inst.getProperty(0);
+            WsmValue& val = prop.getValue();
+            if (prop.getName() != "property_1" || 
+                val.getType() != WSMTYPE_OTHER)
+                throw Exception("Expected string property 1.");
+
+            String str;
+            val.get(str);
+            if (str != "Property value 1" || val.isNull() || val.isArray())
+                throw Exception("Invalid property 1.");
+        }
+
+        {
+            WsmProperty& prop = inst.getProperty(1);
+            WsmValue& val = prop.getValue();
+            if (prop.getName() != "property_2" || 
+                val.getType() != WSMTYPE_OTHER)
+                throw Exception("Expected string property 2.");
+            
+            String str;
+            val.get(str);
+            if (str != "222" || val.isNull() || val.isArray())
+                throw Exception("Invalid property 2.");
+        }
+        
+        {
+            WsmProperty& prop = inst.getProperty(2);
+            WsmValue& val = prop.getValue();
+            if (prop.getName() != "property_3" || 
+                !val.isNull() || val.isArray())
+                throw Exception("Expected NULL property 3.");
+        }
+        
+        {
+            WsmProperty& prop = inst.getProperty(3);
+            WsmValue& val = prop.getValue();
+            if (prop.getName() != "property_4" || 
+                !val.isNull() || val.isArray())
+                throw Exception("Expected NULL property 4.");
+        }
+
+        {
+            WsmProperty& prop = inst.getProperty(4);
+            WsmValue& val = prop.getValue();
+            if (prop.getName() != "property_5" || 
+                val.getType() != WSMTYPE_OTHER)
+                throw Exception("Expected string property 5.");
+            
+            String str;
+            val.get(str);
+            if (str != "" || val.isNull() || val.isArray())
+                throw Exception("Invalid property 5.");
+        }
+        
+        {
+            WsmProperty& prop = inst.getProperty(5);
+            WsmValue& val = prop.getValue();
+            if (prop.getName() != "property_6" || 
+                val.getType() != WSMTYPE_REFERENCE ||
+                val.isNull() || val.isArray())
+                throw Exception("Expected EPR property 6.");
+            
+            WsmEndpointReference epr;
+            val.get(epr);
+            if (epr.address != "http://www.acme.com:5988/wsman" ||
+                epr.resourceUri != "ResourceURI_6" ||
+                epr.selectorSet->selectors[0].name != "first" ||
+                epr.selectorSet->selectors[0].value != "John" ||
+                epr.selectorSet->selectors[1].name != "last" ||
+                epr.selectorSet->selectors[1].value != "Doe")
+                throw Exception("Invalid EPR value."); 
+        }
+        
+        {
+            WsmProperty& prop = inst.getProperty(6);
+            WsmValue& val = prop.getValue();
+            if (prop.getName() != "property_7" || 
+                val.getType() != WSMTYPE_INSTANCE ||
+                val.isNull() || val.isArray())
+                throw Exception("Expected instance property 7.");
+            
+            WsmInstance inst1;
+            val.get(inst1);
+            if (inst1.getClassName() != "Class1" || 
+                inst1.getPropertyCount() != 2)
+                throw Exception("Invalid instance value."); 
+
+            WsmProperty& prop1 = inst1.getProperty(0);
+            WsmProperty& prop2 = inst1.getProperty(1);
+            WsmValue& val1 = prop1.getValue();
+            WsmValue& val2 = prop2.getValue();
+            if (prop1.getName() != "prop_1" || 
+                val1.getType() != WSMTYPE_OTHER ||
+                prop2.getName() != "prop_2" || 
+                val2.getType() != WSMTYPE_OTHER ||
+                val1.isNull() || val1.isArray() || 
+                val2.isNull() || val2.isArray())
+                throw Exception("Invalid instance value."); 
+
+            String str1, str2;
+            val1.get(str1);
+            val2.get(str2);
+            if (str1 != "1111" || str2 != "Property value 2")
+                throw Exception("Invalid instance value."); 
+        }
+    }
+
+    //
+    // This section tests String array properties
+    //
+    {
+        WsmInstance inst;
+        reader.getInstanceElement(inst);
+        if (inst.getPropertyCount() != 1)
+            throw Exception("Expected 1 property.");
+
+        WsmProperty& prop = inst.getProperty(0);
+        WsmValue& val = prop.getValue();
+        if (prop.getName() != "property_1" || 
+            val.getType() != WSMTYPE_OTHER ||
+            val.isNull() || !val.isArray())
+            throw Exception("Expected string array property.");
+
+        Array<String> stra;
+        val.get(stra);
+        if (stra.size() != 4 || stra[0] != "100" ||
+            stra[1] != "101" || stra[2] != "102" || stra[3] != "103")
+            throw Exception("Invalid string array value.");
+            
+    }
+
+    //
+    // This section tests EPR array properties
+    //
+    {
+        WsmInstance inst;
+        reader.getInstanceElement(inst);
+        if (inst.getPropertyCount() != 1)
+            throw Exception("Expected 1 property.");
+
+        WsmProperty& prop = inst.getProperty(0);
+        WsmValue& val = prop.getValue();
+        if (prop.getName() != "property_1" || 
+            val.getType() != WSMTYPE_REFERENCE ||
+            val.isNull() || !val.isArray())
+            throw Exception("Expected EPR array property.");
+
+        Array<WsmEndpointReference> epra;
+        val.get(epra);
+        if (epra.size() != 3 ||
+            epra[0].address != "http://www.acme_1.com:5988/wsman" ||
+            epra[0].resourceUri != "ResourceURI_1" ||
+            epra[0].selectorSet->selectors[0].name != "first" ||
+            epra[0].selectorSet->selectors[0].value != "John" ||
+            epra[1].address != "http://www.acme_2.com:5988/wsman" ||
+            epra[1].resourceUri != "ResourceURI_2" ||
+            epra[1].selectorSet->selectors[0].name != "first" ||
+            epra[1].selectorSet->selectors[0].value != "Jack" ||
+            epra[2].address != "http://www.acme_3.com:5988/wsman" ||
+            epra[2].resourceUri != "ResourceURI_3" ||
+            epra[2].selectorSet->selectors[0].name != "first" ||
+            epra[2].selectorSet->selectors[0].value != "Fred")
+            throw Exception("Invalid EPR array value.");
+    }
+
+    //
+    // This section tests instance array properties
+    //
+    {
+        WsmInstance inst;
+        reader.getInstanceElement(inst);
+        if (inst.getPropertyCount() != 1)
+            throw Exception("Expected 1 property.");
+
+        WsmProperty& prop = inst.getProperty(0);
+        WsmValue& val = prop.getValue();
+        if (prop.getName() != "property_1" || 
+            val.getType() != WSMTYPE_INSTANCE ||
+            val.isNull() || !val.isArray())
+            throw Exception("Expected instance array property.");
+
+        Array<WsmInstance> insta;
+        val.get(insta);
+
+        if (insta.size() != 3 ||
+            insta[0].getPropertyCount() != 1 ||
+            insta[1].getPropertyCount() != 1 ||
+            insta[2].getPropertyCount() != 1)
+            throw Exception("Invalid instance array value.");
+
+        WsmProperty& prop1 = insta[0].getProperty(0);
+        WsmProperty& prop2 = insta[1].getProperty(0);
+        WsmProperty& prop3 = insta[2].getProperty(0);
+        WsmValue& val1 = prop1.getValue();
+        WsmValue& val2 = prop2.getValue();
+        WsmValue& val3 = prop3.getValue();
+
+        if (prop1.getName() != "prop_1" || val1.getType() != WSMTYPE_OTHER ||
+            val1.isNull() || val1.isArray() ||
+            prop2.getName() != "prop_1" || val2.getType() != WSMTYPE_OTHER ||
+            val2.isNull() || val2.isArray() ||
+            prop3.getName() != "prop_1" || val3.getType() != WSMTYPE_OTHER ||
+            val3.isNull() || val3.isArray())
+            throw Exception("Invalid instance array value.");
+        
+        String str1, str2, str3;
+        val1.get(str1);
+        val2.get(str2);
+        val3.get(str3);
+        if (str1 != "1111" || str2 != "2222" || str3 != "3333")
+            throw Exception("Invalid instance array value.");
+    }
+}
+
+static void _testPropertyErrors(WsmReader& reader)
+{
+    //
+    // This section tests errors in property XML
+    //
+
+    // Test garbage in property value
+    try {
+        WsmInstance inst;
+        reader.getInstanceElement(inst);
+        throw Exception("Expected garbage in property value exception.");
+    }
+    catch (XmlException& e) {
+        XmlEntry entry;
+        reader.next(entry);
+        reader.next(entry);
+    }
+
+    // Test null elements in an array property value
+    try {
+        WsmInstance inst;
+        reader.getInstanceElement(inst);
+        throw Exception("Expected null element in array value exception.");
+    }
+    catch (XmlException& e) {
+        XmlEntry entry;
+        reader.next(entry);
+        reader.next(entry);
+        reader.next(entry);
+        reader.next(entry);
+        reader.next(entry);
+        reader.next(entry);
+    }
+
+    try {
+        WsmInstance inst;
+        reader.getInstanceElement(inst);
+        throw Exception("Expected null element in array value exception.");
+    }
+    catch (XmlException& e) {
+        XmlEntry entry;
+        reader.next(entry);
+        reader.next(entry);
+        reader.next(entry);
+        reader.next(entry);
+    }
+
+    try {
+        WsmInstance inst;
+        reader.getInstanceElement(inst);
+        throw Exception("Expected null element in array value exception.");
+    }
+    catch (XmlException& e) {
+        XmlEntry entry;
+        reader.next(entry);
+    }
+
+    // Test empty property tag with no xsi:nil="true"
+    try {
+        WsmInstance inst;
+        reader.getInstanceElement(inst);
+        throw Exception(
+            "Expected empty property tag with no xsi:nil exception.");
+    }
+    catch (XmlException& e) {
+        XmlEntry entry;
+        reader.next(entry);
+    }
+
+    // Test error in EPR property
+    try {
+        WsmInstance inst;
+        reader.getInstanceElement(inst);
+        throw Exception(
+            "Expected error in EPR property value exception.");
+    }
+    catch (XmlException& e) {
+        XmlEntry entry;
+        while (reader.next(entry) && (entry.type != XmlEntry::END_TAG ||
+               strcmp(entry.localName, "Class") != 0));
+    }
+
+    // Test error in instance property
+    try {
+        WsmInstance inst;
+        reader.getInstanceElement(inst);
+        throw Exception(
+            "Expected error in instance property value exception.");
+    }
+    catch (XmlException& e) {
+        XmlEntry entry;
+        while (reader.next(entry) && (entry.type != XmlEntry::END_TAG ||
+               strcmp(entry.localName, "Class") != 0));
+    }
+
+    reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+}
+
+static void _testInstances(WsmReader& reader)
+{
+    XmlEntry entry;
+    reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+
+    // Test instance with multiple array properties of different types
+    {
+        WsmInstance inst;
+        reader.getInstanceElement(inst);
+        if (inst.getPropertyCount() != 3)
+            throw Exception("Expected 3 properties.");
+
+        {
+            WsmProperty& prop = inst.getProperty(0);
+            WsmValue& val = prop.getValue();
+            if (prop.getName() != "property_1" || 
+                val.getType() != WSMTYPE_OTHER ||
+                val.isNull() || !val.isArray())
+                throw Exception("Expected string array property.");
+
+            Array<String> stra;
+            val.get(stra);
+            if (stra.size() != 4 || stra[0] != "100" ||
+                stra[1] != "101" || stra[2] != "102" || stra[3] != "103")
+                throw Exception("Invalid string array value.");
+        }
+        {
+            WsmProperty& prop = inst.getProperty(1);
+            WsmValue& val = prop.getValue();
+            if (prop.getName() != "property_2" || 
+                val.getType() != WSMTYPE_REFERENCE ||
+                val.isNull() || !val.isArray())
+                throw Exception("Expected EPR array property.");
+
+            Array<WsmEndpointReference> epra;
+            val.get(epra);
+            if (epra.size() != 3 ||
+                epra[0].address != "http://www.acme_1.com:5988/wsman" ||
+                epra[0].resourceUri != "ResourceURI_1" ||
+                epra[0].selectorSet->selectors[0].name != "first" ||
+                epra[0].selectorSet->selectors[0].value != "John" ||
+                epra[1].address != "http://www.acme_2.com:5988/wsman" ||
+                epra[1].resourceUri != "ResourceURI_2" ||
+                epra[1].selectorSet->selectors[0].name != "first" ||
+                epra[1].selectorSet->selectors[0].value != "Jack" ||
+                epra[2].address != "http://www.acme_3.com:5988/wsman" ||
+                epra[2].resourceUri != "ResourceURI_3" ||
+                epra[2].selectorSet->selectors[0].name != "first" ||
+                epra[2].selectorSet->selectors[0].value != "Fred")
+                throw Exception("Invalid EPR array value.");
+        }
+        {
+            WsmProperty& prop = inst.getProperty(2);
+            WsmValue& val = prop.getValue();
+            if (prop.getName() != "property_3" || 
+                val.getType() != WSMTYPE_INSTANCE ||
+                val.isNull() || !val.isArray())
+                throw Exception("Expected instance array property.");
+            
+            Array<WsmInstance> insta;
+            val.get(insta);
+            
+            if (insta.size() != 3 ||
+                insta[0].getPropertyCount() != 1 ||
+                insta[1].getPropertyCount() != 1 ||
+                insta[2].getPropertyCount() != 1)
+                throw Exception("Invalid instance array value.");
+
+            WsmProperty& prop1 = insta[0].getProperty(0);
+            WsmProperty& prop2 = insta[1].getProperty(0);
+            WsmProperty& prop3 = insta[2].getProperty(0);
+            WsmValue& val1 = prop1.getValue();
+            WsmValue& val2 = prop2.getValue();
+            WsmValue& val3 = prop3.getValue();
+            
+            if (prop1.getName() != "prop_1" || 
+                val1.getType() != WSMTYPE_OTHER ||
+                val1.isNull() || val1.isArray() ||
+                prop2.getName() != "prop_1" || 
+                val2.getType() != WSMTYPE_OTHER ||
+                val2.isNull() || val2.isArray() ||
+                prop3.getName() != "prop_1" || 
+                val3.getType() != WSMTYPE_OTHER ||
+                val3.isNull() || val3.isArray())
+            throw Exception("Invalid instance array value.");
+            
+            String str1, str2, str3;
+            val1.get(str1);
+            val2.get(str2);
+            val3.get(str3);
+            if (str1 != "1111" || str2 != "2222" || str3 != "3333")
+                throw Exception("Invalid instance array value.");
+        }
+    }
+}
+
+static void _testInstanceErrors(WsmReader& reader)
+{
+    // Invalid class name: namespace schema prefix is wrong
+    try {
+        WsmInstance inst;
+        reader.getInstanceElement(inst);
+        throw Exception(
+            "Expected error in class name exception.");
+    }
+    catch (XmlException& e) {
+        XmlEntry entry;
+        while (reader.next(entry) && (entry.type != XmlEntry::END_TAG ||
+               strcmp(entry.localName, "Class") != 0));
+    }
+
+    // Invalid instance: not namespace  qualified
+    try {
+        WsmInstance inst;
+        reader.getInstanceElement(inst);
+        throw Exception(
+            "Expected error in class name exception.");
+    }
+    catch (XmlException& e) {
+        XmlEntry entry;
+        while (reader.next(entry) && (entry.type != XmlEntry::END_TAG ||
+               strcmp(entry.localName, "Class") != 0));
+    }
+
+    reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+}
+
+static void _testHeaders(WsmReader& reader)
+{
+    XmlEntry entry;
+    reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+
+    String wsaMessageId;
+    String wsaAction;
+    String wsaFrom;
+    String wsaReplyTo;
+    String wsaFaultTo;
+    WsmEndpointReference epr;
+    Uint32 wsmMaxEnvelopeSize = 0;
+    AcceptLanguageList wsmLocale;
+    Boolean wsmRequestEpr = false;
+    reader.decodeRequestSoapHeaders(
+        wsaMessageId, epr.address, wsaAction, wsaFrom, wsaReplyTo,
+        wsaFaultTo, epr.resourceUri, *epr.selectorSet, wsmMaxEnvelopeSize,
+        wsmLocale, wsmRequestEpr);
+
+    if (wsaMessageId != "1111")
+        throw Exception("Invalid message ID");
+
+    if (epr.address != "http://www.to_addr.com:5988/wsman" ||
+        epr.resourceUri != WSM_RESOURCEURI_CIMSCHEMAV2 ||
+        epr.selectorSet->selectors[0].type != WsmSelector::VALUE ||
+        epr.selectorSet->selectors[0].name != "Name" ||
+        epr.selectorSet->selectors[0].value != "San Jose")
+        throw Exception("Invalid EPR");
+
+    if (wsaAction !=  WSM_ACTION_GET)
+        throw Exception("Invalid action");
+
+    if (wsaFrom != "http://www.from_addr.com")
+        throw Exception("Invalid From header");
+
+    if (wsaReplyTo != "http://www.reply_to__addr.com")
+        throw Exception("Invalid ReplyTo header");
+
+    if (wsaFaultTo != "http://www.fault_to_addr.com")
+        throw Exception("Invalid FaultTo header");
+
+    if (wsmMaxEnvelopeSize != 12345)
+        throw Exception("Invalid MaxEnvelopeSize");
+
+    if (wsmRequestEpr != true)
+        throw Exception("Invalid RequestEpr");
+
+    if (wsmLocale.size() != 1 ||
+        wsmLocale.getLanguageTag(0).getLanguage() != "en" ||
+        wsmLocale.getLanguageTag(0).getCountry() != "us")
+        throw Exception("Invalid Locale");
+}
+
+static void _testHeaderErrors(WsmReader& reader)
+{
+    // Test duplicate headers
+    try {
+        String wsaMessageId, wsaAction, wsaFrom, wsaReplyTo, wsaFaultTo;
+        WsmEndpointReference epr;
+        Uint32 wsmMaxEnvelopeSize = 0;
+        AcceptLanguageList wsmLocale;
+        Boolean wsmRequestEpr = false;
+        reader.decodeRequestSoapHeaders(
+            wsaMessageId, epr.address, wsaAction, wsaFrom, wsaReplyTo,
+            wsaFaultTo, epr.resourceUri, *epr.selectorSet, wsmMaxEnvelopeSize,
+            wsmLocale, wsmRequestEpr);
+        throw Exception("Expected duplicate headers fault");
+    }
+    catch (WsmFault& fault) {
+        if (fault.getSubcode() != "wsa:InvalidMessageInformationHeader")
+            throw Exception("Invalid duplicate header fault");
+        XmlEntry entry;
+        while (reader.next(entry) && (entry.type != XmlEntry::END_TAG ||
+               strcmp(entry.localName, "Header") != 0));
+    }
+
+    // Test MustUnderstand
+    try {
+        String wsaMessageId, wsaAction, wsaFrom, wsaReplyTo, wsaFaultTo;
+        WsmEndpointReference epr;
+        Uint32 wsmMaxEnvelopeSize = 0;
+        AcceptLanguageList wsmLocale;
+        Boolean wsmRequestEpr = false;
+        reader.decodeRequestSoapHeaders(
+            wsaMessageId, epr.address, wsaAction, wsaFrom, wsaReplyTo,
+            wsaFaultTo, epr.resourceUri, *epr.selectorSet, wsmMaxEnvelopeSize,
+            wsmLocale, wsmRequestEpr);
+        throw Exception("Expected Soap NotUnderstood fault");
+    }
+    catch (SoapNotUnderstoodFault& fault) {
+        XmlEntry entry;
+        while (reader.next(entry) && (entry.type != XmlEntry::END_TAG ||
+               strcmp(entry.localName, "Header") != 0));
+    }
+
+    // Test OperationTimeout unsupported feature
+    try {
+        String wsaMessageId, wsaAction, wsaFrom, wsaReplyTo, wsaFaultTo;
+        WsmEndpointReference epr;
+        Uint32 wsmMaxEnvelopeSize = 0;
+        AcceptLanguageList wsmLocale;
+        Boolean wsmRequestEpr = false;
+        reader.decodeRequestSoapHeaders(
+            wsaMessageId, epr.address, wsaAction, wsaFrom, wsaReplyTo,
+            wsaFaultTo, epr.resourceUri, *epr.selectorSet, wsmMaxEnvelopeSize,
+            wsmLocale, wsmRequestEpr);
+        throw Exception("Expected OperationTimeout unsupported feature fault");
+    }
+    catch (WsmFault& fault) {
+        if (fault.getSubcode() != "wsman:UnsupportedFeature")
+            throw Exception("Invalid OperationTimeout unsupported fault");
+        XmlEntry entry;
+        while (reader.next(entry) && (entry.type != XmlEntry::END_TAG ||
+               strcmp(entry.localName, "Header") != 0));
+    }
+
+    // Test invalid MaxEnvelopeSize value
+    try {
+        String wsaMessageId, wsaAction, wsaFrom, wsaReplyTo, wsaFaultTo;
+        WsmEndpointReference epr;
+        Uint32 wsmMaxEnvelopeSize = 0;
+        AcceptLanguageList wsmLocale;
+        Boolean wsmRequestEpr = false;
+        reader.decodeRequestSoapHeaders(
+            wsaMessageId, epr.address, wsaAction, wsaFrom, wsaReplyTo,
+            wsaFaultTo, epr.resourceUri, *epr.selectorSet, wsmMaxEnvelopeSize,
+            wsmLocale, wsmRequestEpr);
+        throw Exception("Expected invalid MaxEnvelopeSize fault");
+    }
+    catch (WsmFault& fault) {
+        if (fault.getSubcode() != "wsa:InvalidMessageInformationHeader")
+            throw Exception("Invalid duplicate header fault");
+        XmlEntry entry;
+        while (reader.next(entry) && (entry.type != XmlEntry::END_TAG ||
+               strcmp(entry.localName, "Header") != 0));
+    }
+
+    // Test OptionSet mustUnderstand
+    try {
+        String wsaMessageId, wsaAction, wsaFrom, wsaReplyTo, wsaFaultTo;
+        WsmEndpointReference epr;
+        Uint32 wsmMaxEnvelopeSize = 0;
+        AcceptLanguageList wsmLocale;
+        Boolean wsmRequestEpr = false;
+        reader.decodeRequestSoapHeaders(
+            wsaMessageId, epr.address, wsaAction, wsaFrom, wsaReplyTo,
+            wsaFaultTo, epr.resourceUri, *epr.selectorSet, wsmMaxEnvelopeSize,
+            wsmLocale, wsmRequestEpr);
+        throw Exception("Expected Soap NotUnderstood fault");
+    }
+    catch (SoapNotUnderstoodFault& fault) {
+        XmlEntry entry;
+        while (reader.next(entry) && (entry.type != XmlEntry::END_TAG ||
+               strcmp(entry.localName, "Header") != 0));
+    }
+    // Test Locale mustUnderstand unsupported feature
+    try {
+        String wsaMessageId, wsaAction, wsaFrom, wsaReplyTo, wsaFaultTo;
+        WsmEndpointReference epr;
+        Uint32 wsmMaxEnvelopeSize = 0;
+        AcceptLanguageList wsmLocale;
+        Boolean wsmRequestEpr = false;
+        reader.decodeRequestSoapHeaders(
+            wsaMessageId, epr.address, wsaAction, wsaFrom, wsaReplyTo,
+            wsaFaultTo, epr.resourceUri, *epr.selectorSet, wsmMaxEnvelopeSize,
+            wsmLocale, wsmRequestEpr);
+        throw Exception("Expected Locale unsupported feature fault");
+    }
+    catch (WsmFault& fault) {
+        if (fault.getSubcode() != "wsman:UnsupportedFeature")
+            throw Exception("Invalid OperationTimeout unsupported fault");
+        XmlEntry entry;
+        while (reader.next(entry) && (entry.type != XmlEntry::END_TAG ||
+               strcmp(entry.localName, "Header") != 0));
+    }
+
+   reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+}
+
+int main(int argc, char** argv)
+{
+    verbose = getenv("PEGASUS_TEST_VERBOSE") ? true : false;
+
+    try
+    {
+        {
+            Buffer text;
+            FileSystem::loadFileToMemory(text, "./selectors.xml");
+            WsmReader reader((char*)text.getData());
+
+            if (verbose)
+                cout << "Testing selectors and EPRs." << endl;
+            _testSelectors(reader);
+            _testSelectorErrors(reader);
+        }
+        
+        {
+            Buffer text;
+            FileSystem::loadFileToMemory(text, "./properties.xml");
+            WsmReader reader((char*)text.getData());
+
+            if (verbose)
+                cout << "Testing instance properties." << endl;
+            _testProperties(reader);
+            _testPropertyErrors(reader);
+        }
+
+        {
+            Buffer text;
+            FileSystem::loadFileToMemory(text, "./instances.xml");
+            WsmReader reader((char*)text.getData());
+
+            if (verbose)
+                cout << "Testing instances." << endl;
+            _testInstances(reader);
+            _testInstanceErrors(reader);
+        }
+
+        {
+            Buffer text;
+            FileSystem::loadFileToMemory(text, "./headers.xml");
+            WsmReader reader((char*)text.getData());
+
+            if (verbose)
+                cout << "Testing instances." << endl;
+            _testHeaders(reader);
+            _testHeaderErrors(reader);
+        }
+    }
+
+    catch(Exception& e)
+    {
+        cerr << "Error: " << e.getMessage() << endl;
+        exit(1);
+    }
+
+    cout << argv[0] << " +++++ passed all tests" << endl;
+
+    return 0;
+}
diff --git a/src/Pegasus/WsmServer/tests/WsmReader/headers.xml b/src/Pegasus/WsmServer/tests/WsmReader/headers.xml
new file mode 100644 (file)
index 0000000..d1dfa68
--- /dev/null
@@ -0,0 +1,83 @@
+<!--Soap Envelope is needed to declare namespaces-->
+
+<SOAP-ENV:Envelope 
+  xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" 
+  xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+  xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" 
+  xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" 
+  xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
+  xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" 
+  xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" 
+  xmlns:tns="http://schemas.microsoft.com/wmx/2005/06" 
+  xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" 
+  xmlns:wsmid="http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd">
+
+<SOAP-ENV:Header>
+  <wsa:To>http://www.to_addr.com:5988/wsman</wsa:To>
+  <wsa:From>http://www.from_addr.com</wsa:From>
+
+  <wsa:ReplyTo>
+    <wsa:Address>http://www.reply_to__addr.com</wsa:Address>
+  </wsa:ReplyTo>
+
+  <wsa:FaultTo>
+    <wsa:Address>http://www.fault_to_addr.com</wsa:Address>
+  </wsa:FaultTo>
+
+  <wsa:Action>http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</wsa:Action>
+  <wsa:MessageID>1111</wsa:MessageID>
+
+  <wsman:ResourceURI>
+    http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2
+  </wsman:ResourceURI>
+
+  <wsman:SelectorSet>
+    <wsman:Selector Name="Name">San Jose</wsman:Selector>
+  </wsman:SelectorSet>
+
+  <wsman:Locale xml:lang="en-us"/>
+  <wsman:MaxEnvelopeSize>12345</wsman:MaxEnvelopeSize>
+  <wsman:RequestEPR/>
+
+  <wsman:OptionSet>a12345</wsman:OptionSet>
+</SOAP-ENV:Header>
+
+
+<!--Test error conditions here-->
+
+<!--Test duplicate headers-->
+<SOAP-ENV:Header>
+  <wsa:To>http://www.to_addr.com:5988/wsman</wsa:To>
+  <wsa:To>http://www.to_addr.com:5988/wsman</wsa:To>
+</SOAP-ENV:Header>
+
+<!--Test MustUnderstand-->
+<SOAP-ENV:Header>
+  <wsa:Blah SOAP-ENV:mustUnderstand="true">value</wsa:Blah>
+</SOAP-ENV:Header>
+
+<!--Test OperationTimeout unsupported feature-->
+<SOAP-ENV:Header>
+  <wsman:OperationTimeout SOAP-ENV:mustUnderstand="true">
+    1234
+  </wsman:OperationTimeout>
+</SOAP-ENV:Header>
+
+<!--Test invalid MaxEnvelopeSize value-->
+<SOAP-ENV:Header>
+  <wsman:MaxEnvelopeSize>a12345</wsman:MaxEnvelopeSize>
+</SOAP-ENV:Header>
+
+<!--Test OptionSet mustUnderstand-->
+<SOAP-ENV:Header>
+  <wsman:OptionSet SOAP-ENV:mustUnderstand="true">a12345</wsman:OptionSet>
+</SOAP-ENV:Header>
+
+<!--Test Locale mustUnderstand-->
+<SOAP-ENV:Header>
+  <wsman:Locale xml:lang="en-us" SOAP-ENV:mustUnderstand="true"/>
+</SOAP-ENV:Header>
+
+</SOAP-ENV:Envelope>
diff --git a/src/Pegasus/WsmServer/tests/WsmReader/instances.xml b/src/Pegasus/WsmServer/tests/WsmReader/instances.xml
new file mode 100644 (file)
index 0000000..70baf64
--- /dev/null
@@ -0,0 +1,90 @@
+<!--Soap Envelope is needed to declare namespaces-->
+
+<SOAP-ENV:Envelope 
+  xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" 
+  xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+  xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" 
+  xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" 
+  xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
+  xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" 
+  xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" 
+  xmlns:tns="http://schemas.microsoft.com/wmx/2005/06" 
+  xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" 
+  xmlns:wsmid="http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd">
+
+<!--Simple instances have already been tested by the property tester-->
+
+
+<!--Test instance with multiple array properties of different types-->
+<mc:Class xmlns:mc="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class">
+
+  <mc:property_1>100</mc:property_1>
+  <mc:property_1>101</mc:property_1>
+  <mc:property_1>102</mc:property_1>
+  <mc:property_1>103</mc:property_1>
+
+  <mc:property_2>
+      <wsa:Address>http://www.acme_1.com:5988/wsman</wsa:Address>
+      <wsa:ReferenceParameters>
+        <wsman:ResourceURI>ResourceURI_1</wsman:ResourceURI>
+        <wsman:SelectorSet>
+          <wsman:Selector Name="first">John</wsman:Selector>
+        </wsman:SelectorSet>
+      </wsa:ReferenceParameters>
+  </mc:property_2>
+  <mc:property_2>
+      <wsa:Address>http://www.acme_2.com:5988/wsman</wsa:Address>
+      <wsa:ReferenceParameters>
+        <wsman:ResourceURI>ResourceURI_2</wsman:ResourceURI>
+        <wsman:SelectorSet>
+          <wsman:Selector Name="first">Jack</wsman:Selector>
+        </wsman:SelectorSet>
+      </wsa:ReferenceParameters>
+  </mc:property_2>
+  <mc:property_2>
+      <wsa:Address>http://www.acme_3.com:5988/wsman</wsa:Address>
+      <wsa:ReferenceParameters>
+        <wsman:ResourceURI>ResourceURI_3</wsman:ResourceURI>
+        <wsman:SelectorSet>
+          <wsman:Selector Name="first">Fred</wsman:Selector>
+        </wsman:SelectorSet>
+      </wsa:ReferenceParameters>
+  </mc:property_2>
+
+  <mc:property_3>
+    <mc1:Class1 xmlns:mc1="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class1">
+      <mc:prop_1>1111</mc:prop_1>
+    </mc1:Class1>
+  </mc:property_3>
+  <mc:property_3>
+    <mc1:Class1 xmlns:mc1="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class1">
+      <mc:prop_1>2222</mc:prop_1>
+    </mc1:Class1>
+  </mc:property_3>
+  <mc:property_3>
+    <mc1:Class1 xmlns:mc1="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class1">
+      <mc:prop_1>3333</mc:prop_1>
+    </mc1:Class1>
+  </mc:property_3>
+
+</mc:Class>
+
+
+
+<!--Test instance specific errors-->
+
+<!--Invalid class name: namespace schema prefix is wrong-->
+<mc:Class xmlns:mc="http://schemas.dmtf.org/BAD/wscim/1/cim-schema/2/Class">
+  <mc:property_1>100</mc:property_1>
+</mc:Class>
+
+
+<!--Invalid instance: not namespace qualified-->
+<Class>
+  <property_1>100</property_1>
+</Class>
+
+
+</SOAP-ENV:Envelope>
diff --git a/src/Pegasus/WsmServer/tests/WsmReader/properties.xml b/src/Pegasus/WsmServer/tests/WsmReader/properties.xml
new file mode 100644 (file)
index 0000000..ba42198
--- /dev/null
@@ -0,0 +1,160 @@
+<!--Soap Envelope is needed to declare namespaces-->
+
+<SOAP-ENV:Envelope 
+  xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" 
+  xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+  xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" 
+  xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" 
+  xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
+  xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" 
+  xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" 
+  xmlns:tns="http://schemas.microsoft.com/wmx/2005/06" 
+  xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" 
+  xmlns:wsmid="http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd">
+
+<!--This section tests valid simple (non-array) properties-->
+<mc:Class xmlns:mc="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class">
+
+  <mc:property_1>Property value 1</mc:property_1>
+  <mc:property_2>222</mc:property_2>
+  <mc:property_3 xsi:nil="true"/>
+  <mc:property_4 xsi:nil="true"></mc:property_4>
+  <mc:property_5></mc:property_5>
+
+  <mc:property_6>
+      <wsa:Address>http://www.acme.com:5988/wsman</wsa:Address>
+      <wsa:ReferenceParameters>
+        <wsman:ResourceURI>ResourceURI_6</wsman:ResourceURI>
+        <wsman:SelectorSet>
+          <wsman:Selector Name="first">John</wsman:Selector>
+          <wsman:Selector Name="last">Doe</wsman:Selector>
+        </wsman:SelectorSet>
+      </wsa:ReferenceParameters>
+  </mc:property_6>
+
+  <mc:property_7>
+    <mc1:Class1 xmlns:mc1="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class1">
+      <mc:prop_1>1111</mc:prop_1>
+      <mc:prop_2>Property value 2</mc:prop_2>
+    </mc1:Class1>
+  </mc:property_7>
+
+</mc:Class>
+
+
+<!-- This section tests String array properties-->
+<mc:Class xmlns:mc="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class">
+  <mc:property_1>100</mc:property_1>
+  <mc:property_1>101</mc:property_1>
+  <mc:property_1>102</mc:property_1>
+  <mc:property_1>103</mc:property_1>
+</mc:Class>
+
+<!-- This section tests EPR array properties-->
+<mc:Class xmlns:mc="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class">
+  <mc:property_1>
+      <wsa:Address>http://www.acme_1.com:5988/wsman</wsa:Address>
+      <wsa:ReferenceParameters>
+        <wsman:ResourceURI>ResourceURI_1</wsman:ResourceURI>
+        <wsman:SelectorSet>
+          <wsman:Selector Name="first">John</wsman:Selector>
+        </wsman:SelectorSet>
+      </wsa:ReferenceParameters>
+  </mc:property_1>
+  <mc:property_1>
+      <wsa:Address>http://www.acme_2.com:5988/wsman</wsa:Address>
+      <wsa:ReferenceParameters>
+        <wsman:ResourceURI>ResourceURI_2</wsman:ResourceURI>
+        <wsman:SelectorSet>
+          <wsman:Selector Name="first">Jack</wsman:Selector>
+        </wsman:SelectorSet>
+      </wsa:ReferenceParameters>
+  </mc:property_1>
+  <mc:property_1>
+      <wsa:Address>http://www.acme_3.com:5988/wsman</wsa:Address>
+      <wsa:ReferenceParameters>
+        <wsman:ResourceURI>ResourceURI_3</wsman:ResourceURI>
+        <wsman:SelectorSet>
+          <wsman:Selector Name="first">Fred</wsman:Selector>
+        </wsman:SelectorSet>
+      </wsa:ReferenceParameters>
+  </mc:property_1>
+</mc:Class>
+
+<!-- This section tests instance array properties-->
+<mc:Class xmlns:mc="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class">
+  <mc:property_1>
+    <mc1:Class1 xmlns:mc1="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class1">
+      <mc:prop_1>1111</mc:prop_1>
+    </mc1:Class1>
+  </mc:property_1>
+  <mc:property_1>
+    <mc1:Class1 xmlns:mc1="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class1">
+      <mc:prop_1>2222</mc:prop_1>
+    </mc1:Class1>
+  </mc:property_1>
+  <mc:property_1>
+    <mc1:Class1 xmlns:mc1="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class1">
+      <mc:prop_1>3333</mc:prop_1>
+    </mc1:Class1>
+  </mc:property_1>
+</mc:Class>
+
+<!-- This section tests errors in property XML-->
+
+<!--Test garbage in property value-->
+<mc:Class xmlns:mc="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class">
+  <mc:property_1>
+    <garbage/>
+  </mc:property_1>
+</mc:Class>
+
+<!--Test null elements in an array property value-->
+<mc:Class xmlns:mc="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class">
+  <mc:property_3 xsi:nil="true"/>
+  <mc:property_3>1</mc:property_3>
+  <mc:property_3>2</mc:property_3>
+</mc:Class>
+
+<mc:Class xmlns:mc="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class">
+  <mc:property_3>1</mc:property_3>
+  <mc:property_3 xsi:nil="true"/>
+  <mc:property_3>2</mc:property_3>
+</mc:Class>
+
+<mc:Class xmlns:mc="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class">
+  <mc:property_3>1</mc:property_3>
+  <mc:property_3>2</mc:property_3>
+  <mc:property_3 xsi:nil="true"/>
+</mc:Class>
+
+<!--Test empty property tag with no xsi:nil="true"-->
+<mc:Class xmlns:mc="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class">
+  <mc:property_1>1</mc:property_1>
+  <mc:property_2/>
+</mc:Class>
+
+<!--Test error in EPR property-->
+<mc:Class xmlns:mc="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class">
+  <mc:property_1>
+      <wsa:Address>http://www.acme.com:5988/wsman</wsa:Address>
+      <wsa:ReferenceParameters>
+        <wsman:ResourceURI>ResourceURI_1</wsman:ResourceURI>
+        <wsman:SelectorSet>
+        </wsman:SelectorSet>
+      </wsa:ReferenceParameters>
+  </mc:property_1>
+</mc:Class>
+
+<!--Test error in instance property-->
+<mc:Class xmlns:mc="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class">
+  <mc:property_1>
+    <mc1:Class1 xmlns:mc1="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Class1">
+      <mc:prop_1/>
+    </mc1:Class1>
+  </mc:property_1>
+</mc:Class>
+
+</SOAP-ENV:Envelope>
diff --git a/src/Pegasus/WsmServer/tests/WsmReader/selectors.xml b/src/Pegasus/WsmServer/tests/WsmReader/selectors.xml
new file mode 100644 (file)
index 0000000..86f7594
--- /dev/null
@@ -0,0 +1,105 @@
+<!--Soap Envelope is needed to declare namespaces-->
+
+<SOAP-ENV:Envelope 
+  xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" 
+  xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+  xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" 
+  xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" 
+  xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
+  xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" 
+  xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" 
+  xmlns:tns="http://schemas.microsoft.com/wmx/2005/06" 
+  xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" 
+  xmlns:wsmid="http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd">
+
+<!--Test simple selector and empty selector-->
+<wsman:Selector Name="first">John</wsman:Selector>
+<wsman:Selector Name="last"/>
+
+<!--Test EPR selector selector-->
+<wsman:Selector Name="CityOfBirth">
+  <wsa:EndpointReference>
+    <wsa:Address>http://www.acme.com:5988/wsman</wsa:Address>
+    <wsa:ReferenceParameters>
+      <wsman:ResourceURI>City</wsman:ResourceURI>
+      <wsman:SelectorSet>
+        <wsman:Selector Name="Name">San Jose</wsman:Selector>
+        <wsman:Selector Name="State">CA</wsman:Selector>
+      </wsman:SelectorSet>
+    </wsa:ReferenceParameters>
+  </wsa:EndpointReference>
+</wsman:Selector>
+
+<!--Test recursive EPR selector selector-->
+<wsman:Selector Name="Recursive_0">
+  <wsa:EndpointReference>
+    <wsa:Address>http://www.acme_0.com:5988/wsman</wsa:Address>
+    <wsa:ReferenceParameters>
+      <wsman:ResourceURI>ResourceURI_0</wsman:ResourceURI>
+      <wsman:SelectorSet>
+
+        <wsman:Selector Name="Recursive_1">
+           <wsa:EndpointReference>
+             <wsa:Address>http://www.acme_1.com:5988/wsman</wsa:Address>
+             <wsa:ReferenceParameters>
+               <wsman:ResourceURI>ResourceURI_1</wsman:ResourceURI>
+               <wsman:SelectorSet>
+
+                 <wsman:Selector Name="Recursive_2">
+                   <wsa:EndpointReference>
+                     <wsa:Address>http://www.acme_2.com:5988/wsman</wsa:Address>
+                     <wsa:ReferenceParameters>
+                       <wsman:ResourceURI>ResourceURI_2</wsman:ResourceURI>
+                       <wsman:SelectorSet>
+                         <wsman:Selector Name="Name">San Jose</wsman:Selector>
+                         <wsman:Selector Name="State">CA</wsman:Selector>
+                       </wsman:SelectorSet>
+                     </wsa:ReferenceParameters>
+                   </wsa:EndpointReference>
+                 </wsman:Selector>
+
+               </wsman:SelectorSet>
+             </wsa:ReferenceParameters>
+           </wsa:EndpointReference>
+        </wsman:Selector>
+
+      </wsman:SelectorSet>
+    </wsa:ReferenceParameters>
+  </wsa:EndpointReference>
+</wsman:Selector>
+
+<!--Error: selector has no name-->
+<wsman:Selector>John</wsman:Selector>
+<!--Error: selector has garbage for its value-->
+<wsman:Selector Name="First"><blah/></wsman:Selector>
+
+<!--Error: empty selector set-->
+<wsman:SelectorSet></wsman:SelectorSet>
+
+<!--Error: garbage in selector set-->
+<wsman:SelectorSet>Garbage</wsman:SelectorSet>
+<wsman:SelectorSet><wsa:ReferenceParameters/></wsman:SelectorSet>
+
+<!--Error: wsa:Address1 element is incorrect-->
+<wsa:EndpointReference>
+  <wsa:Address1>http://www.acme.com:5988/wsman</wsa:Address1>
+  <wsa:ReferenceParameters>
+    <wsman:ResourceURI>City</wsman:ResourceURI>
+    <wsman:SelectorSet>
+      <wsman:Selector Name="Name">San Jose</wsman:Selector>
+    </wsman:SelectorSet>
+  </wsa:ReferenceParameters>
+</wsa:EndpointReference>
+
+<!--Error: missing wsa:ReferenceParameters element-->
+<wsa:EndpointReference>
+    <wsman:ResourceURI>City</wsman:ResourceURI>
+    <wsman:SelectorSet>
+      <wsman:Selector Name="Name">San Jose</wsman:Selector>
+    </wsman:SelectorSet>
+</wsa:EndpointReference>
+
+
+</SOAP-ENV:Envelope>
diff --git a/src/Pegasus/WsmServer/tests/WsmToCimMapper/Makefile b/src/Pegasus/WsmServer/tests/WsmToCimMapper/Makefile
new file mode 100644 (file)
index 0000000..0e5beca
--- /dev/null
@@ -0,0 +1,48 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#// 
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//==============================================================================
+ROOT = ../../../../..
+DIR = Pegasus/WsmServer/tests/WsmToCimMapper
+include $(ROOT)/mak/config.mak
+include ../libraries.mak
+
+LOCAL_DEFINES = -DPEGASUS_INTERNALONLY
+
+PROGRAM = TestWsmToCimMapper
+
+SOURCES = WsmToCimMapper.cpp
+
+include $(ROOT)/mak/program.mak
+
+tests:
+       @ $(RMREPOSITORY) "$(TMP_DIR)/repository"
+       $(PROGRAM)
+
+poststarttests:
diff --git a/src/Pegasus/WsmServer/tests/WsmToCimMapper/WsmToCimMapper.cpp b/src/Pegasus/WsmServer/tests/WsmToCimMapper/WsmToCimMapper.cpp
new file mode 100644 (file)
index 0000000..b06413c
--- /dev/null
@@ -0,0 +1,650 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/WsmServer/WsmConstants.h>
+#include <Pegasus/WsmServer/WsmUtils.h>
+#include <Pegasus/WsmServer/WsmReader.h>
+#include <Pegasus/WsmServer/WsmWriter.h>
+#include <Pegasus/WsmServer/WsmValue.h>
+#include <Pegasus/WsmServer/WsmEndpointReference.h>
+#include <Pegasus/WsmServer/WsmInstance.h>
+#include <Pegasus/WsmServer/WsmSelectorSet.h>
+#include <Pegasus/WsmServer/WsmToCimRequestMapper.h>
+
+PEGASUS_USING_PEGASUS;
+PEGASUS_USING_STD;
+
+static Boolean verbose;
+static String repositoryRoot;
+
+/* This template provides a set of tests of simple CIMValues
+   (excluding reference and embedded instance types). */
+template<class T>
+void testSimpleType(const T& x)
+{
+    WsmToCimRequestMapper mapper((CIMRepository*) 0);
+
+    // Create a NULL CIMValue of the appropriate type. Normally type
+    // info is retrieved from the repository.
+    CIMValue tmp(x);
+    CIMValue cimValue(tmp.getType(), tmp.isArray());
+    String str = tmp.toString();
+    if (tmp.getType() == CIMTYPE_BOOLEAN)
+    {
+        str.toLower();
+    }
+    WsmValue wsmValue(str);
+    mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue);
+    PEGASUS_TEST_ASSERT(tmp == cimValue);
+}
+
+
+/* This template provides a set of tests of array CIMValues (excluding
+   reference and embedded instance types). */
+template<class T>
+void testArrayType(const Array<T>& x)
+{
+    WsmToCimRequestMapper mapper((CIMRepository*) 0);
+
+    // Create a NULL CIMValue of the appropriate type. Normally type
+    // info is retrieved from the repository.
+    CIMValue tmp(x);
+    CIMValue cimValue(tmp.getType(), tmp.isArray());
+
+    // Create WsmValue out of the given array
+    Array<String> arr;
+    for (Uint32 i = 0; i < x.size(); i++)
+    {
+        String str = CIMValue(x[i]).toString();
+        if (tmp.getType() == CIMTYPE_BOOLEAN)
+        {
+            str.toLower();
+        }
+        arr.append(str);
+    }
+
+    WsmValue wsmValue(arr);
+    mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue);
+    PEGASUS_TEST_ASSERT(tmp == cimValue);
+}
+
+static void _testValues(void)
+{
+    // Test simple data types
+    testSimpleType(Boolean(true));
+    testSimpleType(Boolean(false));
+    testSimpleType((Sint8)-4);
+    testSimpleType((Sint16)-44);
+    testSimpleType((Sint32)-444);
+    testSimpleType((Sint64)-4444);
+    testSimpleType((Uint8)4);
+    testSimpleType((Uint16)44);
+    testSimpleType((Uint32)444);
+    testSimpleType((Uint64)4444);
+    testSimpleType(Char16('Z'));
+    testSimpleType(Real32(1.5));
+    testSimpleType(Real64(55.5));
+    testSimpleType(Uint64(123456789));
+    testSimpleType(Sint64(-123456789));
+    testSimpleType(String("Hello world"));
+    testSimpleType(CIMDateTime("19991224120000.000000+360"));
+
+    // Test arrays of simple types
+    Array<Sint8> s8_arr;
+    s8_arr.append(-11);
+    s8_arr.append(-22);
+    testArrayType(s8_arr);
+    
+    Array<Sint16> s16_arr;
+    s16_arr.append(-111);
+    s16_arr.append(-222);
+    testArrayType(s16_arr);
+
+    Array<Sint32> s32_arr;
+    s32_arr.append(-1111);
+    s32_arr.append(-2222);
+    testArrayType(s32_arr);
+
+    Array<Sint64> s64_arr;
+    s64_arr.append(-11111);
+    s64_arr.append(-22222);
+    testArrayType(s64_arr);
+
+    Array<Uint8> u8_arr;
+    u8_arr.append(11);
+    u8_arr.append(22);
+    testArrayType(u8_arr);
+
+    Array<Uint16> u16_arr;
+    u16_arr.append(111);
+    u16_arr.append(222);
+    testArrayType(u16_arr);
+
+    Array<Uint32> u32_arr;
+    u32_arr.append(1111);
+    u32_arr.append(2222);
+    testArrayType(u32_arr);
+
+    Array<Uint64> u64_arr;
+    u64_arr.append(11111);
+    u64_arr.append(22222);
+    testArrayType(u64_arr);
+
+    Array<Boolean> b_arr;
+    b_arr.append(true);
+    b_arr.append(false);
+    testArrayType(b_arr);
+
+    Array<Real32> r32_arr;
+    r32_arr.append(Real32(1.5));
+    r32_arr.append(Real32(2.5));
+    testArrayType(r32_arr);
+
+    Array<Real64> r64_arr;
+    r64_arr.append(Real64(11.5));
+    r64_arr.append(Real64(12.5));
+    testArrayType(r64_arr);
+
+    Array<Char16> c16_arr;
+    c16_arr.append(Char16('Z'));
+    c16_arr.append(Char16('X'));
+    testArrayType(c16_arr);
+
+    Array<CIMDateTime> dt_arr;
+    dt_arr.append(CIMDateTime("19991224120000.000000+360"));
+    dt_arr.append(CIMDateTime("20001224120000.000000+360"));
+    testArrayType(dt_arr);
+
+    Array<String> str_arr;
+    str_arr.append("Test string 1");
+    str_arr.append("Test string 2");
+    testArrayType(str_arr);
+
+    // Test class URI to class name conversion
+    WsmToCimRequestMapper mapper((CIMRepository*) 0);
+    String classURI = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/MyClass";
+    CIMName cimName = mapper.convertResourceUriToClassName(classURI);
+    PEGASUS_TEST_ASSERT(cimName.getString() == "MyClass");
+}
+
+#define ASSERT_FAULT(statement, subcode)        \
+    do                                          \
+    {                                           \
+        try                                     \
+        {                                       \
+            statement;                          \
+            PEGASUS_TEST_ASSERT(0);             \
+        }                                       \
+        catch (WsmFault& fault)                 \
+        {                                       \
+            PEGASUS_TEST_ASSERT(                \
+                fault.getSubcode() == subcode); \
+        }                                       \
+    } while (0)
+
+static void _testConversionErrors(void)
+{
+    WsmToCimRequestMapper mapper((CIMRepository*) 0);
+
+    // Invalid boolean
+    {
+        CIMValue cimValue(CIMTYPE_BOOLEAN, false);
+        WsmValue wsmValue("test");
+        ASSERT_FAULT(
+            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
+            "wxf:InvalidRepresentation");
+    }
+
+    // Invalid uint/sint
+    {
+        CIMValue cimValue(CIMTYPE_UINT8, false);
+        WsmValue wsmValue("test");
+        ASSERT_FAULT(
+            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
+            "wxf:InvalidRepresentation");
+    }
+
+    {
+        CIMValue cimValue(CIMTYPE_SINT8, false);
+        WsmValue wsmValue("test");
+        ASSERT_FAULT(
+            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
+            "wxf:InvalidRepresentation");
+    }
+
+    // Uint/sint out of bounds errors
+    {
+        CIMValue cimValue(CIMTYPE_SINT8, false);
+        WsmValue wsmValue("-222");
+        ASSERT_FAULT(
+            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
+            "wxf:InvalidRepresentation");
+    }
+
+    {
+        CIMValue cimValue(CIMTYPE_SINT16, false);
+        WsmValue wsmValue("-777777");
+        ASSERT_FAULT(
+            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
+            "wxf:InvalidRepresentation");
+    }
+
+    {
+        CIMValue cimValue(CIMTYPE_SINT32, false);
+        WsmValue wsmValue("-4444444444");
+        ASSERT_FAULT(
+            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
+            "wxf:InvalidRepresentation");
+    }
+
+    {
+        CIMValue cimValue(CIMTYPE_UINT8, false);
+        WsmValue wsmValue("333");
+        ASSERT_FAULT(
+            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
+            "wxf:InvalidRepresentation");
+    }
+
+    {
+        CIMValue cimValue(CIMTYPE_UINT16, false);
+        WsmValue wsmValue("777777");
+        ASSERT_FAULT(
+            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
+            "wxf:InvalidRepresentation");
+    }
+
+    {
+        CIMValue cimValue(CIMTYPE_UINT32, false);
+        WsmValue wsmValue("4444444444");
+        ASSERT_FAULT(
+            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
+            "wxf:InvalidRepresentation");
+    }
+
+    // Invalid real values
+    {
+        CIMValue cimValue(CIMTYPE_REAL32, false);
+        WsmValue wsmValue("35.54.32");
+        ASSERT_FAULT(
+            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
+            "wxf:InvalidRepresentation");
+    }
+
+    {
+        CIMValue cimValue(CIMTYPE_REAL64, false);
+        WsmValue wsmValue("35.54.32");
+        ASSERT_FAULT(
+            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
+            "wxf:InvalidRepresentation");
+    }
+
+    // Invalid char16
+    {
+        CIMValue cimValue(CIMTYPE_CHAR16, false);
+        WsmValue wsmValue("35.54.32");
+        ASSERT_FAULT(
+            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
+            "wxf:InvalidRepresentation");
+    }
+
+    // Invalid date/time
+    {
+        CIMValue cimValue(CIMTYPE_DATETIME, false);
+        WsmValue wsmValue("35.54.32");
+        ASSERT_FAULT(
+            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
+            "wxf:InvalidRepresentation");
+    }
+
+    // Invalid class URI
+    {
+        ASSERT_FAULT(
+            CIMName cimName = mapper.convertResourceUriToClassName("garbage"),
+            "wsa:DestinationUnreachable");
+    }
+
+    {
+        String classURI = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/My{}Class";
+        ASSERT_FAULT(
+            CIMName cimName = mapper.convertResourceUriToClassName(classURI),
+            "wsa:DestinationUnreachable");
+    }
+}
+
+static void _testInstances(void)
+{
+    const String NAMESPACE = "aa/bb";
+    const String CLASSNAME = "MyClass";
+
+    CIMRepository r(repositoryRoot, CIMRepository::MODE_XML);
+    WsmToCimRequestMapper mapper(&r);
+
+    // Create a repository entry
+    r.createNameSpace(NAMESPACE);
+    CIMClass cimClass(CLASSNAME);
+    cimClass.addProperty(CIMProperty(CIMName("prop1"), String::EMPTY));
+    cimClass.addProperty(CIMProperty(CIMName("prop2"), String::EMPTY));
+    r.createClass(NAMESPACE, cimClass);
+
+    CIMInstance cimInst;
+    WsmInstance wsmInst(CLASSNAME);
+    WsmValue val1("value1");
+    WsmValue val2("value2");
+
+    // Test mapping of instances
+    wsmInst.addProperty(WsmProperty(String("prop1"), val1));
+    wsmInst.addProperty(WsmProperty(String("prop2"), val2));
+    mapper.convertWsmToCimInstance(wsmInst, NAMESPACE, cimInst);
+
+    String str1, str2;
+    PEGASUS_TEST_ASSERT(cimInst.getClassName().getString() == CLASSNAME);
+    PEGASUS_TEST_ASSERT(
+        cimInst.getProperty(0).getName().getString() == "prop1");
+    PEGASUS_TEST_ASSERT(cimInst.getProperty(0).getType() == CIMTYPE_STRING);
+    cimInst.getProperty(0).getValue().get(str1);
+    PEGASUS_TEST_ASSERT(str1 == "value1");
+    PEGASUS_TEST_ASSERT(
+        cimInst.getProperty(1).getName().getString() == "prop2");
+    PEGASUS_TEST_ASSERT(cimInst.getProperty(1).getType() == CIMTYPE_STRING);
+    cimInst.getProperty(1).getValue().get(str2);
+    PEGASUS_TEST_ASSERT(str2 == "value2");
+
+    // Test mapping of instance values
+    WsmValue wsmInstValue(wsmInst);
+    CIMValue cimInstValue(CIMTYPE_INSTANCE, false);
+    mapper.convertWsmToCimValue(wsmInstValue, NAMESPACE, cimInstValue);
+    CIMInstance cimInst1;
+    cimInstValue.get(cimInst1);
+    PEGASUS_TEST_ASSERT(cimInst1.getClassName().getString() == CLASSNAME);
+    PEGASUS_TEST_ASSERT(
+        cimInst1.getProperty(0).getName().getString() == "prop1");
+    PEGASUS_TEST_ASSERT(cimInst1.getProperty(0).getType() == CIMTYPE_STRING);
+    cimInst1.getProperty(0).getValue().get(str1);
+    PEGASUS_TEST_ASSERT(str1 == "value1");
+    PEGASUS_TEST_ASSERT(
+        cimInst1.getProperty(1).getName().getString() == "prop2");
+    PEGASUS_TEST_ASSERT(cimInst1.getProperty(1).getType() == CIMTYPE_STRING);
+    cimInst1.getProperty(1).getValue().get(str2);
+    PEGASUS_TEST_ASSERT(str2 == "value2");
+
+    // Test mapping of instance array values
+    WsmInstance wsmInst1(CLASSNAME);
+    WsmValue val3("value3");
+    WsmValue val4("value4");
+    wsmInst1.addProperty(WsmProperty(String("prop1"), val3));
+    wsmInst1.addProperty(WsmProperty(String("prop2"), val4));
+    Array<WsmInstance> wsmInstArray;
+    wsmInstArray.append(wsmInst);
+    wsmInstArray.append(wsmInst1);
+    WsmValue wsmInstArrayValue(wsmInstArray);
+    CIMValue cimInstArrayValue(CIMTYPE_INSTANCE, true);
+    mapper.convertWsmToCimValue(
+        wsmInstArrayValue, NAMESPACE, cimInstArrayValue);
+    Array<CIMInstance> cimInstArray;
+    cimInstArrayValue.get(cimInstArray);
+    PEGASUS_TEST_ASSERT(cimInstArray.size() == 2);
+
+    PEGASUS_TEST_ASSERT(
+        cimInstArray[0].getClassName().getString() == CLASSNAME);
+    PEGASUS_TEST_ASSERT(
+        cimInstArray[0].getProperty(0).getName().getString() == "prop1");
+    PEGASUS_TEST_ASSERT(
+        cimInstArray[0].getProperty(0).getType() == CIMTYPE_STRING);
+    cimInstArray[0].getProperty(0).getValue().get(str1);
+    PEGASUS_TEST_ASSERT(str1 == "value1");
+    PEGASUS_TEST_ASSERT(
+        cimInstArray[0].getProperty(1).getName().getString() == "prop2");
+    PEGASUS_TEST_ASSERT(
+        cimInstArray[0].getProperty(1).getType() == CIMTYPE_STRING);
+    cimInstArray[0].getProperty(1).getValue().get(str2);
+    PEGASUS_TEST_ASSERT(str2 == "value2");
+
+    PEGASUS_TEST_ASSERT(
+        cimInstArray[1].getClassName().getString() == CLASSNAME);
+    PEGASUS_TEST_ASSERT(
+        cimInstArray[1].getProperty(0).getName().getString() == "prop1");
+    PEGASUS_TEST_ASSERT(
+        cimInstArray[1].getProperty(0).getType() == CIMTYPE_STRING);
+    cimInstArray[1].getProperty(0).getValue().get(str1);
+    PEGASUS_TEST_ASSERT(str1 == "value3");
+    PEGASUS_TEST_ASSERT(
+        cimInstArray[1].getProperty(1).getName().getString() == "prop2");
+    PEGASUS_TEST_ASSERT(
+        cimInstArray[1].getProperty(1).getType() == CIMTYPE_STRING);
+    cimInstArray[1].getProperty(1).getValue().get(str2);
+    PEGASUS_TEST_ASSERT(str2 == "value4");
+
+    // Test non-existent class
+    try
+    {
+        wsmInst.setClassName("garbage");
+        mapper.convertWsmToCimInstance(wsmInst, NAMESPACE, cimInst);
+        PEGASUS_TEST_ASSERT(0);
+    }
+    catch (CIMException& e)
+    {
+        PEGASUS_TEST_ASSERT(e.getCode() == CIM_ERR_NOT_FOUND);
+    }
+
+    // Test non-existent property
+    {
+        WsmValue val3("value3");
+        wsmInst.setClassName(CLASSNAME);
+        wsmInst.addProperty(WsmProperty(String("prop3"), val3));
+        ASSERT_FAULT(
+            mapper.convertWsmToCimInstance(wsmInst, NAMESPACE, cimInst),
+            "wsman:SchemaValidationError");
+    }
+}
+
+static void _testEPRs(void)
+{
+    const String NAMESPACE = "aa/bb";
+    const String CLASSNAME = "MyClass";
+
+    CIMRepository r(repositoryRoot, CIMRepository::MODE_XML);
+    WsmToCimRequestMapper mapper(&r);
+
+    // Test mapping of EPRs
+    CIMObjectPath objectPath;
+    WsmEndpointReference epr;
+    epr.address = "http://www.acme.com:5988/wsman";
+    epr.resourceUri = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/MyClass";
+    epr.selectorSet->selectors.
+        append(WsmSelector("prop1", "value1"));
+    epr.selectorSet->selectors.
+        append(WsmSelector("__cimnamespace", NAMESPACE));
+    mapper.convertEPRToObjectPath(epr, objectPath);
+    PEGASUS_TEST_ASSERT(objectPath.toString() == 
+        "//www.acme.com/aa/bb:MyClass.prop1=\"value1\"");
+
+    // Test mapping of EPR values
+    WsmValue wsmEprValue(epr);
+    CIMValue cimObjpathValue(CIMTYPE_REFERENCE, false);
+    mapper.convertWsmToCimValue(wsmEprValue, NAMESPACE, cimObjpathValue);
+    CIMObjectPath objectPath1;
+    cimObjpathValue.get(objectPath1);
+    PEGASUS_TEST_ASSERT(objectPath1.toString() == 
+        "//www.acme.com/aa/bb:MyClass.prop1=\"value1\"");
+
+    // Test mapping of EPR array values
+    WsmEndpointReference epr1;
+    epr1.address = "http://www.acme1.com:5988/wsman";
+    epr1.resourceUri = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/MyClass";
+    epr1.selectorSet->selectors.
+        append(WsmSelector("prop1", "value2"));
+    epr1.selectorSet->selectors.
+        append(WsmSelector("__cimnamespace", NAMESPACE));
+    Array<WsmEndpointReference> eprArray;
+    eprArray.append(epr);
+    eprArray.append(epr1);
+    WsmValue wsmEprArrayValue(eprArray);
+    CIMValue cimObjpathArrayValue(CIMTYPE_REFERENCE, true);
+    mapper.convertWsmToCimValue(
+        wsmEprArrayValue, NAMESPACE, cimObjpathArrayValue);
+    Array<CIMObjectPath> objectPathArray;
+    cimObjpathArrayValue.get(objectPathArray);
+    PEGASUS_TEST_ASSERT(objectPathArray[0].toString() == 
+        "//www.acme.com/aa/bb:MyClass.prop1=\"value1\"");
+    PEGASUS_TEST_ASSERT(objectPathArray[1].toString() == 
+        "//www.acme1.com/aa/bb:MyClass.prop1=\"value2\"");
+
+    // Test invalid __cimnamespace selector type
+    WsmEndpointReference epr2;
+    epr2.address = "http://www.acme.com:5988/wsman";
+    epr2.resourceUri = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/MyClass";
+    epr2.selectorSet->selectors.
+        append(WsmSelector("__cimnamespace", epr1));
+    ASSERT_FAULT(
+        mapper.convertEPRToObjectPath(epr2, objectPath),
+        "wsman:InvalidSelectors");
+
+    // Test illegal __cimnamespace name
+    WsmEndpointReference epr3;
+    epr3.address = "http://www.acme.com:5988/wsman";
+    epr3.resourceUri = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/MyClass";
+    epr3.selectorSet->selectors.
+        append(WsmSelector("__cimnamespace", "garbage namespace #@!"));
+    ASSERT_FAULT(
+        mapper.convertEPRToObjectPath(epr3, objectPath),
+        "wsman:InvalidSelectors");
+
+    // Test illegal property name
+    WsmEndpointReference epr4;
+    epr4.address = "http://www.acme.com:5988/wsman";
+    epr4.resourceUri = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/MyClass";
+    epr4.selectorSet->selectors.
+        append(WsmSelector("__cimnamespace", NAMESPACE));
+    epr4.selectorSet->selectors.
+        append(WsmSelector("prop 1", "value"));
+    ASSERT_FAULT(
+        mapper.convertEPRToObjectPath(epr4, objectPath),
+        "wsman:InvalidSelectors");
+
+    // Test non-existent property name
+    WsmEndpointReference epr5;
+    epr5.address = "http://www.acme.com:5988/wsman";
+    epr5.resourceUri = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/MyClass";
+    epr5.selectorSet->selectors.
+        append(WsmSelector("__cimnamespace", NAMESPACE));
+    epr5.selectorSet->selectors.
+        append(WsmSelector("prop3", "value"));
+    ASSERT_FAULT(
+        mapper.convertEPRToObjectPath(epr5, objectPath),
+        "wsman:InvalidSelectors");
+
+    // Test type mismatch in key types
+    WsmEndpointReference epr6;
+    epr6.address = "https://www.acme.com:5988/wsman";
+    epr6.resourceUri = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/MyClass";
+    epr6.selectorSet->selectors.
+        append(WsmSelector("__cimnamespace", NAMESPACE));
+    epr6.selectorSet->selectors.
+        append(WsmSelector("prop3", epr1));
+    ASSERT_FAULT(
+        mapper.convertEPRToObjectPath(epr6, objectPath),
+        "wsman:InvalidSelectors");
+
+    // Test anonymous address in EPR
+    String addr1 = mapper.convertEPRAddressToHostname(WSM_ADDRESS_ANONYMOUS);
+    PEGASUS_TEST_ASSERT(addr1 == String::EMPTY);
+
+    // Test malformed EPR addresses
+    ASSERT_FAULT(
+        mapper.convertEPRAddressToHostname("garbage"),
+        "wsa:InvalidMessageInformationHeader");
+    
+    ASSERT_FAULT(
+        mapper.convertEPRAddressToHostname("http://blah"),
+        "wsa:InvalidMessageInformationHeader");
+    
+    ASSERT_FAULT(
+        mapper.convertEPRAddressToHostname("http://bsa#@^&sa/wsman"),
+        "wsa:InvalidMessageInformationHeader");
+}
+
+int main(int argc, char** argv)
+{
+    verbose = getenv("PEGASUS_TEST_VERBOSE") ? true : false;
+
+    const char* tmpDir = getenv ("PEGASUS_TMP");
+    if (tmpDir == NULL)
+    {
+        repositoryRoot = ".";
+    }
+    else
+    {
+        repositoryRoot = tmpDir;
+    }
+    repositoryRoot.append("/repository");
+
+    try
+    {
+        if (verbose)
+        {
+            cout << "Testing simple values and arrays." << endl;
+        }
+        _testValues();
+
+        if (verbose)
+        {
+            cout << "Testing instances." << endl;
+        }
+        _testInstances();
+
+        if (verbose)
+        {
+            cout << "Testing EPRs." << endl;
+        }
+        _testEPRs();
+
+        if (verbose)
+        {
+            cout << "Testing conversion errors." << endl;
+        }
+        _testConversionErrors();
+    }
+    catch (Exception& e)
+    {
+        cerr << "Error: " << e.getMessage() << endl;
+        exit(1);
+    }
+    catch (WsmFault& f)
+    {
+        cerr << "Error: " << f.getSubcode() << " " << f.getReason() << endl;
+        exit(1);
+    }
+
+    cout << argv[0] << " +++++ passed all tests" << endl;
+
+    return 0;
+}
diff --git a/src/Pegasus/WsmServer/tests/WsmValue/Makefile b/src/Pegasus/WsmServer/tests/WsmValue/Makefile
new file mode 100644 (file)
index 0000000..e79e919
--- /dev/null
@@ -0,0 +1,45 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#// 
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//==============================================================================
+ROOT = ../../../../..
+DIR = Pegasus/WsmServer/tests/WsmValue
+include $(ROOT)/mak/config.mak
+include ../libraries.mak
+
+PROGRAM = TestWsmValue
+
+SOURCES = WsmValue.cpp
+
+include $(ROOT)/mak/program.mak
+
+tests:
+       $(PROGRAM)
+
+poststarttests:
diff --git a/src/Pegasus/WsmServer/tests/WsmValue/WsmValue.cpp b/src/Pegasus/WsmServer/tests/WsmValue/WsmValue.cpp
new file mode 100644 (file)
index 0000000..446d7bd
--- /dev/null
@@ -0,0 +1,623 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+#include <stdio.h>
+
+#include <Pegasus/Common/String.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/Common/MessageLoader.h>
+
+#include <Pegasus/WsmServer/WsmValue.h>
+#include <Pegasus/WsmServer/WsmEndpointReference.h>
+#include <Pegasus/WsmServer/WsmInstance.h>
+#include <Pegasus/WsmServer/WsmSelectorSet.h>
+
+PEGASUS_USING_PEGASUS;
+PEGASUS_USING_STD;
+
+
+static void _testStrings(void)
+{
+        {
+            // Test defaul constructor
+            WsmValue val;
+            if (val.getType() != WSMTYPE_OTHER ||
+                val.isArray() || !val.isNull())
+                throw Exception("Invalid default value.");
+        }
+
+        {
+            // Test string value constructor
+            WsmValue val("Test string 1");
+            if (val.getType() != WSMTYPE_OTHER ||
+                val.isArray() || val.isNull())
+                throw Exception("Invalid string value.");
+
+            // Test string get()
+            String str;
+            val.get(str);
+            if (str != "Test string 1")
+                throw Exception("Invalid string from value get().");
+
+            // Convert string value to string array value
+            val.toArray();
+            if (val.getType() != WSMTYPE_OTHER ||
+                !val.isArray() || val.isNull() || val.getArraySize() != 1)
+                throw Exception("Invalid string to array conversion.");
+
+            // Make sure we still have the same string
+            Array<String> stra;
+            val.get(stra);
+            if (stra[0] != "Test string 1")
+                throw Exception("Invalid string array from value get().");
+
+            // Add more strings to the array
+            for (int i = 2; i < 5; i++)
+            {
+                char buf[20];
+                sprintf(buf, "Test string %d", i);
+                WsmValue tmp(buf);
+                val.add(tmp);
+            }
+
+            // Make sure we can get the array + verify it's size
+            val.get(stra);
+            if (stra.size() != 4)
+                throw Exception("Invalid string array size.");
+
+            // Test that we have the right entries in the array
+            for (int i = 1; i < 5; i++)
+            {
+                char buf[20];
+                sprintf(buf, "Test string %d", i);
+
+                if (stra[i-1] != buf)
+                    throw Exception("Invalid string array entry.");
+            }
+            
+            // Re-set the value from array to string
+            val.set("New test string 1");
+            if (val.getType() != WSMTYPE_OTHER ||
+                val.isArray() || val.isNull())
+                throw Exception("Invalid string value.");
+
+            // Make sure set() worked correctly
+            val.get(str);
+            if (str != "New test string 1")
+                throw Exception("Can't set string value.");
+
+            // Add string values. The value must convert itself into 
+            // string array.
+            for (int i = 2; i < 6; i++)
+            {
+                char buf[20];
+                sprintf(buf, "New test string %d", i);
+                WsmValue tmp(buf);
+                val.add(tmp);
+            }
+            
+             // Make sure we can get the array + verify it's size
+            val.get(stra);
+            if (stra.size() != 5)
+                throw Exception("Invalid string array size.");
+
+            // Test that we have the right entries in the array
+            for (int i = 1; i < 6; i++)
+            {
+                char buf[20];
+                sprintf(buf, "New test string %d", i);
+
+                if (stra[i-1] != buf)
+                    throw Exception("Invalid string array entry.");
+            }
+
+            // Test string array constructor array value set
+            Array<String> tmp;
+            for (int i = 1; i < 4; i++)
+            {
+                char buf[20];
+                sprintf(buf, "Test string - %d", i);
+                tmp.append(buf);
+            }
+            val.set(tmp);
+            val.get(stra);
+
+            // Test that we have the right entries in the array
+            for (int i = 1; i < 4; i++)
+            {
+                char buf[20];
+                sprintf(buf, "Test string - %d", i);
+
+                if (stra[i-1] != buf)
+                    throw Exception("Invalid string array entry.");
+            }
+
+            WsmValue val1(tmp);
+            Array<String> stra1;
+            val1.get(stra1);
+
+            // Test that we have the right entries in the array
+            for (int i = 1; i < 4; i++)
+            {
+                char buf[20];
+                sprintf(buf, "Test string - %d", i);
+
+                if (stra1[i-1] != buf)
+                    throw Exception("Invalid string array entry.");
+            }
+       }
+}
+
+static void _createEPR(int idx, WsmEndpointReference& epr)
+{
+    char buf[20];
+    sprintf(buf, "Address %d", idx);
+    epr.address = buf;
+    sprintf(buf, "resourceUri %d", idx);
+    epr.resourceUri = buf;
+}
+
+static Boolean _compareEPRs(WsmEndpointReference& epr1, 
+    WsmEndpointReference& epr2)
+{
+    if (epr1.address != epr2.address ||
+        epr1.resourceUri != epr2.resourceUri ||
+        epr1.selectorSet->selectors.size() != 
+        epr2.selectorSet->selectors.size())
+        return false;
+
+    return true;
+}
+
+static Boolean _verifyEPR(int idx, WsmEndpointReference& epr)
+{
+    WsmEndpointReference tmp;
+    _createEPR(idx, tmp);
+    return _compareEPRs(epr, tmp);
+}
+
+static void _testEPRs(void)
+{
+    WsmEndpointReference epr;
+
+    _createEPR(0, epr);
+    WsmValue val(epr);
+
+    // Test EPR value constructor
+    if (val.getType() != WSMTYPE_REFERENCE ||
+        val.isArray() || val.isNull())
+        throw Exception("Invalid EPR value.");
+    
+    // Test EPR get()
+    WsmEndpointReference epr1;
+    val.get(epr1);
+    if (!_verifyEPR(0, epr1))
+        throw Exception("Invalid EPR from value get().");
+
+    // Convert EPR value to EPR array value
+    val.toArray();
+    if (val.getType() != WSMTYPE_REFERENCE ||
+        !val.isArray() || val.isNull() || val.getArraySize() != 1)
+        throw Exception("Invalid EPR to array conversion.");
+
+    // Make sure we still have the same EPR
+    Array<WsmEndpointReference> epra;
+    val.get(epra);
+    if (!_verifyEPR(0, epra[0]))
+        throw Exception("Invalid EPR array from value get().");
+
+    // Add more EPRs to the array
+    for (int i = 1; i < 4; i++)
+    {
+        WsmEndpointReference tmp_epr;
+        _createEPR(i, tmp_epr);
+        WsmValue tmp_val(tmp_epr);
+        val.add(tmp_val);
+    }
+
+    // Make sure we can get the array + verify it's size
+    val.get(epra);
+    if (epra.size() != 4)
+        throw Exception("Invalid EPR array size.");
+
+    // Test that we have the right entries in the array
+    for (int i = 0; i < 4; i++)
+    {
+        if (!_verifyEPR(i, epra[i]))
+            throw Exception("Invalid EPR array entry.");
+    }
+            
+    // Re-set the value from array to EPR
+    _createEPR(10, epr);
+    val.set(epr);
+    if (val.getType() != WSMTYPE_REFERENCE ||
+        val.isArray() || val.isNull())
+        throw Exception("Invalid EPR value.");
+
+    // Make sure set() worked correctly
+    val.get(epr1);
+    if (!_verifyEPR(10, epr1))
+        throw Exception("Can't set EPR value.");
+
+    // Add string values. The value must convert itself into EPR array.
+    for (int i = 11; i < 15; i++)
+    {
+        WsmEndpointReference tmp_epr;
+        _createEPR(i, tmp_epr);
+        WsmValue tmp_val(tmp_epr);
+        val.add(tmp_val);
+    }
+            
+    // Make sure we can get the array + verify it's size
+    val.get(epra);
+    if (epra.size() != 5)
+        throw Exception("Invalid EPR array size.");
+
+    // Test that we have the right entries in the array
+    for (int i = 10; i < 15; i++)
+    {
+        if (!_verifyEPR(i, epra[i-10]))
+            throw Exception("Invalid EPR array entry.");
+    }
+
+    // Test EPR array constructor and array value set
+    Array<WsmEndpointReference> tmp;
+    for (int i = 20; i < 26; i++)
+    {
+        WsmEndpointReference tmp_epr;
+        _createEPR(i, tmp_epr);
+        tmp.append(tmp_epr);
+    }
+    val.set(tmp);
+    val.get(epra);
+
+    // Test that we have the right entries in the array
+    for (int i = 20; i < 26; i++)
+    {
+        if (!_verifyEPR(i, epra[i-20]))
+            throw Exception("Invalid EPR array entry.");
+    }
+
+    WsmValue val1(tmp);
+    Array<WsmEndpointReference> epra1;
+    val1.get(epra1);
+
+    // Test that we have the right entries in the array
+    for (int i = 20; i < 26; i++)
+    {
+        if (!_verifyEPR(i, epra1[i-20]))
+            throw Exception("Invalid EPR array entry.");
+    }
+}
+
+static void _createInstance(int idx, WsmInstance& inst)
+{
+    char buf[20];
+    sprintf(buf, "Class name %d", idx);
+    inst.setClassName(buf);
+}
+
+static Boolean _compareInstances(WsmInstance& inst1, WsmInstance& inst2)
+{
+    if (inst1.getClassName() != inst2.getClassName())
+        return false;
+
+    return true;
+}
+
+static Boolean _verifyInstance(int idx, WsmInstance& inst)
+{
+    WsmInstance tmp;
+    _createInstance(idx, tmp);
+    return _compareInstances(inst, tmp);
+}
+
+static void _testInstances(void)
+{
+    WsmInstance inst;
+
+    _createInstance(0, inst);
+    WsmValue val(inst);
+
+    // Test Instance value constructor
+    if (val.getType() != WSMTYPE_INSTANCE ||
+        val.isArray() || val.isNull())
+        throw Exception("Invalid Instance value.");
+    
+    // Test Instance get()
+    WsmInstance inst1;
+    val.get(inst1);
+    if (!_verifyInstance(0, inst1))
+        throw Exception("Invalid Instance from value get().");
+
+    // Convert Instance value to Instance array value
+    val.toArray();
+    if (val.getType() != WSMTYPE_INSTANCE ||
+        !val.isArray() || val.isNull() || val.getArraySize() != 1)
+        throw Exception("Invalid Instance to array conversion.");
+
+    // Make sure we still have the same Instance
+    Array<WsmInstance> insta;
+    val.get(insta);
+    if (!_verifyInstance(0, insta[0]))
+        throw Exception("Invalid Instance array from value get().");
+
+    // Add more Instances to the array
+    for (int i = 1; i < 4; i++)
+    {
+        WsmInstance tmp_inst;
+        _createInstance(i, tmp_inst);
+        WsmValue tmp_val(tmp_inst);
+        val.add(tmp_val);
+    }
+
+    // Make sure we can get the array + verify it's size
+    val.get(insta);
+    if (insta.size() != 4)
+        throw Exception("Invalid Instance array size.");
+
+    // Test that we have the right entries in the array
+    for (int i = 0; i < 4; i++)
+    {
+        if (!_verifyInstance(i, insta[i]))
+            throw Exception("Invalid Instance array entry.");
+    }
+            
+    // Re-set the value from array to Instance
+    _createInstance(10, inst);
+    val.set(inst);
+    if (val.getType() != WSMTYPE_INSTANCE ||
+        val.isArray() || val.isNull())
+        throw Exception("Invalid Instance value.");
+
+    // Make sure set() worked correctly
+    val.get(inst1);
+    if (!_verifyInstance(10, inst1))
+        throw Exception("Can't set Instance value.");
+
+    // Add Instance values. The value must convert itself into Instance array.
+    for (int i = 11; i < 15; i++)
+    {
+        WsmInstance tmp_inst;
+        _createInstance(i, tmp_inst);
+        WsmValue tmp_val(tmp_inst);
+        val.add(tmp_val);
+    }
+            
+    // Make sure we can get the array + verify it's size
+    val.get(insta);
+    if (insta.size() != 5)
+        throw Exception("Invalid Instance array size.");
+
+    // Test that we have the right entries in the array
+    for (int i = 10; i < 15; i++)
+    {
+        if (!_verifyInstance(i, insta[i-10]))
+            throw Exception("Invalid Instance array entry.");
+    }
+
+    // Test Instance array constructor and array value set
+    Array<WsmInstance> tmp;
+    for (int i = 20; i < 26; i++)
+    {
+        WsmInstance tmp_inst;
+        _createInstance(i, tmp_inst);
+        tmp.append(tmp_inst);
+    }
+    val.set(tmp);
+    val.get(insta);
+
+    // Test that we have the right entries in the array
+    for (int i = 20; i < 26; i++)
+    {
+        if (!_verifyInstance(i, insta[i-20]))
+            throw Exception("Invalid Instance array entry.");
+    }
+
+    WsmValue val1(tmp);
+    Array<WsmInstance> insta1;
+    val1.get(insta1);
+
+    // Test that we have the right entries in the array
+    for (int i = 20; i < 26; i++)
+    {
+        if (!_verifyInstance(i, insta1[i-20]))
+            throw Exception("Invalid Instance array entry.");
+    }
+}
+
+static void _testValueErrors()
+{
+    // Get 'get' type mismatches of EPR values
+    try {
+        String str;
+        WsmEndpointReference epr;
+        WsmValue val(epr);
+        val.get(str);
+        throw Exception("Expected type mismatch");
+    }
+    catch (TypeMismatchException& e) {}
+
+    try {
+        Array<WsmEndpointReference> epra;
+        WsmEndpointReference epr;
+        WsmValue val(epr);
+        val.get(epra);
+        throw Exception("Expected type mismatch");
+    }
+    catch (TypeMismatchException& e) {}
+
+    try {
+        String str;
+        Array<WsmEndpointReference> epr;
+        WsmValue val(epr);
+        val.get(str);
+        throw Exception("Expected type mismatch");
+    }
+    catch (TypeMismatchException& e) {}
+
+    try {
+        Array<WsmEndpointReference> epra;
+        WsmEndpointReference epr;
+        WsmValue val(epra);
+        val.get(epr);
+        throw Exception("Expected type mismatch");
+    }
+    catch (TypeMismatchException& e) {}
+
+    // Test 'get' type mismatches of instance values
+    try {
+        String str;
+        WsmInstance inst;
+        WsmValue val(inst);
+        val.get(str);
+        throw Exception("Expected type mismatch");
+    }
+    catch (TypeMismatchException& e) {}
+
+    try {
+        Array<WsmInstance> insta;
+        WsmInstance inst;
+        WsmValue val(inst);
+        val.get(insta);
+        throw Exception("Expected type mismatch");
+    }
+    catch (TypeMismatchException& e) {}
+
+    try {
+        String str;
+        Array<WsmInstance> inst;
+        WsmValue val(inst);
+        val.get(str);
+        throw Exception("Expected type mismatch");
+    }
+    catch (TypeMismatchException& e) {}
+
+    try {
+        Array<WsmInstance> insta;
+        WsmInstance inst;
+        WsmValue val(insta);
+        val.get(inst);
+        throw Exception("Expected type mismatch");
+    }
+    catch (TypeMismatchException& e) {}
+
+    //  Test 'get' type mismatches of string values
+    try {
+        WsmInstance inst;
+        String str;
+        WsmValue val(str);
+        val.get(inst);
+        throw Exception("Expected type mismatch");
+    }
+    catch (TypeMismatchException& e) {}
+
+    try {
+        Array<String> stra;
+        String str;
+        WsmValue val(str);
+        val.get(stra);
+        throw Exception("Expected type mismatch");
+    }
+    catch (TypeMismatchException& e) {}
+
+    try {
+        WsmInstance inst;
+        Array<String> str;
+        WsmValue val(str);
+        val.get(inst);
+        throw Exception("Expected type mismatch");
+    }
+    catch (TypeMismatchException& e) {}
+
+    try {
+        Array<String> stra;
+        String str;
+        WsmValue val(stra);
+        val.get(str);
+        throw Exception("Expected type mismatch");
+    }
+    catch (TypeMismatchException& e) {}
+
+    // Test adding a type mismatched value to an array value
+    try {
+        String str;
+        WsmInstance inst;
+        WsmValue ival(inst);
+        WsmValue sval(str);
+        ival.add(sval);
+    }
+    catch (TypeMismatchException& e) {}
+}
+
+static void _testMisc(void)
+{
+    // Test that array conversion works on an array value
+    {
+        Array<String> stra;
+        WsmValue val(stra);
+        val.toArray();
+        if (val.isNull() || !val.isArray() || 
+            val.getType() != WSMTYPE_OTHER)
+            throw Exception("Invalid array value");
+    }
+
+    // Test setNull()
+    WsmInstance inst;
+    {
+        WsmValue val(inst);
+        val.setNull();
+        if (!val.isNull() || val.isArray() || 
+            val.getType() != WSMTYPE_OTHER)
+            throw Exception("Invalid NULL value");    
+    }
+}
+
+int main(int argc, char** argv)
+{
+    try
+    {
+        _testStrings();
+        _testEPRs();
+        _testInstances();
+        _testMisc();
+        _testValueErrors();
+    }
+
+    catch (Exception& e)
+    {
+        cerr << "Error: " << e.getMessage() << endl;    
+        exit(1);
+    }
+    cout << argv[0] << " +++++ passed all tests" << endl;
+    return 0;
+}
diff --git a/src/Pegasus/WsmServer/tests/WsmWriter/Makefile b/src/Pegasus/WsmServer/tests/WsmWriter/Makefile
new file mode 100644 (file)
index 0000000..e82a150
--- /dev/null
@@ -0,0 +1,47 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#// 
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//==============================================================================
+ROOT = ../../../../..
+DIR = Pegasus/WsmServer/tests/WsmWriter
+include $(ROOT)/mak/config.mak
+include ../libraries.mak
+
+LOCAL_DEFINES = -DPEGASUS_INTERNALONLY
+
+PROGRAM = TestWsmWriter
+
+SOURCES = WsmWriter.cpp
+
+include $(ROOT)/mak/program.mak
+
+tests:
+       $(PROGRAM)
+
+poststarttests:
diff --git a/src/Pegasus/WsmServer/tests/WsmWriter/WsmWriter.cpp b/src/Pegasus/WsmServer/tests/WsmWriter/WsmWriter.cpp
new file mode 100644 (file)
index 0000000..f87842d
--- /dev/null
@@ -0,0 +1,692 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//=============================================================================
+//
+//%////////////////////////////////////////////////////////////////////////////
+
+#include <Pegasus/WsmServer/WsmConstants.h>
+#include <Pegasus/WsmServer/WsmUtils.h>
+#include <Pegasus/WsmServer/WsmReader.h>
+#include <Pegasus/WsmServer/WsmWriter.h>
+#include <Pegasus/WsmServer/WsmValue.h>
+#include <Pegasus/WsmServer/WsmEndpointReference.h>
+#include <Pegasus/WsmServer/WsmInstance.h>
+#include <Pegasus/WsmServer/WsmSelectorSet.h>
+
+PEGASUS_USING_PEGASUS;
+PEGASUS_USING_STD;
+
+static Boolean verbose;
+static Boolean _compareInstances(WsmInstance& inst1, WsmInstance& inst2);
+static Boolean _compareEPRs(
+    WsmEndpointReference& epr1, WsmEndpointReference& epr2);
+
+static Boolean _compareSelectors(WsmSelector& sel1, WsmSelector& sel2)
+{
+    if (sel1.type != sel2.type || sel1.name != sel2.name)
+        return false;
+
+    if (sel1.type == WsmSelector::VALUE)
+        return sel1.value == sel2.value;
+    else
+        return _compareEPRs(sel1.epr, sel2.epr);
+}
+
+static Boolean _compareSelectorSets(WsmSelectorSet* sel1, WsmSelectorSet* sel2)
+{
+    if (sel1 == 0 && sel2 == 0)
+        return true;
+
+    if (sel1 == 0 || sel2 == 0)
+        return false;
+
+    if (sel1->selectors.size() != sel2->selectors.size())
+        return false;
+
+    for (Uint32 i = 0; i < sel1->selectors.size(); i++)
+    {
+        if (!_compareSelectors(sel1->selectors[i], sel2->selectors[i]))
+            return false;
+    }
+
+    return true;
+}
+
+static Boolean _compareEPRs(WsmEndpointReference& epr1, 
+    WsmEndpointReference& epr2)
+{
+    if (epr1.address != epr2.address ||
+        epr1.resourceUri != epr2.resourceUri ||
+        !_compareSelectorSets(epr1.selectorSet, epr2.selectorSet))
+        return false;
+
+    return true;
+}
+
+static Boolean _compareValues(WsmValue& val1, WsmValue& val2)
+{
+    if (val1.getType() != val2.getType() ||
+        val1.isNull() != val2.isNull() ||
+        val1.isArray() != val2.isArray() ||
+        val1.getArraySize() != val1.getArraySize())
+        return false;
+
+    if (val1.isArray())
+    {
+        switch (val1.getType())
+        {
+            case WSMTYPE_REFERENCE:
+            {
+                Array<WsmEndpointReference> epr1, epr2;
+                val1.get(epr1);
+                val2.get(epr2);
+                for (Uint32 i = 0; i < epr1.size(); i++)
+                {
+                    if (!_compareEPRs(epr1[i], epr2[i]))
+                        return false;
+                }
+                break;
+            }
+            case WSMTYPE_INSTANCE:
+            {
+                Array<WsmInstance> inst1, inst2;
+                val1.get(inst1);
+                val2.get(inst2);
+                for (Uint32 i = 0; i < inst1.size(); i++)
+                {
+                    if (!_compareInstances(inst1[i], inst2[i]))
+                        return false;
+                }
+                break;
+            }
+            case WSMTYPE_OTHER:
+            {
+                Array<String> str1, str2;
+                val1.get(str1);
+                val2.get(str2);
+                for (Uint32 i = 0; i < str1.size(); i++)
+                {
+                    if (str1[i] != str2[i])
+                        return false;
+                }
+                break;
+            }
+            default:
+                PEGASUS_ASSERT(0);
+        }
+    }
+    else
+    {
+        switch (val1.getType())
+        {
+            case WSMTYPE_REFERENCE:
+            {
+                WsmEndpointReference epr1, epr2;
+                val1.get(epr1);
+                val2.get(epr2);
+                return _compareEPRs(epr1, epr2);
+            }
+            case WSMTYPE_INSTANCE:
+            {
+                WsmInstance inst1, inst2;
+                val1.get(inst1);
+                val2.get(inst2);
+                return _compareInstances(inst1, inst2);
+            }
+            case WSMTYPE_OTHER:
+            {
+                String str1, str2;
+                val1.get(str1);
+                val2.get(str2);
+                return str1 == str2;
+            }
+            default:
+                PEGASUS_ASSERT(0);
+        }
+    }
+
+    return true;
+}
+
+static Boolean _compareProperties(WsmProperty& prop1, WsmProperty& prop2)
+{
+    if (prop1.getName() != prop2.getName())
+        return false;
+
+    return _compareValues(prop1.getValue(), prop2.getValue());
+}
+
+static Boolean _compareInstances(WsmInstance& inst1, WsmInstance& inst2)
+{
+    if (inst1.getClassName() != inst2.getClassName() ||
+        inst1.getPropertyCount() != inst2.getPropertyCount())
+        return false;
+
+    for (Uint32 i = 0; i < inst1.getPropertyCount(); i++)
+    {
+        if (!_compareProperties(inst1.getProperty(i), inst2.getProperty(i)))
+            return false;
+    }
+
+    return true;
+}
+
+static void _appendSoapEnvelopeStart(Buffer& out)
+{
+    out << STRLIT("<");
+    out << WsmNamespaces::supportedNamespaces[
+        WsmNamespaces::SOAP_ENVELOPE].localName;
+    out << STRLIT(":Envelope");
+
+    for (unsigned int i = 0; i < WsmNamespaces::LAST; i++)
+    {
+        out << STRLIT(" xmlns:");
+        out << WsmNamespaces::supportedNamespaces[i].localName;
+        out << STRLIT("=\"");
+        out << WsmNamespaces::supportedNamespaces[i].extendedName;
+        out << STRLIT("\"");
+    }
+    out << STRLIT(">");
+}
+
+static void _checkInstance(WsmInstance& inst, const char* text)
+{
+    Buffer out;
+    _appendSoapEnvelopeStart(out);
+    WsmWriter::appendInstanceElement(out, inst);
+    WsmWriter::appendEndTag(
+        out, WsmNamespaces::SOAP_ENVELOPE, STRLIT("Envelope"));
+
+    WsmInstance inst1;
+    XmlEntry entry;
+    WsmReader reader((char*)out.getData());
+    reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+    reader.getInstanceElement(inst1);
+    reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+    if (!_compareInstances(inst, inst1))
+        throw Exception(text);
+}
+
+static void _testInstances(void)
+{
+    // Simple test: instance with a few string properties
+    {
+        WsmInstance inst("testClass");
+        WsmValue val_1("value_1");
+        WsmValue val_2("value_2");
+        inst.addProperty(WsmProperty("property_1", val_1));
+        inst.addProperty(WsmProperty("property_2", val_2));
+
+        _checkInstance(inst,
+            "Instances with string properties do not compare");
+    }
+
+    // Test string array properties
+    {
+        WsmInstance inst("testClass");
+        Array<String> stra;
+        for (int i = 0; i < 5; i++)
+        {
+            char buf[20];
+            sprintf(buf, "prop_1 value: %d", i);
+            stra.append(buf);
+        }
+        WsmValue val1(stra);
+        inst.addProperty(WsmProperty("property_1", val1));
+        
+        stra.clear();
+        for (int i = 0; i < 10; i++)
+        {
+            char buf[20];
+            sprintf(buf, "prop_2 value: %d", i);
+            stra.append(buf);
+        }
+        WsmValue val2(stra);
+        inst.addProperty(WsmProperty("property_2", val2));
+
+        _checkInstance(inst, 
+            "Instances with string array properties do not compare");
+    }
+
+    // Test EPR properties
+    {
+        WsmInstance inst("testClass");
+        WsmEndpointReference epr;
+        epr.address = "http://www.acme.com:5988/wsman";
+        epr.resourceUri = "TestURI";
+        epr.selectorSet->selectors.
+            append(WsmSelector("sel_1 name", "sel_1 value"));
+        epr.selectorSet->selectors.
+            append(WsmSelector("sel_2 name", "sel_2 value"));
+        WsmValue val(epr);
+        inst.addProperty(WsmProperty("property_1", val));
+
+        _checkInstance(inst, "Instances with EPR properties do not compare");
+    }
+
+    // Test EPR array properties
+    {
+        WsmInstance inst("testClass");
+        Array<WsmEndpointReference> epra;
+        for (int i = 0; i < 5; i++)
+        {
+            char buf[50];
+            WsmEndpointReference epr;
+            sprintf(buf, "http://www.acme.com_%d:5988/wsman", i);
+            epr.address = buf;
+            sprintf(buf, "TestURI_%d", i);
+            epr.resourceUri = buf;
+            sprintf(buf, "selector value %d", i);
+            epr.selectorSet->selectors.
+                append(WsmSelector("sel_name", buf));
+            epra.append(epr);
+            
+        }
+        WsmValue val(epra);
+        inst.addProperty(WsmProperty("property_1", val));
+
+        _checkInstance(inst, 
+            "Instances with EPR array properties do not compare");
+    }
+
+    // Test recursive EPR properties
+    {
+        WsmInstance inst("testClass");
+
+        WsmEndpointReference epr1;
+        epr1.address = "http://www.acme.com_1:5988/wsman";
+        epr1.resourceUri = "TestURI_1";
+        epr1.selectorSet->selectors.
+            append(WsmSelector("sel_0 name", "sel_1 value"));
+        epr1.selectorSet->selectors.
+            append(WsmSelector("sel_1 name", "sel_2 value"));
+
+        WsmEndpointReference epr2;
+        epr2.address = "http://www.acme.com_2:5988/wsman";
+        epr2.resourceUri = "TestURI_2";
+        epr2.selectorSet->selectors.append(WsmSelector("sel_2 name", epr1));
+
+        WsmEndpointReference epr3;
+        epr3.address = "http://www.acme.com_3:5988/wsman";
+        epr3.resourceUri = "TestURI_3";
+        epr3.selectorSet->selectors.append(WsmSelector("sel_3 name", epr2));
+        WsmEndpointReference epr;
+        epr.address = "http://www.acme.com:5988/wsman";
+        epr.resourceUri = "TestURI";
+        epr.selectorSet->selectors.append(WsmSelector("sel name", epr3));
+
+        WsmValue val(epr);
+        inst.addProperty(WsmProperty("property_1", val));
+
+        _checkInstance(inst, 
+            "Instances with recursive EPR properties do not compare");
+    }
+
+    // Test embedded instance properties
+    {
+        WsmInstance inst1("testClass_1");
+        WsmValue val_1("value_1");
+        WsmValue val_2("value_2");
+        inst1.addProperty(WsmProperty("property_1", val_1));
+        inst1.addProperty(WsmProperty("property_2", val_2));
+
+        WsmInstance inst("testClass");
+        WsmValue val_3(inst1);
+        inst.addProperty(WsmProperty("property_3", val_3));
+
+        _checkInstance(inst, 
+            "Instances with instance properties do not compare");
+    }
+
+    // Test arrays of embedded instances
+    {
+        WsmInstance inst("testClass");
+        Array<WsmInstance> insta;
+        for (int i = 0; i < 5; i++)
+        {
+            char buf[20];
+            sprintf(buf, "testClass_%d", i);
+            WsmInstance inst1(buf);
+            sprintf(buf, "value_%d", i);
+            WsmValue val(buf);
+            sprintf(buf, "property_%d", i);
+            inst1.addProperty(WsmProperty(buf, val));
+
+            insta.append(inst1);
+        }
+        WsmValue val(insta);
+        inst.addProperty(WsmProperty("prop_array", val));
+
+        _checkInstance(inst, 
+            "Instances with instance array properties do not compare");
+    }
+
+    // Test recursive embedded instances
+    {
+        WsmInstance inst1("testClass_1");
+        WsmValue val_0("value_0");
+        WsmValue val_1("value_1");
+        inst1.addProperty(WsmProperty("property_0", val_0));
+        inst1.addProperty(WsmProperty("property_1", val_1));
+
+        WsmInstance inst2("testClass_2");
+        WsmValue val_2(inst1);
+        inst2.addProperty(WsmProperty("property_2", val_2));
+
+        WsmInstance inst3("testClass_3");
+        WsmValue val_3(inst2);
+        inst3.addProperty(WsmProperty("property_3", val_3));
+
+        WsmInstance inst("testClass");
+        WsmValue val(inst3);
+        inst.addProperty(WsmProperty("property", val));
+
+        _checkInstance(inst, 
+            "Instances with recursive instance properties do not compare");
+    }
+} 
+
+static void  _testResponseFormatting(void)
+{
+    ContentLanguageList contentLanguage;
+    Buffer body, header, out;
+    const char expectedHttpHeader[] = 
+        "HTTP/1.1 200 OK\r\nContent-Type: application/soap+xml;charset=UTF-8"
+        "\r\ncontent-length: 0000000000\r\nSOAPAction: "
+        "http://schemas.xmlsoap.org/ws/2004/09/transfer/Get\r\n\r\n";
+
+    // Create FaultTo header
+    WsmWriter::appendStartTag(
+        header, WsmNamespaces::WS_ADDRESSING, STRLIT("FaultTo"));
+    WsmWriter::appendTagValue(header, WsmNamespaces::WS_ADDRESSING, 
+        STRLIT("Address"), "http://www.acme.com:5988/wsman");
+    WsmWriter::appendEndTag(
+        header, WsmNamespaces::WS_ADDRESSING, STRLIT("FaultTo"));
+
+    // Create an instance for Soap body
+    WsmInstance inst("testClass");
+    WsmValue val("value");
+    inst.addProperty(WsmProperty("property", val));
+    WsmWriter::appendInstanceElement(body, inst);
+
+    String messageId = WsmUtils::getMessageId();
+    String relatesTo = WsmUtils::getMessageId();
+    Uint32 httpHeaderSize;
+    out = WsmWriter::formatWsmRspMessage(
+        WSM_ACTION_GET,
+        messageId,
+        relatesTo,
+        HTTP_METHOD__POST,
+        contentLanguage,
+        body,
+        header,
+        httpHeaderSize);
+
+    char* ptr = (char*) out.getData();
+    if (strncmp(ptr, expectedHttpHeader, sizeof(expectedHttpHeader)-1) != 0)
+        throw Exception("HTTP header incorrect");
+    ptr += sizeof(expectedHttpHeader)-1;
+
+    WsmReader reader(ptr);
+    const char* xmlVersion = 0;
+    const char* xmlEncoding = 0;
+    reader.getXmlDeclaration(xmlVersion, xmlEncoding);
+    if (strcmp(xmlVersion, "1.0") != 0 || strcmp(xmlEncoding, "utf-8") != 0)
+        throw Exception("XML version or encoding incorrect");
+
+    XmlEntry entry;
+    reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+    
+    String wsaMessageId;
+    String wsaAction;
+    String wsaFrom;
+    String wsaReplyTo;
+    String wsaFaultTo;
+    WsmEndpointReference epr;
+    Uint32 wsmMaxEnvelopeSize = 0;
+    AcceptLanguageList wsmLocale;
+    Boolean wsmRequestEpr = false;
+    reader.decodeRequestSoapHeaders(
+        wsaMessageId, epr.address, wsaAction, wsaFrom, wsaReplyTo,
+        wsaFaultTo, epr.resourceUri, *epr.selectorSet, wsmMaxEnvelopeSize,
+        wsmLocale, wsmRequestEpr);
+
+    if (epr.address != WSM_ADDRESS_ANONYMOUS ||
+        wsaAction != WSM_ACTION_GET ||
+        wsaFrom != String::EMPTY ||
+        wsaReplyTo != String::EMPTY ||
+        wsaMessageId != messageId ||
+        wsaFaultTo != "http://www.acme.com:5988/wsman" ||
+        epr.resourceUri != String::EMPTY ||
+        wsmMaxEnvelopeSize != 0 ||
+        wsmRequestEpr != false)
+        throw Exception("Invalid Soap headers");
+
+    // Read and verify the instance in Soap body.
+    WsmInstance inst1;
+    reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Body");
+    reader.getInstanceElement(inst1);
+    if (!_compareInstances(inst, inst1))
+        throw Exception("Instances do not compare");
+    reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Body");
+
+    reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+}
+
+static void  _testFaultFormatting(void)
+{
+    String messageId = WsmUtils::getMessageId();
+    String relatesTo = WsmUtils::getMessageId();
+
+    // Test Soap NotUnderstood fault.
+    {
+        const char expectedHttpHeader[] = 
+            "HTTP/1.1 500 Internal Server Error\r\nContent-Type: "
+            "application/soap+xml;charset=UTF-8\r\ncontent-length: "
+            "0000000000\r\nSOAPAction: "
+            "http://schemas.xmlsoap.org/ws/2004/08/addressing/fault\r\n\r\n";
+
+        SoapNotUnderstoodFault soapFault(WsmNamespaces::supportedNamespaces[
+            WsmNamespaces::WS_MAN].extendedName, "RequestedEPR");
+    
+        Uint32 httpHeaderSize;
+        Buffer out = WsmWriter::formatSoapFault(
+            soapFault, messageId, relatesTo, HTTP_METHOD__POST, httpHeaderSize);
+
+        char* ptr = (char*) out.getData();
+        if (strncmp(ptr, expectedHttpHeader, 
+                    sizeof(expectedHttpHeader)-1) != 0)
+            throw Exception("HTTP header incorrect");
+        ptr += sizeof(expectedHttpHeader)-1;
+
+        WsmReader reader(ptr);
+        const char* xmlVersion = 0;
+        const char* xmlEncoding = 0;
+        reader.getXmlDeclaration(xmlVersion, xmlEncoding);
+        if (strcmp(xmlVersion, "1.0") != 0 || 
+            strcmp(xmlEncoding, "utf-8") != 0)
+            throw Exception("XML version or encoding incorrect");
+
+        XmlEntry entry;
+        reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+        reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Header");
+        reader.expectStartOrEmptyTag(
+            entry, WsmNamespaces::SOAP_ENVELOPE, "NotUnderstood");
+
+        String addr, action, mid, relto;
+        reader.getElementStringValue(
+            WsmNamespaces::WS_ADDRESSING, "To", addr, true);
+        reader.getElementStringValue(
+            WsmNamespaces::WS_ADDRESSING, "Action", action, true);
+        reader.getElementStringValue(
+            WsmNamespaces::WS_ADDRESSING, "MessageID", mid, true);
+        reader.getElementStringValue(
+            WsmNamespaces::WS_ADDRESSING, "RelatesTo", relto, true);
+        if (addr != WSM_ADDRESS_ANONYMOUS ||
+            action != WSM_ACTION_WSA_FAULT ||
+            mid != messageId ||
+            relto != relatesTo)
+            throw Exception("Invalid header");
+
+        reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Header");
+        reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Body");
+        reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Fault");
+        reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Code");
+        String code, reason;
+        reader.getElementStringValue(
+            WsmNamespaces::SOAP_ENVELOPE, "Value", code, true);
+        reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Code");
+        reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Reason");
+        reader.getElementStringValue(
+            WsmNamespaces::SOAP_ENVELOPE, "Text", reason, true);
+        if (code != String(WsmNamespaces::supportedNamespaces[
+               WsmNamespaces::SOAP_ENVELOPE].localName) + ":MustUnderstand" ||
+            reason != "Header not understood.")
+            throw Exception("Invalid Soap fault");
+
+        reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Reason");
+        reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Fault");
+        reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Body");
+        reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+    }
+    
+    // Test Wsm fault.
+    {
+        const char expectedHttpHeader[] = 
+            "HTTP/1.1 500 Internal Server Error\r\nContent-Type: "
+            "application/soap+xml;charset=UTF-8\r\ncontent-length: "
+            "0000000000\r\nSOAPAction: "
+            "http://schemas.dmtf.org/wbem/wsman/1/wsman/fault\r\n\r\n";
+
+        WsmFault wsmFault(WsmFault::wsman_AccessDenied, "Whatever reason",
+            ContentLanguageList(), "Whatever fault detail");
+
+        Uint32 httpHeaderSize;
+        Buffer out = WsmWriter::formatWsmFault(
+            wsmFault, messageId, relatesTo, HTTP_METHOD__POST, httpHeaderSize);
+
+        char* ptr = (char*) out.getData();
+        if (strncmp(ptr, expectedHttpHeader, 
+                    sizeof(expectedHttpHeader)-1) != 0)
+            throw Exception("HTTP header incorrect");
+        ptr += sizeof(expectedHttpHeader)-1;
+
+        WsmReader reader(ptr);
+        const char* xmlVersion = 0;
+        const char* xmlEncoding = 0;
+        reader.getXmlDeclaration(xmlVersion, xmlEncoding);
+        if (strcmp(xmlVersion, "1.0") != 0 || 
+            strcmp(xmlEncoding, "utf-8") != 0)
+            throw Exception("XML version or encoding incorrect");
+
+        XmlEntry entry;
+        reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+        reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Header");
+
+        String addr, action, mid, relto;
+        reader.getElementStringValue(
+            WsmNamespaces::WS_ADDRESSING, "To", addr, true);
+        reader.getElementStringValue(
+            WsmNamespaces::WS_ADDRESSING, "Action", action, true);
+        reader.getElementStringValue(
+            WsmNamespaces::WS_ADDRESSING, "MessageID", mid, true);
+        reader.getElementStringValue(
+            WsmNamespaces::WS_ADDRESSING, "RelatesTo", relto, true);
+        if (addr != WSM_ADDRESS_ANONYMOUS ||
+            action != WSM_ACTION_WSMAN_FAULT ||
+            mid != messageId ||
+            relto != relatesTo)
+            throw Exception("Invalid header");
+
+        reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Header");
+        reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Body");
+        reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Fault");
+        reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Code");
+        String code, subcode, reason, detail;
+        reader.getElementStringValue(
+            WsmNamespaces::SOAP_ENVELOPE, "Value", code, true);
+        reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Subcode");
+        reader.getElementStringValue(
+            WsmNamespaces::SOAP_ENVELOPE, "Value", subcode, true);
+        reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Subcode");
+        reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Code");
+        reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Reason");
+        reader.getElementStringValue(
+            WsmNamespaces::SOAP_ENVELOPE, "Text", reason, true);
+        reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Reason");
+        reader.expectStartTag(entry, WsmNamespaces::SOAP_ENVELOPE, "Detail");
+        reader.getElementStringValue(
+            WsmNamespaces::WS_MAN, "FaultDetail", detail, true);
+        reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Detail");
+
+        if (code != String(WsmNamespaces::supportedNamespaces[
+               WsmNamespaces::SOAP_ENVELOPE].localName) + ":Sender" ||
+            subcode != String(WsmNamespaces::supportedNamespaces[
+               WsmNamespaces::WS_MAN].localName) + ":AccessDenied" ||
+            reason != "Whatever reason" ||
+            detail != "Whatever fault detail")
+            throw Exception("Invalid Wsm fault");
+
+        reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Fault");
+        reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Body");
+        reader.expectEndTag(WsmNamespaces::SOAP_ENVELOPE, "Envelope");
+   }
+}
+
+int main(int argc, char** argv)
+{
+    verbose = getenv("PEGASUS_TEST_VERBOSE") ? true : false;
+
+    try
+    {
+        if (verbose)
+            cout << "Testing instances." << endl;
+        _testInstances();
+
+        if (verbose)
+            cout << "Testing response formatting." << endl;
+        _testResponseFormatting();
+        
+        if (verbose)
+            cout << "Testing fault formatting." << endl;
+        _testFaultFormatting();
+    }
+
+    catch(Exception& e)
+    {
+        cerr << "Error: " << e.getMessage() << endl;
+        exit(1);
+    }
+
+    cout << argv[0] << " +++++ passed all tests" << endl;
+
+    return 0;
+}
diff --git a/src/Pegasus/WsmServer/tests/libraries.mak b/src/Pegasus/WsmServer/tests/libraries.mak
new file mode 100644 (file)
index 0000000..2537781
--- /dev/null
@@ -0,0 +1,37 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#// 
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//==============================================================================
+ROOT = ../../../../..
+
+LIBRARIES = \
+    pegwsmserver \
+    pegrepository \
+    pegconfig \
+    pegcommon
index 639cf891d57be6ce9df8f5332fdfd6aaf91ef3b4..d3de6c93b4cae3f794c53ef6cde598f6ce840296 100644 (file)
@@ -526,6 +526,7 @@ en:table {
         * @note  PGS00609:
         *    Substitution {0} is a line number (Uint32)
         *    Substitution {1} is a message
+        *    This message is no longer used as of version 2.8.0
         */
         Common.XmlParser.TOO_MANY_ATTRIBUTES:string {"PGS00609: Too many attributes on line {0}.  The XML parser handles a maximum of 10. {1}"}
 
@@ -579,6 +580,13 @@ en:table {
         */
         Common.XmlParser.SEMANTIC_ERROR:string {"PGS00616: Semantic error on line {0}. {1}"}
 
+        /**
+        * @note  PGS00617:
+        *    Substitution {0} is a line number (Uint32)
+        *    Substitution {1} is a message
+        */
+        Common.XmlParser.UNDECLARED_NAMESPACE:string {"PGS00617: Undeclared namespace on line {0}. {1}"}
+
 
         // ==========================================================
         // Messages for Repository InheritanceTree
@@ -6789,6 +6797,229 @@ CIM server listening on HTTPS port {0}."}
         */
         Common.TLS.COULD_NOT_LINK_SOCKET:string {"PGS19801: Could not link socket to SSL Connection."}
 
+
+        // ==========================================================
+        // Messages for WsmReader
+        //  Please use message prefix "PGS20000 - PGS20199"
+        // ==========================================================
+
+        /**
+        * @note PGS20000:
+        *    Substitution {0} is the name of the expected element (string)
+        *    Substitution {1} is the namespace URI of the expected element (string)
+        *    This error is for a missing XML Start-Tag
+        */
+        WsmServer.WsmReader.EXPECTED_OPEN:string {"PGS20000: Expecting a start tag for ''{0}'' element in namespace ''{1}''."}
+
+        /**
+        * @note PGS20001:
+        *    Substitution {0} is the name of the expected element (string)
+        *    Substitution {1} is the namespace URI of the expected element (string)
+        *    This error is for a missing XML End-Tag
+        */
+        WsmServer.WsmReader.EXPECTED_CLOSE:string {"PGS20001: Expecting an end tag for ''{0}'' element in namespace ''{1}''."}
+
+        /**
+        * @note PGS20002:
+        *    Substitution {0} is the name of the expected element (string)
+        *    Substitution {1} is the namespace URI of the expected element (string)
+        *    This error is for a missing XML Start-Tag or Empty-Tag
+        */
+        WsmServer.WsmReader.EXPECTED_OPENCLOSE:string {"PGS20002: Expecting a start tag or an empty tag for ''{0}'' element in namespace ''{1}''."}
+
+        WsmServer.WsmReader.LOCALE_NOT_ENSURED:string {"PGS20003: Translation of responses to a specified locale cannot be ensured."}
+
+        /**
+        * @note PGS20004:
+        *    Substitution {0} is an XML element name (string)
+        */
+        WsmServer.WsmReader.DUPLICATE_SOAP_HEADER:string {"PGS20004: Request contains multiple {0} SOAP Header elements."}
+
+        /**
+        * @note PGS20005:
+        *    Substitution {0} is a string value that could not be converted to a positive integer
+        */
+        WsmServer.WsmReader.INVALID_MAXENVELOPESIZE_VALUE:string {"PGS20005: The MaxEnvelopeSize value ''{0}'' is not a valid positive integer."}
+
+        /**
+        * @note PGS20006:
+        *    Substitution {0} is the name of an XML element (a string)
+        *    Substitution {1} is the name of an XML attribute (a string)
+        */
+        WsmServer.WsmReader.MISSING_ATTRIBUTE:string {"PGS20006: The attribute {0}.{1} is missing."}
+
+        /**
+        * @note PGS20007:
+        */
+        WsmServer.WsmReader.EXPECTED_INSTANCE_ELEMENT:string {"PGS20007: Expecting an instance element."}
+
+        /**
+        * @note PGS20008:
+        */
+        WsmServer.WsmReader.NULL_ARRAY_ELEMENTS:string {"PGS20008: Setting array elements to null is not supported."}
+
+        /**
+        * @note PGS20009:
+        *    Substitution {0} is the name of a CIM property (a string)
+        */
+        WsmServer.WsmReader.MISSING_PROPERTY_VALUE:string {"PGS20009: No value specified for non-null property {0}."}
+
+        /**
+        * @note PGS20010:
+        *    Substitution {0} is the value of MaxEnvelopeSize (integer)
+        *    Substitution {1} is the minimum allowable value of MaxEnvelopeSize (integer)
+        */
+        WsmServer.WsmReader.MAXENVELOPESIZE_TOO_SMALL:string {"PGS20010: The MaxEnvelopeSize {0} is less than minimum allowable value of {1}."}
+
+
+        // ==========================================================
+        // Messages for WsmRequestDecoder
+        //  Please use message prefix "PGS20200 - PGS20399"
+        // ==========================================================
+
+        /**
+        * @note PGS20200:
+        *    Do not translate the word 'Host' since it is an HTTP header
+        */
+        WsmServer.WsmRequestDecoder.MISSING_HOST_HEADER:string {"PGS20200: HTTP request message lacks a Host header field."}
+
+        /**
+        * @note PGS20201:
+        *    Do not translate the word 'Content-Type' since it is an HTTP tag
+        */
+        WsmServer.WsmRequestDecoder.CONTENTTYPE_SYNTAX_ERROR:string {"PGS20201: HTTP Content-Type header error."}
+
+        WsmServer.WsmRequestDecoder.INVALID_UTF8_CHARACTER:string {"PGS20202: A UTF-8 character in the WS-Management request is not valid."}
+
+        /**
+        * @note PGS20203:
+        *    Substitution {0} is the name of a SOAP header element (string)
+        */
+        WsmServer.WsmRequestDecoder.MISSING_HEADER:string {"PGS20203: Required SOAP header ''{0}'' was not specified."}
+
+        /**
+        * @note PGS20204:
+        *    Substitution {0} is the value of an HTTP header (string)
+        *    Substitution {1} is the value of a SOAP header element (string)
+        *    Do not translate the word 'SOAPAction' since it is an HTTP tag
+        *    Do not translate the word 'wsa:Action' since it is a SOAP header element name
+        */
+        WsmServer.WsmRequestDecoder.SOAPACTION_HEADER_MISMATCH:string {"PGS20204: The HTTP SOAPAction header value ''{0}'' does not match the wsa:Action value ''{1}''."}
+
+        WsmServer.WsmRequestDecoder.REPLYTO_ADDRESS_NOT_ANONYMOUS:string {"PGS20205: Responses may only be delivered over the same connection on which the request arrives."}
+
+        WsmServer.WsmRequestDecoder.FAULTTO_ADDRESS_NOT_ANONYMOUS:string {"PGS20206: Faults may only be delivered over the same connection on which the request arrives."}
+
+        /**
+        * @note PGS20207:
+        *    Substitution {0} is the value of a SOAP header element (string)
+        *    Do not translate the word 'wsa:Action' since it is a SOAP header element name
+        */
+        WsmServer.WsmRequestDecoder.ACTION_NOT_SUPPORTED:string {"PGS20207: The wsa:Action value ''{0}'' is not supported."}
+
+
+        // ==========================================================
+        // Messages for WsmResponseEncoder
+        //  Please use message prefix "PGS20400 - PGS20599"
+        // ==========================================================
+
+        WsmServer.WsmResponseEncoder.OUT_OF_MEMORY:string {"PGS20400: A system error occurred. Retry the WS-Management operation at a later time."}
+
+        WsmServer.WsmResponseEncoder.FAULT_MAX_ENV_SIZE_EXCEEDED:string {"PGS20401: Fault response could not be encoded within requested envelope size limits."}
+
+        WsmServer.WsmResponseEncoder.UNREPORTABLE_SUCCESS:string {"PGS20402: Success response could not be encoded within requested envelope size limits."}
+
+
+        // ==========================================================
+        // Messages for WsmToCimRequestMapper
+        //  Please use message prefix "PGS20600 - PGS20799"
+        // ==========================================================
+
+        /**
+        * @note PGS20600:
+        *    Substitution {0} is a selector name (string)
+        */
+        WsmServer.WsmToCimRequestMapper.SELECTOR_TYPE_MISMATCH:string {"PGS20600: Selector ''{0}'' is not of the correct type."}
+
+        /**
+        * @note PGS20601:
+        *    Substitution {0} is a selector value (string)
+        *    Substitution {1} is a selector name (string)
+        */
+        WsmServer.WsmToCimRequestMapper.INVALID_SELECTOR_VALUE:string {"PGS20601: The value ''{0}'' is not valid for selector ''{1}''."}
+
+        /**
+        * @note PGS20602:
+        *    Substitution {0} is a selector name (string)
+        *    Substitution {1} is a CIM class name (string)
+        *    Substitution {2} is a CIM namespace name (string)
+        */
+        WsmServer.WsmToCimRequestMapper.UNEXPECTED_SELECTOR:string {"PGS20602: Selector ''{0}'' is not expected for a resource of class {1} in namespace {2}."}
+
+        /**
+        * @note PGS20603:
+        *    Do not translate the word 'ResourceURI' since it is a SOAP header element name
+        */
+        WsmServer.WsmToCimRequestMapper.ALLCLASSES_URI_NOT_ALLOWED:string {"PGS20603: The ''all classes'' ResourceURI cannot be used with this operation."}
+
+        /**
+        * @note PGS20604:
+        *    Substitution {0} is a ResourceURI value (string)
+        *    Do not translate the word 'ResourceURI' since it is a SOAP header element name
+        */
+        WsmServer.WsmToCimRequestMapper.UNRECOGNIZED_RESOURCEURI:string {"PGS20604: Unrecognized ResourceURI value: {0}."}
+
+        /**
+        * @note PGS20605:
+        *        Substitution {0} is a property name (a string)
+        */
+        WsmServer.WsmToCimRequestMapper.NO_SUCH_PROPERTY:string { "PGS20604: The {0} property does not exist."}
+
+        /**
+        * @note  PGS20606:
+        *        Substitution {0} is a value (a string)
+        */
+        WsmServer.WsmToCimRequestMapper.INVALID_BOOLEAN_VALUE:string {"PGS20606: The boolean value ''{0}'' is not valid."}
+
+        WsmServer.WsmToCimRequestMapper.INVALID_UI_VALUE:string {"PGS20607: The unsigned integer value ''{0}'' is not valid."}
+
+        WsmServer.WsmToCimRequestMapper.INVALID_SI_VALUE:string {"PGS20608: The signed integer value ''{0}'' is not valid."}
+
+        WsmServer.WsmToCimRequestMapper.INVALID_RN_VALUE:string {"PGS20609: The real number value ''{0}'' is not valid."}
+
+        WsmServer.WsmToCimRequestMapper.INVALID_CHAR16_VALUE:string {"PGS20610: The char16 value ''{0}'' is not valid."}
+
+        WsmServer.WsmToCimRequestMapper.INVALID_DT_VALUE:string {"PGS20611: The datetime value ''{0}'' is not valid."}
+
+        /**
+        * @note  PGS20612:
+        *        Substitution {0} is a type
+        *        Substitution {1} is a value (a string)
+        */
+        WsmServer.WsmToCimRequestMapper.VALUE_OUT_OF_RANGE:string {"PGS20612: The {0} value ''{1}'' is out of range."}
+
+        /**
+        * @note  PGS20613:
+        *        Substitution {0} is an EPR address
+        */
+        WsmServer.WsmToCimRequestMapper.INVALID_EPR_ADDRESS:string {"PGS20613: The EPR address ''{0}'' is not valid."}
+
+        // ==========================================================
+        // Messages for WsmFault
+        //  Please use message prefix "PGS20800 - PGS20999"
+        // ==========================================================
+
+        WsmServer.WsmFault.SOAP_HEADER_NOT_UNDERSTOOD:string {"PGS20800: Header not understood."}
+
+
+        // ==========================================================
+        // Messages for CimToWsmResponseMapper
+        //  Please use message prefix "PGS21000 - PGS21199"
+        // ==========================================================
+
+        WsmServer.CimToWsmResponseMapper.EMBEDDED_CLASS_NOT_SUPPORTED:string {"PGS21000: Embedded class objects in WS-Management responses are not supported."}
+
+
 // ==============================================================================
 // END OF RESOURCE BUNDLE
 // DO NOT ADD MESSAGES AFTER THE FOLLOWING '}'
index c2abe5e5af9cda3846d6aa2a3060964996f995d0..ff84c5a8b587dbfc254b71b1de6fd3e081657bd8 100644 (file)
@@ -484,19 +484,20 @@ void PG_TestPropertyTypes::createInstance(
 //    }
 
     // create the CIMObjectPath to return
-    CIMKeyBinding kb1(
+    Array<CIMKeyBinding> keys;
+    keys.append(CIMKeyBinding(
         instanceObject.getProperty(propIndex).getName(),
         instanceObject.getProperty(propIndex).getValue().toString(),
-        CIMKeyBinding::NUMERIC);
-    CIMKeyBinding kb2(
+        CIMKeyBinding::NUMERIC));
+    keys.append(CIMKeyBinding(
         "CreationClassName",
         "PG_TestPropertyTypes",
-        CIMKeyBinding::STRING);
-    CIMObjectPath returnReference(instanceReference);
-    Array<CIMKeyBinding> keys;
-        keys.append(kb1);
-        keys.append(kb2);
-        returnReference.setKeyBindings(keys);
+        CIMKeyBinding::STRING));
+    CIMObjectPath returnReference(
+        String::EMPTY,
+        CIMNamespaceName(),
+        instanceReference.getClassName(),
+        keys);
 
     // ensure the property values are valid
     _testPropertyTypesValue(instanceObject);
index b65c839016d40d666626c716e54cd7f4320a0c3b..5cfb0ab943484ab318c16e2dd608e2bac32831d4 100644 (file)
@@ -86,6 +86,10 @@ ifeq ($(PEGASUS_ENABLE_SLP),true)
     LIBRARIES += pegslp
 endif
 
+ifeq ($(PEGASUS_ENABLE_PROTOCOL_WSMAN),true)
+    LIBRARIES += pegwsmserver
+endif
+
 LIBRARIES += \
     pegprovidermanager \
     pegpmservice \
index ad7f9e37c8e7b3e4240e2bbaf91b54f2a15bcf0a..a1408d5497d1021aa494850946bcc859633b1212 100644 (file)
@@ -38,6 +38,10 @@ include $(ROOT)/test/config.mak
 DIRS = cimv2 \
        static
 
+ifeq ($(PEGASUS_ENABLE_PROTOCOL_WSMAN),true)
+    DIRS += wsman
+endif
+
 LOADDIRS = \
    cimv2/Load \
    static/Load 
diff --git a/test/wetest/wsman/Create/Create_InvalidClass01.xml b/test/wetest/wsman/Create/Create_InvalidClass01.xml
new file mode 100644 (file)
index 0000000..a289415
--- /dev/null
@@ -0,0 +1,37 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header>
+  <a:To>http://localhost/wsman</a:To>
+  <!-- Specifies an invalid classname -->
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_NoSuchClass</w:ResourceURI>
+ <a:ReplyTo>
+  <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+ </a:ReplyTo>
+ <a:FaultTo>
+  <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+ </a:FaultTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action>
+  <a:MessageID>uuid:00000000-0000-0000-0003-000000000003</a:MessageID>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+  <w:Selector Name="__cimnamespace">test/static</w:Selector>
+  </w:SelectorSet>
+</s:Header>
+<s:Body>
+    <p:PG_TestPropertyTypes xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+    <p:InstanceId>1</p:InstanceId>
+    <p:PropertyString>created_instance1</p:PropertyString>
+    <p:PropertyUint8>180</p:PropertyUint8>
+    <p:PropertyUint16>1600</p:PropertyUint16>
+    <p:PropertyUint32>13200</p:PropertyUint32>
+    <p:PropertyUint64>16400</p:PropertyUint64>
+    <p:PropertySint8>-110</p:PropertySint8>
+    <p:PropertySint16>-1600</p:PropertySint16>
+    <p:PropertySint32>-13200</p:PropertySint32>
+    <p:PropertySint64>-16400</p:PropertySint64>
+    <p:PropertyBoolean>true</p:PropertyBoolean>
+    <p:PropertyReal32>1.3245</p:PropertyReal32>
+    <p:PropertyReal64>1.6445</p:PropertyReal64>
+    <p:PropertyDateTime>20010515104354.000000:000</p:PropertyDateTime>
+    </p:PG_TestPropertyTypes>
+</s:Body>
+</s:Envelope>
diff --git a/test/wetest/wsman/Create/Create_InvalidClass01rspgood.xml b/test/wetest/wsman/Create/Create_InvalidClass01rspgood.xml
new file mode 100644 (file)
index 0000000..032313d
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001567\r
+SOAPAction: http://schemas.xmlsoap.org/ws/2004/08/addressing/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0003-000000000003
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsa:DestinationUnreachable
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+CIM_ERR_NOT_FOUND: PG_NoSuchClass
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Create/Create_InvalidKeyName01.xml b/test/wetest/wsman/Create/Create_InvalidKeyName01.xml
new file mode 100644 (file)
index 0000000..2c74d5a
--- /dev/null
@@ -0,0 +1,34 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+ <a:ReplyTo>
+  <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+ </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action>
+  <a:MessageID>uuid:00000000-0000-0000-0003-000000000004</a:MessageID>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+  <w:Selector Name="__cimnamespace">test/static</w:Selector>
+  </w:SelectorSet>
+</s:Header>
+<s:Body>
+    <p:PG_TestPropertyTypes xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+    <!-- Specifies an invalid key property -->
+    <p:NoSuchPropertyInstanceId>1</p:NoSuchPropertyInstanceId>
+    <p:PropertyString>created_instance1</p:PropertyString>
+    <p:PropertyUint8>180</p:PropertyUint8>
+    <p:PropertyUint16>1600</p:PropertyUint16>
+    <p:PropertyUint32>13200</p:PropertyUint32>
+    <p:PropertyUint64>16400</p:PropertyUint64>
+    <p:PropertySint8>-110</p:PropertySint8>
+    <p:PropertySint16>-1600</p:PropertySint16>
+    <p:PropertySint32>-13200</p:PropertySint32>
+    <p:PropertySint64>-16400</p:PropertySint64>
+    <p:PropertyBoolean>true</p:PropertyBoolean>
+    <p:PropertyReal32>1.3245</p:PropertyReal32>
+    <p:PropertyReal64>1.6445</p:PropertyReal64>
+    <p:PropertyDateTime>20010515104354.000000:000</p:PropertyDateTime>
+    </p:PG_TestPropertyTypes>
+</s:Body>
+</s:Envelope>
diff --git a/test/wetest/wsman/Create/Create_InvalidKeyName01rspgood.xml b/test/wetest/wsman/Create/Create_InvalidKeyName01rspgood.xml
new file mode 100644 (file)
index 0000000..a75ce7b
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001582\r
+SOAPAction: http://schemas.dmtf.org/wbem/wsman/1/wsman/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0003-000000000004
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsman:SchemaValidationError
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+The NoSuchPropertyInstanceId property does not exist.
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Create/Create_InvalidNamespace01.xml b/test/wetest/wsman/Create/Create_InvalidNamespace01.xml
new file mode 100644 (file)
index 0000000..542025a
--- /dev/null
@@ -0,0 +1,34 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+ <a:ReplyTo>
+  <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+ </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action>
+  <a:MessageID>uuid:00000000-0000-0000-0003-000000000002</a:MessageID>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+  <!-- Specifies an invalid namespace -->
+  <w:Selector Name="__cimnamespace">test/nosuchnamespace</w:Selector>
+  </w:SelectorSet>
+</s:Header>
+<s:Body>
+    <p:PG_TestPropertyTypes xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+    <p:InstanceId>1</p:InstanceId>
+    <p:PropertyString>created_instance1</p:PropertyString>
+    <p:PropertyUint8>180</p:PropertyUint8>
+    <p:PropertyUint16>1600</p:PropertyUint16>
+    <p:PropertyUint32>13200</p:PropertyUint32>
+    <p:PropertyUint64>16400</p:PropertyUint64>
+    <p:PropertySint8>-110</p:PropertySint8>
+    <p:PropertySint16>-1600</p:PropertySint16>
+    <p:PropertySint32>-13200</p:PropertySint32>
+    <p:PropertySint64>-16400</p:PropertySint64>
+    <p:PropertyBoolean>true</p:PropertyBoolean>
+    <p:PropertyReal32>1.3245</p:PropertyReal32>
+    <p:PropertyReal64>1.6445</p:PropertyReal64>
+    <p:PropertyDateTime>20010515104354.000000:000</p:PropertyDateTime>
+    </p:PG_TestPropertyTypes>
+</s:Body>
+</s:Envelope>
diff --git a/test/wetest/wsman/Create/Create_InvalidNamespace01rspgood.xml b/test/wetest/wsman/Create/Create_InvalidNamespace01rspgood.xml
new file mode 100644 (file)
index 0000000..6e8ea6b
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001581\r
+SOAPAction: http://schemas.xmlsoap.org/ws/2004/08/addressing/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0003-000000000002
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsa:DestinationUnreachable
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+CIM_ERR_INVALID_NAMESPACE: test/nosuchnamespace
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Create/Create_InvalidPropertyName01.xml b/test/wetest/wsman/Create/Create_InvalidPropertyName01.xml
new file mode 100644 (file)
index 0000000..2aacf62
--- /dev/null
@@ -0,0 +1,34 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+ <a:ReplyTo>
+  <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+ </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action>
+  <a:MessageID>uuid:00000000-0000-0000-0003-000000000005</a:MessageID>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+  <w:Selector Name="__cimnamespace">test/static</w:Selector>
+  </w:SelectorSet>
+</s:Header>
+<s:Body>
+    <p:PG_TestPropertyTypes xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+    <p:InstanceId>1</p:InstanceId>
+    <p:PropertyString>created_instance1</p:PropertyString>
+    <p:PropertyUint8>180</p:PropertyUint8>
+    <p:PropertyUint16>1600</p:PropertyUint16>
+    <p:PropertyUint32>13200</p:PropertyUint32>
+    <!-- Specifies an invalid property -->
+    <p:NonexistentPropertyUint64>16400</p:NonexistentPropertyUint64>
+    <p:PropertySint8>-110</p:PropertySint8>
+    <p:PropertySint16>-1600</p:PropertySint16>
+    <p:PropertySint32>-13200</p:PropertySint32>
+    <p:PropertySint64>-16400</p:PropertySint64>
+    <p:PropertyBoolean>true</p:PropertyBoolean>
+    <p:PropertyReal32>1.3245</p:PropertyReal32>
+    <p:PropertyReal64>1.6445</p:PropertyReal64>
+    <p:PropertyDateTime>20010515104354.000000:000</p:PropertyDateTime>
+    </p:PG_TestPropertyTypes>
+</s:Body>
+</s:Envelope>
diff --git a/test/wetest/wsman/Create/Create_InvalidPropertyName01rspgood.xml b/test/wetest/wsman/Create/Create_InvalidPropertyName01rspgood.xml
new file mode 100644 (file)
index 0000000..8f72985
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001583\r
+SOAPAction: http://schemas.dmtf.org/wbem/wsman/1/wsman/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0003-000000000005
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsman:SchemaValidationError
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+The NonexistentPropertyUint64 property does not exist.
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Create/Create_InvalidPropertyValue01.xml b/test/wetest/wsman/Create/Create_InvalidPropertyValue01.xml
new file mode 100644 (file)
index 0000000..c30217e
--- /dev/null
@@ -0,0 +1,34 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+ <a:ReplyTo>
+  <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+ </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action>
+  <a:MessageID>uuid:00000000-0000-0000-0003-000000000006</a:MessageID>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+  <w:Selector Name="__cimnamespace">test/static</w:Selector>
+  </w:SelectorSet>
+</s:Header>
+<s:Body>
+    <p:PG_TestPropertyTypes xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+    <p:InstanceId>10</p:InstanceId>
+    <p:PropertyString>created_instance1</p:PropertyString>
+    <!-- Specifies invalid property value -->
+    <p:PropertyUint8>255</p:PropertyUint8>
+    <p:PropertyUint16>1600</p:PropertyUint16>
+    <p:PropertyUint32>13200</p:PropertyUint32>
+    <p:PropertyUint64>16400</p:PropertyUint64>
+    <p:PropertySint8>-110</p:PropertySint8>
+    <p:PropertySint16>-1600</p:PropertySint16>
+    <p:PropertySint32>-13200</p:PropertySint32>
+    <p:PropertySint64>-16400</p:PropertySint64>
+    <p:PropertyBoolean>true</p:PropertyBoolean>
+    <p:PropertyReal32>1.3245</p:PropertyReal32>
+    <p:PropertyReal64>1.6445</p:PropertyReal64>
+    <p:PropertyDateTime>20010515104354.000000:000</p:PropertyDateTime>
+    </p:PG_TestPropertyTypes>
+</s:Body>
+</s:Envelope>
diff --git a/test/wetest/wsman/Create/Create_InvalidPropertyValue01rspgood.xml b/test/wetest/wsman/Create/Create_InvalidPropertyValue01rspgood.xml
new file mode 100644 (file)
index 0000000..abc7aa5
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001549\r
+SOAPAction: http://schemas.dmtf.org/wbem/wsman/1/wsman/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0003-000000000006
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsman:InvalidParameter
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+CIM_ERR_INVALID_PARAMETER
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Create/Create_Success01.xml b/test/wetest/wsman/Create/Create_Success01.xml
new file mode 100644 (file)
index 0000000..a9cb8bf
--- /dev/null
@@ -0,0 +1,33 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+ <a:ReplyTo>
+  <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+ </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action>
+  <a:MessageID>uuid:00000000-0000-0000-0003-000000000001</a:MessageID>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+  <w:Selector Name="__cimnamespace">test/static</w:Selector>
+  </w:SelectorSet>
+</s:Header>
+<s:Body>
+    <p:PG_TestPropertyTypes xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+    <p:InstanceId>1</p:InstanceId>
+    <p:PropertyString>created_instance1</p:PropertyString>
+    <p:PropertyUint8>180</p:PropertyUint8>
+    <p:PropertyUint16>1600</p:PropertyUint16>
+    <p:PropertyUint32>13200</p:PropertyUint32>
+    <p:PropertyUint64>16400</p:PropertyUint64>
+    <p:PropertySint8>-110</p:PropertySint8>
+    <p:PropertySint16>-1600</p:PropertySint16>
+    <p:PropertySint32>-13200</p:PropertySint32>
+    <p:PropertySint64>-16400</p:PropertySint64>
+    <p:PropertyBoolean>true</p:PropertyBoolean>
+    <p:PropertyReal32>1.3245</p:PropertyReal32>
+    <p:PropertyReal64>1.6445</p:PropertyReal64>
+    <p:PropertyDateTime>20010515104354.000000:000</p:PropertyDateTime>
+    </p:PG_TestPropertyTypes>
+</s:Body>
+</s:Envelope>
diff --git a/test/wetest/wsman/Create/Create_Success01rspgood.xml b/test/wetest/wsman/Create/Create_Success01rspgood.xml
new file mode 100644 (file)
index 0000000..79bd04c
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/09/transfer/CreateResponse
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0003-000000000001
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<wxf:ResourceCreated>
+<wsa:Address>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:Address>
+<wsa:ReferenceParameters>
+<wsman:ResourceURI>
+http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes
+</wsman:ResourceURI>
+<wsman:SelectorSet>
+<wsman:Selector Name="CreationClassName">
+PG_TestPropertyTypes
+</wsman:Selector>
+<wsman:Selector Name="InstanceId">
+1
+</wsman:Selector>
+</wsman:SelectorSet>
+</wsa:ReferenceParameters>
+</wxf:ResourceCreated>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Create/Makefile b/test/wetest/wsman/Create/Makefile
new file mode 100644 (file)
index 0000000..7f078b1
--- /dev/null
@@ -0,0 +1,44 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#// 
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//=============================================================================
+
+ROOT = ../../../..
+include $(ROOT)/mak/config.mak
+include $(ROOT)/test/config.mak
+
+XMLSCRIPTS = \
+    Create_InvalidClass01 \
+    Create_InvalidKeyName01 \
+    Create_InvalidNamespace01 \
+    Create_InvalidPropertyName01 \
+    Create_InvalidPropertyValue01 \
+    Create_Success01
+
+include $(ROOT)/test/configend.mak
diff --git a/test/wetest/wsman/Delete/Delete_InvalidKeyName01.xml b/test/wetest/wsman/Delete/Delete_InvalidKeyName01.xml
new file mode 100644 (file)
index 0000000..c88011a
--- /dev/null
@@ -0,0 +1,19 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+ <a:ReplyTo>
+  <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action>
+  <a:MessageID>uuid:00000000-0000-0000-0006-000000000002</a:MessageID>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+  <!-- Specifies an invalid property name -->
+  <w:Selector Name="NoSuchProperty">2</w:Selector>
+  <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  <w:Selector Name="__cimnamespace">test/static</w:Selector>
+  </w:SelectorSet>
+  </s:Header>
+  <s:Body></s:Body>
+</s:Envelope>
diff --git a/test/wetest/wsman/Delete/Delete_InvalidKeyName01rspgood.xml b/test/wetest/wsman/Delete/Delete_InvalidKeyName01rspgood.xml
new file mode 100644 (file)
index 0000000..d6324bd
--- /dev/null
@@ -0,0 +1,46 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001784\r
+SOAPAction: http://schemas.dmtf.org/wbem/wsman/1/wsman/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0006-000000000002
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsman:InvalidSelectors
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+Selector &quot;NoSuchProperty&quot; is not expected for a resource of class PG_TestPropertyTypes in namespace test/static.
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+<SOAP-ENV:Detail>
+<wsman:FaultDetail>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/UnexpectedSelectors
+</wsman:FaultDetail>
+</SOAP-ENV:Detail>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Delete/Delete_NotFound01.xml b/test/wetest/wsman/Delete/Delete_NotFound01.xml
new file mode 100644 (file)
index 0000000..f0a44d8
--- /dev/null
@@ -0,0 +1,19 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+ <a:ReplyTo>
+  <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action>
+  <a:MessageID>uuid:00000000-0000-0000-0006-000000000003</a:MessageID>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+  <!-- Specifies an non-existent key property value -->
+  <w:Selector Name="InstanceId">999</w:Selector>
+  <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  <w:Selector Name="__cimnamespace">test/static</w:Selector>
+  </w:SelectorSet>
+  </s:Header>
+  <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/Delete/Delete_NotFound01rspgood.xml b/test/wetest/wsman/Delete/Delete_NotFound01rspgood.xml
new file mode 100644 (file)
index 0000000..7a21bd0
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001551\r
+SOAPAction: http://schemas.xmlsoap.org/ws/2004/08/addressing/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0006-000000000003
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsa:DestinationUnreachable
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+CIM_ERR_NOT_FOUND
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Delete/Delete_Success01.xml b/test/wetest/wsman/Delete/Delete_Success01.xml
new file mode 100644 (file)
index 0000000..377bb56
--- /dev/null
@@ -0,0 +1,18 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+ <a:ReplyTo>
+  <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action>
+  <a:MessageID>uuid:00000000-0000-0000-0006-000000000001</a:MessageID>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+  <w:Selector Name="InstanceId">2</w:Selector>
+  <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  <w:Selector Name="__cimnamespace">test/static</w:Selector>
+  </w:SelectorSet>
+  </s:Header>
+  <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/Delete/Delete_Success01rspgood.xml b/test/wetest/wsman/Delete/Delete_Success01rspgood.xml
new file mode 100644 (file)
index 0000000..9aedbb2
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/09/transfer/DeleteResponse
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0006-000000000001
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Delete/Makefile b/test/wetest/wsman/Delete/Makefile
new file mode 100644 (file)
index 0000000..9a649db
--- /dev/null
@@ -0,0 +1,41 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#// 
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//=============================================================================
+
+ROOT = ../../../..
+include $(ROOT)/mak/config.mak
+include $(ROOT)/test/config.mak
+
+XMLSCRIPTS = \
+    Delete_InvalidKeyName01 \
+    Delete_NotFound01 \
+    Delete_Success01
+
+include $(ROOT)/test/configend.mak
diff --git a/test/wetest/wsman/Get/Get_InvalidClass01.xml b/test/wetest/wsman/Get/Get_InvalidClass01.xml
new file mode 100644 (file)
index 0000000..dcff00e
--- /dev/null
@@ -0,0 +1,20 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header>
+  <a:To>http://localhost/wsman</a:To>
+  <!-- Specifies an invalid class name -->
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/NoSuchClass</w:ResourceURI>
+ <a:ReplyTo>
+  <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:MaxEnvelopeSize s:mustUnderstand="true">+153600</w:MaxEnvelopeSize>
+  <a:MessageID>uuid:00000000-0000-0000-0004-000000000003</a:MessageID>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+  <w:Selector Name="InstanceId">1</w:Selector>
+  <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  <w:Selector Name="__cimnamespace">test/static</w:Selector>
+  </w:SelectorSet>
+  </s:Header>
+  <s:Body></s:Body>
+</s:Envelope>
diff --git a/test/wetest/wsman/Get/Get_InvalidClass01rspgood.xml b/test/wetest/wsman/Get/Get_InvalidClass01rspgood.xml
new file mode 100644 (file)
index 0000000..ec54c77
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001564\r
+SOAPAction: http://schemas.xmlsoap.org/ws/2004/08/addressing/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0004-000000000003
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsa:DestinationUnreachable
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+CIM_ERR_NOT_FOUND: NoSuchClass
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Get/Get_InvalidKeyName01.xml b/test/wetest/wsman/Get/Get_InvalidKeyName01.xml
new file mode 100644 (file)
index 0000000..24196ec
--- /dev/null
@@ -0,0 +1,19 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+ <a:ReplyTo>
+  <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <a:MessageID>uuid:00000000-0000-0000-0004-000000000004</a:MessageID>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+  <!-- Specifies an invalid key preoperty name -->
+  <w:Selector Name="WrongKeyName">1</w:Selector>
+  <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  <w:Selector Name="__cimnamespace">test/static</w:Selector>
+  </w:SelectorSet>
+  </s:Header>
+  <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/Get/Get_InvalidKeyName01rspgood.xml b/test/wetest/wsman/Get/Get_InvalidKeyName01rspgood.xml
new file mode 100644 (file)
index 0000000..c31c50b
--- /dev/null
@@ -0,0 +1,46 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001782\r
+SOAPAction: http://schemas.dmtf.org/wbem/wsman/1/wsman/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0004-000000000004
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsman:InvalidSelectors
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+Selector &quot;WrongKeyName&quot; is not expected for a resource of class PG_TestPropertyTypes in namespace test/static.
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+<SOAP-ENV:Detail>
+<wsman:FaultDetail>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/UnexpectedSelectors
+</wsman:FaultDetail>
+</SOAP-ENV:Detail>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Get/Get_InvalidNamespace01.xml b/test/wetest/wsman/Get/Get_InvalidNamespace01.xml
new file mode 100644 (file)
index 0000000..c59c930
--- /dev/null
@@ -0,0 +1,19 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+ <a:ReplyTo>
+  <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <a:MessageID>uuid:00000000-0000-0000-0004-000000000002</a:MessageID>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+  <w:Selector Name="InstanceId">1</w:Selector>
+  <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  <!-- Specifies an invalid namespace name -->
+  <w:Selector Name="__cimnamespace">test/nonexistent</w:Selector>
+  </w:SelectorSet>
+  </s:Header>
+  <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/Get/Get_InvalidNamespace01rspgood.xml b/test/wetest/wsman/Get/Get_InvalidNamespace01rspgood.xml
new file mode 100644 (file)
index 0000000..e831f7d
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001577\r
+SOAPAction: http://schemas.xmlsoap.org/ws/2004/08/addressing/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0004-000000000002
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsa:DestinationUnreachable
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+CIM_ERR_INVALID_NAMESPACE: test/nonexistent
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Get/Get_NotFound01.xml b/test/wetest/wsman/Get/Get_NotFound01.xml
new file mode 100644 (file)
index 0000000..b9b7bcd
--- /dev/null
@@ -0,0 +1,19 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+ <a:ReplyTo>
+  <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <a:MessageID>uuid:00000000-0000-0000-0004-000000000005</a:MessageID>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+  <w:Selector Name="InstanceId">1</w:Selector>
+  <!-- Specifies an invalid class name -->
+  <w:Selector Name="CreationClassName">PG_NoSuchClass</w:Selector>
+  <w:Selector Name="__cimnamespace">test/static</w:Selector>
+  </w:SelectorSet>
+  </s:Header>
+  <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/Get/Get_NotFound01rspgood.xml b/test/wetest/wsman/Get/Get_NotFound01rspgood.xml
new file mode 100644 (file)
index 0000000..2f7792f
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001551\r
+SOAPAction: http://schemas.xmlsoap.org/ws/2004/08/addressing/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0004-000000000005
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsa:DestinationUnreachable
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+CIM_ERR_NOT_FOUND
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Get/Get_Success01.xml b/test/wetest/wsman/Get/Get_Success01.xml
new file mode 100644 (file)
index 0000000..dbbb05a
--- /dev/null
@@ -0,0 +1,20 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+ <a:ReplyTo>
+  <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <a:MessageID>uuid:00000000-0000-0000-0004-000000000001</a:MessageID>
+  <!-- Note: FragmentTransfer header is ignored -->
+  <w:FragmentTransfer>xpath expression</w:FragmentTransfer>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+  <w:Selector Name="InstanceId">1</w:Selector>
+  <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  <w:Selector Name="__cimnamespace">test/static</w:Selector>
+  </w:SelectorSet>
+  </s:Header>
+  <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/Get/Get_Success01rspgood.xml b/test/wetest/wsman/Get/Get_Success01rspgood.xml
new file mode 100644 (file)
index 0000000..f846c6d
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0004-000000000001
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<class:PG_TestPropertyTypes xmlns:class="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+<class:CreationClassName>
+PG_TestPropertyTypes
+</class:CreationClassName>
+<class:InstanceId>
+1
+</class:InstanceId>
+<class:PropertyString>
+PG_TestPropertyTypes_Instance1
+</class:PropertyString>
+<class:PropertyUint8>
+120
+</class:PropertyUint8>
+<class:PropertyUint16>
+1600
+</class:PropertyUint16>
+<class:PropertyUint32>
+3200
+</class:PropertyUint32>
+<class:PropertyUint64>
+6400
+</class:PropertyUint64>
+<class:PropertySint8>
+-120
+</class:PropertySint8>
+<class:PropertySint16>
+-1600
+</class:PropertySint16>
+<class:PropertySint32>
+-3200
+</class:PropertySint32>
+<class:PropertySint64>
+-6400
+</class:PropertySint64>
+<class:PropertyBoolean>
+true
+</class:PropertyBoolean>
+<class:PropertyReal32>
+1.1234567165374756e+00
+</class:PropertyReal32>
+<class:PropertyReal64>
+1.1234567890654321e+00
+</class:PropertyReal64>
+<class:PropertyDatetime>
+20010515104354.000000:000
+</class:PropertyDatetime>
+</class:PG_TestPropertyTypes>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Get/Makefile b/test/wetest/wsman/Get/Makefile
new file mode 100644 (file)
index 0000000..acecb94
--- /dev/null
@@ -0,0 +1,43 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#// 
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//=============================================================================
+
+ROOT = ../../../..
+include $(ROOT)/mak/config.mak
+include $(ROOT)/test/config.mak
+
+XMLSCRIPTS = \
+    Get_InvalidClass01 \
+    Get_InvalidKeyName01 \
+    Get_InvalidNamespace01 \
+    Get_NotFound01 \
+    Get_Success01
+
+include $(ROOT)/test/configend.mak
diff --git a/test/wetest/wsman/HttpHeader/ContentTypeCharsetUnsupported01.xml b/test/wetest/wsman/HttpHeader/ContentTypeCharsetUnsupported01.xml
new file mode 100644 (file)
index 0000000..3e3de90
--- /dev/null
@@ -0,0 +1,23 @@
+POST /wsman HTTP/1.1\r
+Host: \r
+Content-Type: application/soap+xml; charset=bogus\r
+Content-Length: 986\r
+\r
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0001-000000000001</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/ContentTypeCharsetUnsupported01rspgood.xml b/test/wetest/wsman/HttpHeader/ContentTypeCharsetUnsupported01rspgood.xml
new file mode 100644 (file)
index 0000000..58f7fc3
--- /dev/null
@@ -0,0 +1,40 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001538\r
+SOAPAction: http://schemas.dmtf.org/wbem/wsman/1/wsman/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsman:EncodingLimit
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Detail>
+<wsman:FaultDetail>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/CharacterSet
+</wsman:FaultDetail>
+</SOAP-ENV:Detail>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/ContentTypeMissing01.xml b/test/wetest/wsman/HttpHeader/ContentTypeMissing01.xml
new file mode 100644 (file)
index 0000000..c3679f9
--- /dev/null
@@ -0,0 +1,22 @@
+POST /wsman HTTP/1.1\r
+Host: \r
+Content-Length: 986\r
+\r
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0001-000000000002</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/ContentTypeMissing01rspgood.xml b/test/wetest/wsman/HttpHeader/ContentTypeMissing01rspgood.xml
new file mode 100644 (file)
index 0000000..19133c5
--- /dev/null
@@ -0,0 +1,3 @@
+HTTP/1.1 400 Bad Request\r
+PGErrorDetail: HTTP%20Content-Type%20header%20error.\r
+\r
diff --git a/test/wetest/wsman/HttpHeader/ContentTypeTextXml01.xml b/test/wetest/wsman/HttpHeader/ContentTypeTextXml01.xml
new file mode 100644 (file)
index 0000000..e0adb26
--- /dev/null
@@ -0,0 +1,23 @@
+POST /wsman HTTP/1.1\r
+Host: \r
+Content-Type: text/xml; charset=utf-8\r
+Content-Length: 986\r
+\r
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0001-000000000003</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/ContentTypeTextXml01rspgood.xml b/test/wetest/wsman/HttpHeader/ContentTypeTextXml01rspgood.xml
new file mode 100644 (file)
index 0000000..2df6daf
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0001-000000000003
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<class:PG_TestPropertyTypes xmlns:class="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+<class:CreationClassName>
+PG_TestPropertyTypes
+</class:CreationClassName>
+<class:InstanceId>
+1
+</class:InstanceId>
+<class:PropertyString>
+PG_TestPropertyTypes_Instance1
+</class:PropertyString>
+<class:PropertyUint8>
+120
+</class:PropertyUint8>
+<class:PropertyUint16>
+1600
+</class:PropertyUint16>
+<class:PropertyUint32>
+3200
+</class:PropertyUint32>
+<class:PropertyUint64>
+6400
+</class:PropertyUint64>
+<class:PropertySint8>
+-120
+</class:PropertySint8>
+<class:PropertySint16>
+-1600
+</class:PropertySint16>
+<class:PropertySint32>
+-3200
+</class:PropertySint32>
+<class:PropertySint64>
+-6400
+</class:PropertySint64>
+<class:PropertyBoolean>
+true
+</class:PropertyBoolean>
+<class:PropertyReal32>
+1.1234567165374756e+00
+</class:PropertyReal32>
+<class:PropertyReal64>
+1.1234567890654321e+00
+</class:PropertyReal64>
+<class:PropertyDatetime>
+20010515104354.000000:000
+</class:PropertyDatetime>
+</class:PG_TestPropertyTypes>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/ContentTypeUnparsable01.xml b/test/wetest/wsman/HttpHeader/ContentTypeUnparsable01.xml
new file mode 100644 (file)
index 0000000..ade77be
--- /dev/null
@@ -0,0 +1,23 @@
+POST /wsman HTTP/1.1\r
+Host: \r
+Content-Type: application/soap+xml; =utf-8\r
+Content-Length: 986\r
+\r
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0001-000000000004</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/ContentTypeUnparsable01rspgood.xml b/test/wetest/wsman/HttpHeader/ContentTypeUnparsable01rspgood.xml
new file mode 100644 (file)
index 0000000..19133c5
--- /dev/null
@@ -0,0 +1,3 @@
+HTTP/1.1 400 Bad Request\r
+PGErrorDetail: HTTP%20Content-Type%20header%20error.\r
+\r
diff --git a/test/wetest/wsman/HttpHeader/ContentTypeUnsupported01.xml b/test/wetest/wsman/HttpHeader/ContentTypeUnsupported01.xml
new file mode 100644 (file)
index 0000000..3a2567e
--- /dev/null
@@ -0,0 +1,24 @@
+POST /wsman HTTP/1.1\r
+Host: \r
+Content-Type: application/bogus; charset=utf-8\r
+Content-Length: 986\r
+SOAPAction: http://schemas.xmlsoap.org/ws/2004/09/transfer/Put\r
+\r
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0001-000000000005</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/ContentTypeUnsupported01rspgood.xml b/test/wetest/wsman/HttpHeader/ContentTypeUnsupported01rspgood.xml
new file mode 100644 (file)
index 0000000..19133c5
--- /dev/null
@@ -0,0 +1,3 @@
+HTTP/1.1 400 Bad Request\r
+PGErrorDetail: HTTP%20Content-Type%20header%20error.\r
+\r
diff --git a/test/wetest/wsman/HttpHeader/HostMissing01.xml b/test/wetest/wsman/HttpHeader/HostMissing01.xml
new file mode 100644 (file)
index 0000000..9148977
--- /dev/null
@@ -0,0 +1,22 @@
+POST /wsman HTTP/1.1\r
+Content-Type: application/soap+xml; charset=utf-8\r
+Content-Length: 986\r
+\r
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0001-000000000011</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/HostMissing01rspgood.xml b/test/wetest/wsman/HttpHeader/HostMissing01rspgood.xml
new file mode 100644 (file)
index 0000000..9e9f3f1
--- /dev/null
@@ -0,0 +1,3 @@
+HTTP/1.1 400 Bad Request\r
+PGErrorDetail: HTTP%20request%20message%20lacks%20a%20Host%20header%20field.\r
+\r
diff --git a/test/wetest/wsman/HttpHeader/Http1_0Post01.xml b/test/wetest/wsman/HttpHeader/Http1_0Post01.xml
new file mode 100644 (file)
index 0000000..378fe98
--- /dev/null
@@ -0,0 +1,22 @@
+POST /wsman HTTP/1.0\r
+Content-Type: application/soap+xml; charset=utf-8\r
+Content-Length: 986\r
+\r
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0001-000000000006</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/Http1_0Post01rspgood.xml b/test/wetest/wsman/HttpHeader/Http1_0Post01rspgood.xml
new file mode 100644 (file)
index 0000000..673cb70
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0001-000000000006
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<class:PG_TestPropertyTypes xmlns:class="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+<class:CreationClassName>
+PG_TestPropertyTypes
+</class:CreationClassName>
+<class:InstanceId>
+1
+</class:InstanceId>
+<class:PropertyString>
+PG_TestPropertyTypes_Instance1
+</class:PropertyString>
+<class:PropertyUint8>
+120
+</class:PropertyUint8>
+<class:PropertyUint16>
+1600
+</class:PropertyUint16>
+<class:PropertyUint32>
+3200
+</class:PropertyUint32>
+<class:PropertyUint64>
+6400
+</class:PropertyUint64>
+<class:PropertySint8>
+-120
+</class:PropertySint8>
+<class:PropertySint16>
+-1600
+</class:PropertySint16>
+<class:PropertySint32>
+-3200
+</class:PropertySint32>
+<class:PropertySint64>
+-6400
+</class:PropertySint64>
+<class:PropertyBoolean>
+true
+</class:PropertyBoolean>
+<class:PropertyReal32>
+1.1234567165374756e+00
+</class:PropertyReal32>
+<class:PropertyReal64>
+1.1234567890654321e+00
+</class:PropertyReal64>
+<class:PropertyDatetime>
+20010515104354.000000:000
+</class:PropertyDatetime>
+</class:PG_TestPropertyTypes>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/Http1_1MPost01.xml b/test/wetest/wsman/HttpHeader/Http1_1MPost01.xml
new file mode 100644 (file)
index 0000000..7279b01
--- /dev/null
@@ -0,0 +1,23 @@
+M-POST /wsman HTTP/1.1\r
+Host: \r
+Content-Type: application/soap+xml; charset=utf-8\r
+Content-Length: 986\r
+\r
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0001-000000000007</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/Http1_1MPost01rspgood.xml b/test/wetest/wsman/HttpHeader/Http1_1MPost01rspgood.xml
new file mode 100644 (file)
index 0000000..de2a50d
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0001-000000000007
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<class:PG_TestPropertyTypes xmlns:class="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+<class:CreationClassName>
+PG_TestPropertyTypes
+</class:CreationClassName>
+<class:InstanceId>
+1
+</class:InstanceId>
+<class:PropertyString>
+PG_TestPropertyTypes_Instance1
+</class:PropertyString>
+<class:PropertyUint8>
+120
+</class:PropertyUint8>
+<class:PropertyUint16>
+1600
+</class:PropertyUint16>
+<class:PropertyUint32>
+3200
+</class:PropertyUint32>
+<class:PropertyUint64>
+6400
+</class:PropertyUint64>
+<class:PropertySint8>
+-120
+</class:PropertySint8>
+<class:PropertySint16>
+-1600
+</class:PropertySint16>
+<class:PropertySint32>
+-3200
+</class:PropertySint32>
+<class:PropertySint64>
+-6400
+</class:PropertySint64>
+<class:PropertyBoolean>
+true
+</class:PropertyBoolean>
+<class:PropertyReal32>
+1.1234567165374756e+00
+</class:PropertyReal32>
+<class:PropertyReal64>
+1.1234567890654321e+00
+</class:PropertyReal64>
+<class:PropertyDatetime>
+20010515104354.000000:000
+</class:PropertyDatetime>
+</class:PG_TestPropertyTypes>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/Makefile b/test/wetest/wsman/HttpHeader/Makefile
new file mode 100644 (file)
index 0000000..ad999c6
--- /dev/null
@@ -0,0 +1,49 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#// 
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//=============================================================================
+
+ROOT = ../../../..
+include $(ROOT)/mak/config.mak
+include $(ROOT)/test/config.mak
+
+XMLSCRIPTS += \
+    ContentTypeCharsetUnsupported01 \
+    ContentTypeMissing01 \
+    ContentTypeTextXml01 \
+    ContentTypeUnparsable01 \
+    ContentTypeUnsupported01 \
+    HostMissing01 \
+    Http1_0Post01 \
+    Http1_1MPost01 \
+    SOAPActionCorrect01 \
+    SOAPActionCorrectQuoted01 \
+    SOAPActionIncorrect01
+
+include $(ROOT)/test/configend.mak
diff --git a/test/wetest/wsman/HttpHeader/SOAPActionCorrect01.xml b/test/wetest/wsman/HttpHeader/SOAPActionCorrect01.xml
new file mode 100644 (file)
index 0000000..fc2b243
--- /dev/null
@@ -0,0 +1,24 @@
+POST /wsman HTTP/1.1\r
+Host: \r
+Content-Type: application/soap+xml; charset=utf-8\r
+Content-Length: 986\r
+SOAPAction: http://schemas.xmlsoap.org/ws/2004/09/transfer/Get\r
+\r
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0001-000000000008</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/SOAPActionCorrect01rspgood.xml b/test/wetest/wsman/HttpHeader/SOAPActionCorrect01rspgood.xml
new file mode 100644 (file)
index 0000000..f1633d3
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0001-000000000008
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<class:PG_TestPropertyTypes xmlns:class="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+<class:CreationClassName>
+PG_TestPropertyTypes
+</class:CreationClassName>
+<class:InstanceId>
+1
+</class:InstanceId>
+<class:PropertyString>
+PG_TestPropertyTypes_Instance1
+</class:PropertyString>
+<class:PropertyUint8>
+120
+</class:PropertyUint8>
+<class:PropertyUint16>
+1600
+</class:PropertyUint16>
+<class:PropertyUint32>
+3200
+</class:PropertyUint32>
+<class:PropertyUint64>
+6400
+</class:PropertyUint64>
+<class:PropertySint8>
+-120
+</class:PropertySint8>
+<class:PropertySint16>
+-1600
+</class:PropertySint16>
+<class:PropertySint32>
+-3200
+</class:PropertySint32>
+<class:PropertySint64>
+-6400
+</class:PropertySint64>
+<class:PropertyBoolean>
+true
+</class:PropertyBoolean>
+<class:PropertyReal32>
+1.1234567165374756e+00
+</class:PropertyReal32>
+<class:PropertyReal64>
+1.1234567890654321e+00
+</class:PropertyReal64>
+<class:PropertyDatetime>
+20010515104354.000000:000
+</class:PropertyDatetime>
+</class:PG_TestPropertyTypes>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/SOAPActionCorrectQuoted01.xml b/test/wetest/wsman/HttpHeader/SOAPActionCorrectQuoted01.xml
new file mode 100644 (file)
index 0000000..2258c55
--- /dev/null
@@ -0,0 +1,24 @@
+POST /wsman HTTP/1.1\r
+Host: \r
+Content-Type: application/soap+xml; charset=utf-8\r
+Content-Length: 986\r
+SOAPAction: "http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"\r
+\r
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0001-000000000009</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/SOAPActionCorrectQuoted01rspgood.xml b/test/wetest/wsman/HttpHeader/SOAPActionCorrectQuoted01rspgood.xml
new file mode 100644 (file)
index 0000000..72402a0
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0001-000000000009
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<class:PG_TestPropertyTypes xmlns:class="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+<class:CreationClassName>
+PG_TestPropertyTypes
+</class:CreationClassName>
+<class:InstanceId>
+1
+</class:InstanceId>
+<class:PropertyString>
+PG_TestPropertyTypes_Instance1
+</class:PropertyString>
+<class:PropertyUint8>
+120
+</class:PropertyUint8>
+<class:PropertyUint16>
+1600
+</class:PropertyUint16>
+<class:PropertyUint32>
+3200
+</class:PropertyUint32>
+<class:PropertyUint64>
+6400
+</class:PropertyUint64>
+<class:PropertySint8>
+-120
+</class:PropertySint8>
+<class:PropertySint16>
+-1600
+</class:PropertySint16>
+<class:PropertySint32>
+-3200
+</class:PropertySint32>
+<class:PropertySint64>
+-6400
+</class:PropertySint64>
+<class:PropertyBoolean>
+true
+</class:PropertyBoolean>
+<class:PropertyReal32>
+1.1234567165374756e+00
+</class:PropertyReal32>
+<class:PropertyReal64>
+1.1234567890654321e+00
+</class:PropertyReal64>
+<class:PropertyDatetime>
+20010515104354.000000:000
+</class:PropertyDatetime>
+</class:PG_TestPropertyTypes>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/SOAPActionIncorrect01.xml b/test/wetest/wsman/HttpHeader/SOAPActionIncorrect01.xml
new file mode 100644 (file)
index 0000000..a2d18d3
--- /dev/null
@@ -0,0 +1,24 @@
+POST /wsman HTTP/1.1\r
+Host: \r
+Content-Type: application/soap+xml; charset=utf-8\r
+Content-Length: 986\r
+SOAPAction: http://schemas.xmlsoap.org/ws/2004/09/transfer/Put\r
+\r
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0001-000000000010</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/HttpHeader/SOAPActionIncorrect01rspgood.xml b/test/wetest/wsman/HttpHeader/SOAPActionIncorrect01rspgood.xml
new file mode 100644 (file)
index 0000000..fe44ba5
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001719\r
+SOAPAction: http://schemas.xmlsoap.org/ws/2004/08/addressing/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0001-000000000010
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsa:MessageInformationHeaderRequired
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+The HTTP SOAPAction header value &quot;http://schemas.xmlsoap.org/ws/2004/09/transfer/Put&quot; does not match the wsa:Action value &quot;http://schemas.xmlsoap.org/ws/2004/09/transfer/Get&quot;.
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Makefile b/test/wetest/wsman/Makefile
new file mode 100644 (file)
index 0000000..fa86d1b
--- /dev/null
@@ -0,0 +1,49 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#// 
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//=============================================================================
+
+include $(PEGASUS_ROOT)/mak/config.mak
+
+DIRS =
+
+# Note: These tests require wbemexec to be built with PEGASUS_DEBUG set, so it
+# replaces the response MessageID with a fixed value for static comparison.
+
+ifdef PEGASUS_DEBUG
+    DIRS += \
+        HttpHeader \
+        SoapHeader \
+        Create \
+        Get \
+        Put \
+        Delete
+endif
+
+include $(PEGASUS_ROOT)/mak/recurse.mak
diff --git a/test/wetest/wsman/Put/Makefile b/test/wetest/wsman/Put/Makefile
new file mode 100644 (file)
index 0000000..4feaa4a
--- /dev/null
@@ -0,0 +1,42 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#// 
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//=============================================================================
+
+ROOT = ../../../..
+include $(ROOT)/mak/config.mak
+include $(ROOT)/test/config.mak
+
+XMLSCRIPTS = \
+    Put_InvalidParameter01 \
+    Put_NotFound01 \
+    Put_Success01 \
+    Put_Success02
+
+include $(ROOT)/test/configend.mak
diff --git a/test/wetest/wsman/Put/Put_InvalidParameter01.xml b/test/wetest/wsman/Put/Put_InvalidParameter01.xml
new file mode 100644 (file)
index 0000000..1a0a8c4
--- /dev/null
@@ -0,0 +1,29 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header><a:To>http://localhost/wsman</a:To>
+<w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+<a:ReplyTo><a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>
+<a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action>
+<a:MessageID>uuid:00000000-0000-0000-0005-000000000003</a:MessageID>
+<w:Locale xml:lang="en-US" s:mustUnderstand="false" /><w:SelectorSet>
+<w:Selector Name="InstanceId">1</w:Selector>
+<w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+<w:Selector Name="__cimnamespace">test/static</w:Selector></w:SelectorSet>
+</s:Header>
+<s:Body><class:PG_TestPropertyTypes xmlns:class="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+        <class:CreationClassName>PG_TestPropertyTypes</class:CreationClassName>
+        <class:InstanceId>1</class:InstanceId>
+        <class:PropertyString>WSMInstance</class:PropertyString>
+        <!-- Specifies an invalid property value -->
+        <class:PropertyUint8>255</class:PropertyUint8>
+        <class:PropertyUint16>16</class:PropertyUint16>
+        <class:PropertyUint32>32</class:PropertyUint32>
+        <class:PropertyUint64>64</class:PropertyUint64>
+        <class:PropertySint8>-8</class:PropertySint8>
+        <class:PropertySint16>-16</class:PropertySint16>
+        <class:PropertySint32>-32</class:PropertySint32>
+        <class:PropertySint64>-64</class:PropertySint64>
+        <class:PropertyBoolean>false</class:PropertyBoolean>
+        <class:PropertyReal32>32.0</class:PropertyReal32>
+        <class:PropertyReal64>65.0</class:PropertyReal64>
+        <class:PropertyDatetime>20010515104354.000000:000</class:PropertyDatetime>
+</class:PG_TestPropertyTypes></s:Body></s:Envelope>
diff --git a/test/wetest/wsman/Put/Put_InvalidParameter01rspgood.xml b/test/wetest/wsman/Put/Put_InvalidParameter01rspgood.xml
new file mode 100644 (file)
index 0000000..d730692
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001549\r
+SOAPAction: http://schemas.dmtf.org/wbem/wsman/1/wsman/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0005-000000000003
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsman:InvalidParameter
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+CIM_ERR_INVALID_PARAMETER
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Put/Put_NotFound01.xml b/test/wetest/wsman/Put/Put_NotFound01.xml
new file mode 100644 (file)
index 0000000..b17a8f2
--- /dev/null
@@ -0,0 +1,29 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header><a:To>http://localhost/wsman</a:To>
+<w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+<a:ReplyTo><a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>
+<a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action>
+<a:MessageID>uuid:00000000-0000-0000-0005-000000000002</a:MessageID>
+<w:Locale xml:lang="en-US" s:mustUnderstand="false" /><w:SelectorSet>
+<!-- Specifies an invalid key property value -->
+<w:Selector Name="InstanceId">100</w:Selector>
+<w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+<w:Selector Name="__cimnamespace">test/static</w:Selector></w:SelectorSet>
+</s:Header>
+<s:Body><class:PG_TestPropertyTypes xmlns:class="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+        <class:CreationClassName>PG_TestPropertyTypes</class:CreationClassName>
+        <class:InstanceId>1</class:InstanceId>
+        <class:PropertyString>WSMInstance</class:PropertyString>
+        <class:PropertyUint8>8</class:PropertyUint8>
+        <class:PropertyUint16>16</class:PropertyUint16>
+        <class:PropertyUint32>32</class:PropertyUint32>
+        <class:PropertyUint64>64</class:PropertyUint64>
+        <class:PropertySint8>-8</class:PropertySint8>
+        <class:PropertySint16>-16</class:PropertySint16>
+        <class:PropertySint32>-32</class:PropertySint32>
+        <class:PropertySint64>-64</class:PropertySint64>
+        <class:PropertyBoolean>false</class:PropertyBoolean>
+        <class:PropertyReal32>32.0</class:PropertyReal32>
+        <class:PropertyReal64>65.0</class:PropertyReal64>
+        <class:PropertyDatetime>20010515104354.000000:000</class:PropertyDatetime>
+</class:PG_TestPropertyTypes></s:Body></s:Envelope>
diff --git a/test/wetest/wsman/Put/Put_NotFound01rspgood.xml b/test/wetest/wsman/Put/Put_NotFound01rspgood.xml
new file mode 100644 (file)
index 0000000..8fa33af
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001551\r
+SOAPAction: http://schemas.xmlsoap.org/ws/2004/08/addressing/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0005-000000000002
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsa:DestinationUnreachable
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+CIM_ERR_NOT_FOUND
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Put/Put_Success01.xml b/test/wetest/wsman/Put/Put_Success01.xml
new file mode 100644 (file)
index 0000000..c878808
--- /dev/null
@@ -0,0 +1,30 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header><a:To>http://localhost/wsman</a:To>
+<w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+<a:ReplyTo><a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>
+<a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action>
+<w:MaxEnvelopeSize s:mustUnderstand="true">153600</w:MaxEnvelopeSize>
+<a:MessageID>uuid:00000000-0000-0000-0005-000000000001</a:MessageID>
+<w:Locale xml:lang="en-US" s:mustUnderstand="false" /><w:SelectorSet>
+<w:Selector Name="InstanceId">1</w:Selector>
+<w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+<w:Selector Name="__cimnamespace">test/static</w:Selector></w:SelectorSet>
+<w:OperationTimeout>PT60.000S</w:OperationTimeout>
+</s:Header>
+<s:Body><class:PG_TestPropertyTypes xmlns:class="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+        <class:CreationClassName>PG_TestPropertyTypes</class:CreationClassName>
+        <class:InstanceId>1</class:InstanceId>
+        <class:PropertyString>WSMInstance</class:PropertyString>
+        <class:PropertyUint8>8</class:PropertyUint8>
+        <class:PropertyUint16>16</class:PropertyUint16>
+        <class:PropertyUint32>32</class:PropertyUint32>
+        <class:PropertyUint64>64</class:PropertyUint64>
+        <class:PropertySint8>-8</class:PropertySint8>
+        <class:PropertySint16>-16</class:PropertySint16>
+        <class:PropertySint32>-32</class:PropertySint32>
+        <class:PropertySint64>-64</class:PropertySint64>
+        <class:PropertyBoolean>false</class:PropertyBoolean>
+        <class:PropertyReal32>32.0</class:PropertyReal32>
+        <class:PropertyReal64>65.0</class:PropertyReal64>
+        <class:PropertyDatetime>20010515104354.000000:000</class:PropertyDatetime>
+</class:PG_TestPropertyTypes></s:Body></s:Envelope>
diff --git a/test/wetest/wsman/Put/Put_Success01rspgood.xml b/test/wetest/wsman/Put/Put_Success01rspgood.xml
new file mode 100644 (file)
index 0000000..0e429aa
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/09/transfer/PutResponse
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0005-000000000001
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/Put/Put_Success02.xml b/test/wetest/wsman/Put/Put_Success02.xml
new file mode 100644 (file)
index 0000000..51cbe7d
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+<s:Header><a:To>http://localhost/wsman</a:To>
+<w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+<a:ReplyTo><a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>
+<a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action>
+<a:MessageID>uuid:00000000-0000-0000-0005-000000000004</a:MessageID>
+<w:RequestEPR/>
+<w:Locale xml:lang="en-US" s:mustUnderstand="false" /><w:SelectorSet>
+<w:Selector Name="InstanceId">1</w:Selector>
+<w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+<w:Selector Name="__cimnamespace">test/static</w:Selector></w:SelectorSet>
+</s:Header>
+<s:Body><class:PG_TestPropertyTypes xmlns:class="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes">
+        <class:CreationClassName>PG_TestPropertyTypes</class:CreationClassName>
+        <class:InstanceId>1</class:InstanceId>
+        <class:PropertyString>WSMInstance</class:PropertyString>
+        <class:PropertyUint8>8</class:PropertyUint8>
+        <class:PropertyUint16>16</class:PropertyUint16>
+        <class:PropertyUint32>32</class:PropertyUint32>
+        <class:PropertyUint64>64</class:PropertyUint64>
+        <class:PropertySint8>-8</class:PropertySint8>
+        <class:PropertySint16>-16</class:PropertySint16>
+        <class:PropertySint32>-32</class:PropertySint32>
+        <class:PropertySint64>-64</class:PropertySint64>
+        <class:PropertyBoolean>false</class:PropertyBoolean>
+        <class:PropertyReal32>32.0</class:PropertyReal32>
+        <class:PropertyReal64>65.0</class:PropertyReal64>
+        <class:PropertyDatetime>20010515104354.000000:000</class:PropertyDatetime>
+</class:PG_TestPropertyTypes></s:Body></s:Envelope>
diff --git a/test/wetest/wsman/Put/Put_Success02rspgood.xml b/test/wetest/wsman/Put/Put_Success02rspgood.xml
new file mode 100644 (file)
index 0000000..a2b254e
--- /dev/null
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/09/transfer/PutResponse
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0005-000000000004
+</wsa:RelatesTo>
+<wsman:RequestedEPR>
+<wsa:EndpointReference>
+<wsa:Address>
+http://localhost/wsman
+</wsa:Address>
+<wsa:ReferenceParameters>
+<wsman:ResourceURI>
+http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes
+</wsman:ResourceURI>
+<wsman:SelectorSet>
+<wsman:Selector Name="InstanceId">
+1
+</wsman:Selector>
+<wsman:Selector Name="CreationClassName">
+PG_TestPropertyTypes
+</wsman:Selector>
+<wsman:Selector Name="__cimnamespace">
+test/static
+</wsman:Selector>
+</wsman:SelectorSet>
+</wsa:ReferenceParameters>
+</wsa:EndpointReference>
+</wsman:RequestedEPR>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/SoapHeader/ActionMissing01.xml b/test/wetest/wsman/SoapHeader/ActionMissing01.xml
new file mode 100644 (file)
index 0000000..cc0a986
--- /dev/null
@@ -0,0 +1,21 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0002-000000000001</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:FaultTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:FaultTo>
+  <!-- Action missing -->
+  <w:Locale/>
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/SoapHeader/ActionMissing01rspgood.xml b/test/wetest/wsman/SoapHeader/ActionMissing01rspgood.xml
new file mode 100644 (file)
index 0000000..6394349
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001596\r
+SOAPAction: http://schemas.xmlsoap.org/ws/2004/08/addressing/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0002-000000000001
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsa:MessageInformationHeaderRequired
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+Required SOAP header &quot;wsa:Action&quot; was not specified.
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/SoapHeader/ActionUnsupported01.xml b/test/wetest/wsman/SoapHeader/ActionUnsupported01.xml
new file mode 100644 (file)
index 0000000..ea1643f
--- /dev/null
@@ -0,0 +1,22 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0002-000000000002</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:FaultTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:FaultTo>
+  <!-- Unsupported Action -->
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Bogus</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/SoapHeader/ActionUnsupported01rspgood.xml b/test/wetest/wsman/SoapHeader/ActionUnsupported01rspgood.xml
new file mode 100644 (file)
index 0000000..932ea1e
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001623\r
+SOAPAction: http://schemas.xmlsoap.org/ws/2004/08/addressing/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0002-000000000002
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsa:ActionNotSupported
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+The wsa:Action value &quot;http://schemas.xmlsoap.org/ws/2004/09/transfer/Bogus&quot; is not supported.
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/SoapHeader/FaultToUnsupported01.xml b/test/wetest/wsman/SoapHeader/FaultToUnsupported01.xml
new file mode 100644 (file)
index 0000000..760ad6b
--- /dev/null
@@ -0,0 +1,22 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0002-000000000003</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:FaultTo>
+   <!-- Unsupported FaultTo address -->
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/bogus</a:Address>
+  </a:FaultTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/SoapHeader/FaultToUnsupported01rspgood.xml b/test/wetest/wsman/SoapHeader/FaultToUnsupported01rspgood.xml
new file mode 100644 (file)
index 0000000..e565717
--- /dev/null
@@ -0,0 +1,46 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001755\r
+SOAPAction: http://schemas.dmtf.org/wbem/wsman/1/wsman/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0002-000000000003
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsman:UnsupportedFeature
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+Responses may only be delivered over the same connection on which the request arrives.
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+<SOAP-ENV:Detail>
+<wsman:FaultDetail>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/AddressingMode
+</wsman:FaultDetail>
+</SOAP-ENV:Detail>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/SoapHeader/FragmentLevelAccess01.xml b/test/wetest/wsman/SoapHeader/FragmentLevelAccess01.xml
new file mode 100644 (file)
index 0000000..bbca242
--- /dev/null
@@ -0,0 +1,22 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0002-000000000007</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:FaultTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:FaultTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:FragmentTransfer s:mustUnderstand="true">xpath expression</w:FragmentTransfer>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/SoapHeader/FragmentLevelAccess01rspgood.xml b/test/wetest/wsman/SoapHeader/FragmentLevelAccess01rspgood.xml
new file mode 100644 (file)
index 0000000..663d9a6
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001591\r
+SOAPAction: http://schemas.dmtf.org/wbem/wsman/1/wsman/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0002-000000000007
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsman:UnsupportedFeature
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Detail>
+<wsman:FaultDetail>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/FragmentLevelAccess
+</wsman:FaultDetail>
+</SOAP-ENV:Detail>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/SoapHeader/HeaderNotUnderstood01.xml b/test/wetest/wsman/SoapHeader/HeaderNotUnderstood01.xml
new file mode 100644 (file)
index 0000000..0c57209
--- /dev/null
@@ -0,0 +1,20 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0002-000000000004</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <!-- SOAP header that is not understood -->
+  <a:Bogus s:mustUnderstand="true">What is this?</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/SoapHeader/HeaderNotUnderstood01rspgood.xml b/test/wetest/wsman/SoapHeader/HeaderNotUnderstood01rspgood.xml
new file mode 100644 (file)
index 0000000..66c57dc
--- /dev/null
@@ -0,0 +1,37 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001570\r
+SOAPAction: http://schemas.xmlsoap.org/ws/2004/08/addressing/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<SOAP-ENV:NotUnderstood qname="ns:Bogus" xmlns:ns="http://schemas.xmlsoap.org/ws/2004/08/addressing"/>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0002-000000000004
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:MustUnderstand
+</SOAP-ENV:Value>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+Header not understood.
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/SoapHeader/Makefile b/test/wetest/wsman/SoapHeader/Makefile
new file mode 100644 (file)
index 0000000..16d4dff
--- /dev/null
@@ -0,0 +1,45 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#// 
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//=============================================================================
+
+ROOT = ../../../..
+include $(ROOT)/mak/config.mak
+include $(ROOT)/test/config.mak
+
+XMLSCRIPTS += \
+    ActionMissing01 \
+    ActionUnsupported01 \
+    FaultToUnsupported01 \
+    FragmentLevelAccess01 \
+    HeaderNotUnderstood01 \
+    ReplyToUnsupported01 \
+    XmlSyntaxInvalid01
+
+include $(ROOT)/test/configend.mak
diff --git a/test/wetest/wsman/SoapHeader/ReplyToUnsupported01.xml b/test/wetest/wsman/SoapHeader/ReplyToUnsupported01.xml
new file mode 100644 (file)
index 0000000..78730c4
--- /dev/null
@@ -0,0 +1,19 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0002-000000000005</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <!-- Unsupported ReplyTo address -->
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/bogus</a:Address>
+  </a:ReplyTo>
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/SoapHeader/ReplyToUnsupported01rspgood.xml b/test/wetest/wsman/SoapHeader/ReplyToUnsupported01rspgood.xml
new file mode 100644 (file)
index 0000000..e26af25
--- /dev/null
@@ -0,0 +1,46 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001755\r
+SOAPAction: http://schemas.dmtf.org/wbem/wsman/1/wsman/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0002-000000000005
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsman:UnsupportedFeature
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+Responses may only be delivered over the same connection on which the request arrives.
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+<SOAP-ENV:Detail>
+<wsman:FaultDetail>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/AddressingMode
+</wsman:FaultDetail>
+</SOAP-ENV:Detail>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/test/wetest/wsman/SoapHeader/XmlSyntaxInvalid01.xml b/test/wetest/wsman/SoapHeader/XmlSyntaxInvalid01.xml
new file mode 100644 (file)
index 0000000..5967e45
--- /dev/null
@@ -0,0 +1,18 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
+ <s:Header>
+  <a:MessageID>uuid:00000000-0000-0000-0002-000000000006</a:MessageID>
+  <a:To>http://localhost/wsman</a:To>
+  <w:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/PG_TestPropertyTypes</w:ResourceURI>
+  <a:ReplyTo>
+   <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
+  <!-- Missing a:ReplyTo end tag -->
+  <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
+  <w:Locale xml:lang="en-US" s:mustUnderstand="false" />
+  <w:SelectorSet>
+   <w:Selector Name="__cimnamespace">test/static</w:Selector>
+   <w:Selector Name="InstanceId">1</w:Selector>
+   <w:Selector Name="CreationClassName">PG_TestPropertyTypes</w:Selector>
+  </w:SelectorSet>
+ </s:Header>
+ <s:Body />
+</s:Envelope>
diff --git a/test/wetest/wsman/SoapHeader/XmlSyntaxInvalid01rspgood.xml b/test/wetest/wsman/SoapHeader/XmlSyntaxInvalid01rspgood.xml
new file mode 100644 (file)
index 0000000..dcac76b
--- /dev/null
@@ -0,0 +1,41 @@
+HTTP/1.1 500 Internal Server Error\r
+Content-Type: application/soap+xml;charset=UTF-8\r
+content-length: 0000001665\r
+SOAPAction: http://schemas.dmtf.org/wbem/wsman/1/wsman/fault\r
+\r
+<?xml version="1.0" encoding="utf-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmb="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wscim="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2">
+<SOAP-ENV:Header>
+<wsa:To>
+http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+</wsa:To>
+<wsa:Action>
+http://schemas.dmtf.org/wbem/wsman/1/wsman/fault
+</wsa:Action>
+<wsa:MessageID>
+uuid:00000000-0000-0000-0000-000000000000
+</wsa:MessageID>
+<wsa:RelatesTo>
+uuid:00000000-0000-0000-0002-000000000006
+</wsa:RelatesTo>
+</SOAP-ENV:Header>
+<SOAP-ENV:Body>
+<SOAP-ENV:Fault>
+<SOAP-ENV:Code>
+<SOAP-ENV:Value>
+SOAP-ENV:Sender
+</SOAP-ENV:Value>
+<SOAP-ENV:Subcode>
+<SOAP-ENV:Value>
+wsman:SchemaValidationError
+</SOAP-ENV:Value>
+</SOAP-ENV:Subcode>
+</SOAP-ENV:Code>
+<SOAP-ENV:Reason>
+<SOAP-ENV:Text xml:lang="en-US">
+Validation error: on line 9: Expecting an end tag for &quot;ReplyTo&quot; element in namespace &quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;.
+</SOAP-ENV:Text>
+</SOAP-ENV:Reason>
+</SOAP-ENV:Fault>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>