SoapResponse* WsmResponseEncoder::encode(WsmResponse* response) { PEG_METHOD_ENTER(TRC_WSMSERVER, "WsmResponseEncoder::format()"); PEGASUS_ASSERT(response); PEG_TRACE((TRC_WSMSERVER, Tracer::LEVEL4, "WsmResponseEncoder::enqueue()- " "response->getHttpCloseConnect() returned %d", response->getHttpCloseConnect())); try { switch (response->getType()) { case WS_TRANSFER_GET: return _encodeWxfGetResponse((WxfGetResponse*)response); case WS_TRANSFER_PUT: return _encodeWxfPutResponse((WxfPutResponse*)response); case WS_TRANSFER_CREATE: return _encodeWxfCreateResponse((WxfCreateResponse*)response); case WS_TRANSFER_DELETE: return _encodeWxfDeleteResponse((WxfDeleteResponse*)response); case WS_ENUMERATION_ENUMERATE: return _encodeWsenEnumerateResponse( (WsenEnumerateResponse*)response); case WS_ENUMERATION_PULL: return _encodeWsenPullResponse((WsenPullResponse*)response); case WS_ENUMERATION_RELEASE: return _encodeWsenReleaseResponse( (WsenReleaseResponse*)response); case WSM_FAULT: return _encodeWsmFaultResponse((WsmFaultResponse*)response); case SOAP_FAULT: return _encodeSoapFaultResponse((SoapFaultResponse*)response); case WS_INVOKE: return _encodeWsInvokeResponse((WsInvokeResponse*)response); default: // Unexpected message type PEGASUS_ASSERT(0); break; } } 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( response->getRelatesTo(), response->getQueueId(), response->getHttpMethod(), response->getHttpCloseConnect(), response->getOmitXMLProcessingInstruction(), fault); return _encodeWsmFaultResponse(&outofmem); } PEG_METHOD_EXIT(); // Unreachable! return 0; }
void WsmResponseEncoder::enqueue(WsmResponse* response) { PEG_METHOD_ENTER(TRC_WSMSERVER, "WsmResponseEncoder::enqueue()"); PEGASUS_ASSERT(response); PEG_TRACE((TRC_WSMSERVER, Tracer::LEVEL4, "WsmResponseEncoder::enqueue()- " "response->getHttpCloseConnect() returned %d", response->getHttpCloseConnect())); try { switch (response->getType()) { case WS_TRANSFER_GET: _encodeWxfGetResponse((WxfGetResponse*) response); break; case WS_TRANSFER_PUT: _encodeWxfPutResponse((WxfPutResponse*) response); break; case WS_TRANSFER_CREATE: _encodeWxfCreateResponse((WxfCreateResponse*) response); break; case WS_TRANSFER_DELETE: _encodeWxfDeleteResponse((WxfDeleteResponse*) response); break; case WS_ENUMERATION_RELEASE: _encodeWsenReleaseResponse((WsenReleaseResponse*) response); break; case WSM_FAULT: _encodeWsmFaultResponse((WsmFaultResponse*) response); break; case SOAP_FAULT: _encodeSoapFaultResponse((SoapFaultResponse*) response); break; case WS_INVOKE: _encodeWsInvokeResponse((WsInvokeResponse*)response); break; case WS_ENUMERATION_ENUMERATE: case WS_ENUMERATION_PULL: // These cases are handled specially to allow for the message // contents to be tuned according to the MaxEnvelopeSize value. default: // Unexpected message type PEGASUS_ASSERT(0); break; } } catch (PEGASUS_STD(bad_alloc)&) { MessageLoaderParms parms( "WsmServer.WsmResponseEncoder.OUT_OF_MEMORY", "A System error has occurred. Please retry the " "WS-Management operation at a later time."); Logger::put_l( Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, parms); MessageQueue* queue = MessageQueue::lookup(response->getQueueId()); HTTPConnection* httpQueue = dynamic_cast<HTTPConnection*>(queue); PEGASUS_ASSERT(httpQueue); // Handle the internal server error on this connection. httpQueue->handleInternalServerError(0, true); } PEG_METHOD_EXIT(); }