HTTP POST to CUCM

Version 1
    This document was generated from CDN thread

    Created by: Syed Rizwan on 23-05-2011 02:57:51 PM
    How can i send HTTP POST request to CUCM, Any specific tools required to do this ?

    Subject: RE: HTTP POST to CUCM
    Replied by: Aaron Graham on 01-06-2011 11:53:48 AM
    How can i send HTTP POST request to CUCM, Any specific tools required to do this ?

    I assume you mean HTTPS POST?   I created a C++/MFC application that was based on OpenSSL to do this. What ever tool you use it needs to calculate the HTTPS header information based on your SOAP/AXL payload size. i.e HTTPS HEADER + SOAP/AXL Payload = what you send.
    Here is part of what I needed to do:
    /*****************************************************************************/
    //
    // METHOD:GenerateAndAttachHTTPSHeader()
    //
    // PURPOSE:  This method creates an HTTP header based on the current
    //  m_ManagementAddress and m_ManagementIPPort values, and the size of the given
    //  SOAP_RequestEnvelope text string. This header is placed at the beginning
    //  of the given SOAP_RequestEnvelope text and the collective text is returned
    //  to the caller.
    // 
    // Returns : CString
    //
    /*****************************************************************************/
    CString SSL_ConnectionHandler::GenerateAndAttachHTTPSHeader(CString SOAP_RequestEnvelope)
    {
     CString strHTTPHeader;
     CString hostLineDetails;
     CString ContentLengthLineDetails;
     hostLineDetails.Format("Host: %s:%d\n",(char*)(LPCSTR)m_ManagementAddress,m_ManagementIPPort);
     ContentLengthLineDetails.Format("Content-length: %d\n",SOAP_RequestEnvelope.GetLength());
     strHTTPHeader = "POST /axl/ HTTP/1.1\n";
     strHTTPHeader += hostLineDetails;
     strHTTPHeader += "Accept: text/*\n";
     strHTTPHeader += "Authorization: Basic ";
      strHTTPHeader += m_authorisationText.c_str(); // add authorisation text.
     strHTTPHeader += "\nContent-type: text/xml\n";
     strHTTPHeader += ContentLengthLineDetails; // add Content-Length test for current request
     strHTTPHeader += "Connection: Keep-Alive";
     strHTTPHeader += "\n\n";
     // put the HTTP header and SOAP XML together
     return strHTTPHeader + SOAP_RequestEnvelope;
    }
     

    Subject: RE: HTTP POST to CUCM
    Replied by: Aaron Graham on 03-06-2011 03:26:22 AM
    I assume you mean HTTPS POST?   I created a C++/MFC application that was based on OpenSSL to do this. What ever tool you use it needs to calculate the HTTPS header information based on your SOAP/AXL payload size. i.e HTTPS HEADER + SOAP/AXL Payload = what you send.

    Here is part of what I needed to do:
    /*****************************************************************************/
    //
    // METHOD:GenerateAndAttachHTTPSHeader()
    //
    // PURPOSE:  This method creates an HTTP header based on the current
    //  m_ManagementAddress and m_ManagementIPPort values, and the size of the given
    //  SOAP_RequestEnvelope text string. This header is placed at the beginning
    //  of the given SOAP_RequestEnvelope text and the collective text is returned
    //  to the caller.
    // 
    // Returns : CString
    //
    /*****************************************************************************/
    CString SSL_ConnectionHandler::GenerateAndAttachHTTPSHeader(CString SOAP_RequestEnvelope)
    {
    CString strHTTPHeader;
    CString hostLineDetails;
    CString ContentLengthLineDetails;
    hostLineDetails.Format("Host: %s:%d\n",(char*)(LPCSTR)m_ManagementAddress,m_ManagementIPPort);
    ContentLengthLineDetails.Format("Content-length: %d\n",SOAP_RequestEnvelope.GetLength());
    strHTTPHeader = "POST /axl/ HTTP/1.1\n";
    strHTTPHeader += hostLineDetails;
    strHTTPHeader += "Accept: text/*\n";
    strHTTPHeader += "Authorization: Basic ";
      strHTTPHeader += m_authorisationText.c_str(); // add authorisation text.
    strHTTPHeader += "\nContent-type: text/xml\n";
    strHTTPHeader += ContentLengthLineDetails; // add Content-Length test for current request
    strHTTPHeader += "Connection: Keep-Alive";
    strHTTPHeader += "\n\n";
    // put the HTTP header and SOAP XML together
    return strHTTPHeader + SOAP_RequestEnvelope;
    }