(file) Return to XmlWriter.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/XmlWriter.cpp between version 1.80 and 1.83

version 1.80, 2002/09/13 21:40:42 version 1.83, 2002/11/14 16:50:33
Line 1406 
Line 1406 
     const CIMName& cimMethod,     const CIMName& cimMethod,
     const String& cimObject,     const String& cimObject,
     const String& authenticationHeader,     const String& authenticationHeader,
       HttpMethod httpMethod,
     Uint32 contentLength)     Uint32 contentLength)
 { {
     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
  
       // ATTN: KS 20020926 - Temporary change to issue only POST. This may
       // be changed in the DMTF CIM Operations standard in the future.
       // If we kept M-Post we would have to retry with Post. Does not
       // do that in client today. Permanent change is to retry until spec
       // updated. This change is temp to finish tests or until the retry
       // installed.  Required because of change to wbemservices cimom
   #ifdef PEGASUS_SNIA_INTEROP_TEST
       out << "POST /cimom HTTP/1.1\r\n";
   #else
       if (httpMethod == HTTP_METHOD_M_POST)
       {
     out << "M-POST /cimom HTTP/1.1\r\n";     out << "M-POST /cimom HTTP/1.1\r\n";
       }
       else
       {
           out << "POST /cimom HTTP/1.1\r\n";
       }
   #endif
     out << "HOST: " << host << "\r\n";     out << "HOST: " << host << "\r\n";
     out << "Content-Type: application/xml; charset=\"utf-8\"\r\n";     out << "Content-Type: application/xml; charset=\"utf-8\"\r\n";
     out << "Content-Length: " << contentLength << "\r\n";     out << "Content-Length: " << contentLength << "\r\n";
       if (httpMethod == HTTP_METHOD_M_POST)
       {
     out << "Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=";     out << "Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=";
     out << nn <<"\r\n";     out << nn <<"\r\n";
     out << nn << "-CIMOperation: MethodCall\r\n";     out << nn << "-CIMOperation: MethodCall\r\n";
     out << nn << "-CIMMethod: " << cimMethod << "\r\n";     out << nn << "-CIMMethod: " << cimMethod << "\r\n";
     out << nn << "-CIMObject: " << cimObject << "\r\n";     out << nn << "-CIMObject: " << cimObject << "\r\n";
       }
       else
       {
           out << "CIMOperation: MethodCall\r\n";
           out << "CIMMethod: " << cimMethod << "\r\n";
           out << "CIMObject: " << cimObject << "\r\n";
       }
   
     if (authenticationHeader.size())     if (authenticationHeader.size())
     {     {
         out << authenticationHeader << "\r\n";         out << authenticationHeader << "\r\n";
Line 1436 
Line 1464 
  
 void XmlWriter::appendMethodResponseHeader( void XmlWriter::appendMethodResponseHeader(
     Array<Sint8>& out,     Array<Sint8>& out,
       HttpMethod httpMethod,
     Uint32 contentLength)     Uint32 contentLength)
 { {
     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
Line 1444 
Line 1473 
     STAT_SERVERTIME     STAT_SERVERTIME
     out << "Content-Type: application/xml; charset=\"utf-8\"\r\n";     out << "Content-Type: application/xml; charset=\"utf-8\"\r\n";
     out << "Content-Length: " << contentLength << "\r\n";     out << "Content-Length: " << contentLength << "\r\n";
       if (httpMethod == HTTP_METHOD_M_POST)
       {
     out << "Ext:\r\n";     out << "Ext:\r\n";
     out << "Cache-Control: no-cache\r\n";     out << "Cache-Control: no-cache\r\n";
     out << "Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=";     out << "Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=";
     out << nn <<"\r\n";     out << nn <<"\r\n";
     out << nn << "-CIMOperation: MethodResponse\r\n\r\n";     out << nn << "-CIMOperation: MethodResponse\r\n\r\n";
 } }
       else
       {
           out << "CIMOperation: MethodResponse\r\n\r\n";
       }
   }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
Line 1856 
Line 1892 
     const CIMName& className)     const CIMName& className)
 { {
     _appendIParamValueElementBegin(out, name);     _appendIParamValueElementBegin(out, name);
   
       //
       //  A NULL (unassigned) value for a parameter is specified by an
       //  <IPARAMVALUE> element with no subelement
       //
       if (!className.isNull ())
       {
     appendClassNameElement(out, className);     appendClassNameElement(out, className);
       }
   
     _appendIParamValueElementEnd(out);     _appendIParamValueElementEnd(out);
 } }
  
Line 1991 
Line 2036 
     Array<Sint8>& out,     Array<Sint8>& out,
     const CIMPropertyList& propertyList)     const CIMPropertyList& propertyList)
 { {
     // ATTN: P3 KS 4 Mar 2002 - As check shouldn't we check for null property list  
     _appendIParamValueElementBegin(out, "PropertyList");     _appendIParamValueElementBegin(out, "PropertyList");
  
       //
       //  A NULL (unassigned) value for a parameter is specified by an
       //  <IPARAMVALUE> element with no subelement
       //
       if (!propertyList.isNull ())
       {
     out << "<VALUE.ARRAY>\n";     out << "<VALUE.ARRAY>\n";
     for (Uint32 i = 0; i < propertyList.size(); i++)     for (Uint32 i = 0; i < propertyList.size(); i++)
     {     {
         out << "<VALUE>" << propertyList[i] << "</VALUE>\n";         out << "<VALUE>" << propertyList[i] << "</VALUE>\n";
     }     }
     out << "</VALUE.ARRAY>\n";     out << "</VALUE.ARRAY>\n";
       }
  
     _appendIParamValueElementEnd(out);     _appendIParamValueElementEnd(out);
 } }
Line 2052 
Line 2103 
     const CIMName& methodName,     const CIMName& methodName,
     const Array<CIMParamValue>& parameters,     const Array<CIMParamValue>& parameters,
     const String& messageId,     const String& messageId,
       HttpMethod httpMethod,
     const String& authenticationHeader)     const String& authenticationHeader)
 { {
     Array<Sint8> out;     Array<Sint8> out;
Line 2078 
Line 2130 
         methodName,         methodName,
         localObjectPath.toString(),         localObjectPath.toString(),
         authenticationHeader,         authenticationHeader,
           httpMethod,
         out.size());         out.size());
     tmp << out;     tmp << out;
  
Line 2087 
Line 2140 
 Array<Sint8> XmlWriter::formatSimpleMethodRspMessage( Array<Sint8> XmlWriter::formatSimpleMethodRspMessage(
     const CIMName& methodName,     const CIMName& methodName,
     const String& messageId,     const String& messageId,
       HttpMethod httpMethod,
     const Array<Sint8>& body)     const Array<Sint8>& body)
 { {
     Array<Sint8> out;     Array<Sint8> out;
Line 2100 
Line 2154 
     _appendSimpleRspElementEnd(out);     _appendSimpleRspElementEnd(out);
     _appendMessageElementEnd(out);     _appendMessageElementEnd(out);
  
     appendMethodResponseHeader(tmp, out.size());      appendMethodResponseHeader(tmp, httpMethod, out.size());
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;
Line 2115 
Line 2169 
 Array<Sint8> XmlWriter::formatSimpleMethodErrorRspMessage( Array<Sint8> XmlWriter::formatSimpleMethodErrorRspMessage(
     const CIMName& methodName,     const CIMName& methodName,
     const String& messageId,     const String& messageId,
       HttpMethod httpMethod,
     const CIMException& cimException)     const CIMException& cimException)
 { {
     Array<Sint8> out;     Array<Sint8> out;
Line 2128 
Line 2183 
     _appendSimpleRspElementEnd(out);     _appendSimpleRspElementEnd(out);
     _appendMessageElementEnd(out);     _appendMessageElementEnd(out);
  
     appendMethodResponseHeader(tmp, out.size());      appendMethodResponseHeader(tmp, httpMethod, out.size());
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;
Line 2145 
Line 2200 
     const CIMNamespaceName& nameSpace,     const CIMNamespaceName& nameSpace,
     const CIMName& iMethodName,     const CIMName& iMethodName,
     const String& messageId,     const String& messageId,
       HttpMethod httpMethod,
     const String& authenticationHeader,     const String& authenticationHeader,
     const Array<Sint8>& body)     const Array<Sint8>& body)
 { {
Line 2166 
Line 2222 
         iMethodName,         iMethodName,
         nameSpace.getString(),         nameSpace.getString(),
         authenticationHeader,         authenticationHeader,
           httpMethod,
         out.size());         out.size());
     tmp << out;     tmp << out;
  
Line 2181 
Line 2238 
 Array<Sint8> XmlWriter::formatSimpleIMethodRspMessage( Array<Sint8> XmlWriter::formatSimpleIMethodRspMessage(
     const CIMName& iMethodName,     const CIMName& iMethodName,
     const String& messageId,     const String& messageId,
       HttpMethod httpMethod,
     const Array<Sint8>& body)     const Array<Sint8>& body)
 { {
     Array<Sint8> out;     Array<Sint8> out;
Line 2199 
Line 2257 
     _appendSimpleRspElementEnd(out);     _appendSimpleRspElementEnd(out);
     _appendMessageElementEnd(out);     _appendMessageElementEnd(out);
  
     appendMethodResponseHeader(tmp, out.size());      appendMethodResponseHeader(tmp, httpMethod, out.size());
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;
Line 2214 
Line 2272 
 Array<Sint8> XmlWriter::formatSimpleIMethodErrorRspMessage( Array<Sint8> XmlWriter::formatSimpleIMethodErrorRspMessage(
     const CIMName& iMethodName,     const CIMName& iMethodName,
     const String& messageId,     const String& messageId,
       HttpMethod httpMethod,
     const CIMException& cimException)     const CIMException& cimException)
 { {
     Array<Sint8> out;     Array<Sint8> out;
Line 2227 
Line 2286 
     _appendSimpleRspElementEnd(out);     _appendSimpleRspElementEnd(out);
     _appendMessageElementEnd(out);     _appendMessageElementEnd(out);
  
     appendMethodResponseHeader(tmp, out.size());      appendMethodResponseHeader(tmp, httpMethod, out.size());
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;
Line 2252 
Line 2311 
     const char* requestUri,     const char* requestUri,
     const char* host,     const char* host,
     const CIMName& cimMethod,     const CIMName& cimMethod,
       HttpMethod httpMethod,
     const String& authenticationHeader,     const String& authenticationHeader,
     Uint32 contentLength)     Uint32 contentLength)
 { {
     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
  
       if (httpMethod == HTTP_METHOD_M_POST)
       {
     out << "M-POST " << requestUri << " HTTP/1.1\r\n";     out << "M-POST " << requestUri << " HTTP/1.1\r\n";
       }
       else
       {
           out << "POST " << requestUri << " HTTP/1.1\r\n";
       }
     out << "HOST: " << host << "\r\n";     out << "HOST: " << host << "\r\n";
     out << "Content-Type: application/xml; charset=\"utf-8\"\r\n";     out << "Content-Type: application/xml; charset=\"utf-8\"\r\n";
     out << "Content-Length: " << contentLength << "\r\n";     out << "Content-Length: " << contentLength << "\r\n";
       if (httpMethod == HTTP_METHOD_M_POST)
       {
     out << "Man: http://www.hp.com; ns=";     out << "Man: http://www.hp.com; ns=";
     out << nn <<"\r\n";     out << nn <<"\r\n";
     out << nn << "-CIMExport: MethodRequest\r\n";     out << nn << "-CIMExport: MethodRequest\r\n";
     out << nn << "-CIMExportMethod: " << cimMethod << "\r\n";     out << nn << "-CIMExportMethod: " << cimMethod << "\r\n";
       }
       else
       {
           out << "CIMExport: MethodRequest\r\n";
           out << "CIMExportMethod: " << cimMethod << "\r\n";
       }
   
     if (authenticationHeader.size())     if (authenticationHeader.size())
     {     {
         out << authenticationHeader << "\r\n";         out << authenticationHeader << "\r\n";
Line 2282 
Line 2358 
  
 void XmlWriter::appendEMethodResponseHeader( void XmlWriter::appendEMethodResponseHeader(
     Array<Sint8>& out,     Array<Sint8>& out,
       HttpMethod httpMethod,
     Uint32 contentLength)     Uint32 contentLength)
 { {
     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };     char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
Line 2289 
Line 2366 
     out << "HTTP/1.1 " HTTP_STATUS_OK "\r\n";     out << "HTTP/1.1 " HTTP_STATUS_OK "\r\n";
     out << "Content-Type: application/xml; charset=\"utf-8\"\r\n";     out << "Content-Type: application/xml; charset=\"utf-8\"\r\n";
     out << "Content-Length: " << contentLength << "\r\n";     out << "Content-Length: " << contentLength << "\r\n";
       if (httpMethod == HTTP_METHOD_M_POST)
       {
     out << "Ext:\r\n";     out << "Ext:\r\n";
     out << "Cache-Control: no-cache\r\n";     out << "Cache-Control: no-cache\r\n";
     out << "Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=";     out << "Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=";
     out << nn <<"\r\n";     out << nn <<"\r\n";
     out << nn << "-CIMExport: MethodResponse\r\n\r\n";     out << nn << "-CIMExport: MethodResponse\r\n\r\n";
 } }
       else
       {
           out << "CIMExport: MethodResponse\r\n\r\n";
       }
   }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
 // //
Line 2395 
Line 2479 
     const char* host,     const char* host,
     const CIMName& eMethodName,     const CIMName& eMethodName,
     const String& messageId,     const String& messageId,
       HttpMethod httpMethod,
     const String& authenticationHeader,     const String& authenticationHeader,
     const Array<Sint8>& body)     const Array<Sint8>& body)
 { {
Line 2414 
Line 2499 
         requestUri,         requestUri,
         host,         host,
         eMethodName,         eMethodName,
           httpMethod,
         authenticationHeader,         authenticationHeader,
         out.size());         out.size());
     tmp << out;     tmp << out;
Line 2430 
Line 2516 
 Array<Sint8> XmlWriter::formatSimpleEMethodRspMessage( Array<Sint8> XmlWriter::formatSimpleEMethodRspMessage(
     const CIMName& eMethodName,     const CIMName& eMethodName,
     const String& messageId,     const String& messageId,
       HttpMethod httpMethod,
     const Array<Sint8>& body)     const Array<Sint8>& body)
 { {
     Array<Sint8> out;     Array<Sint8> out;
Line 2443 
Line 2530 
     _appendSimpleExportRspElementEnd(out);     _appendSimpleExportRspElementEnd(out);
     _appendMessageElementEnd(out);     _appendMessageElementEnd(out);
  
     appendEMethodResponseHeader(tmp, out.size());      appendEMethodResponseHeader(tmp, httpMethod, out.size());
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;
Line 2458 
Line 2545 
 Array<Sint8> XmlWriter::formatSimpleEMethodErrorRspMessage( Array<Sint8> XmlWriter::formatSimpleEMethodErrorRspMessage(
     const CIMName& eMethodName,     const CIMName& eMethodName,
     const String& messageId,     const String& messageId,
       HttpMethod httpMethod,
     const CIMException& cimException)     const CIMException& cimException)
 { {
     Array<Sint8> out;     Array<Sint8> out;
Line 2471 
Line 2559 
     _appendSimpleExportRspElementEnd(out);     _appendSimpleExportRspElementEnd(out);
     _appendMessageElementEnd(out);     _appendMessageElementEnd(out);
  
     appendEMethodResponseHeader(tmp, out.size());      appendEMethodResponseHeader(tmp, httpMethod, out.size());
     tmp << out;     tmp << out;
  
     return tmp;     return tmp;


Legend:
Removed from v.1.80  
changed lines
  Added in v.1.83

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2