I'm having a lot of trouble achieving a simple alteration to some code which previously worked on Reporting Server 2000, but now needs to work on Reporting Services 2008R2. I'm trying to avoid redeveloping the whole solution, and would just like to unlock the problem with this code. I'm currently getting an error:
<faultstring>The value for parameter 'Format' is not specified. It is either missing from the function call, or it is set to null. ---> Microsoft.ReportingServices.Diagnostics.Utilities.MissingParameterException: The value for parameter 'Format' is not specified. It is either missing from the function call, or it is set to null.</faultstring>
This is from the ResponseText returned after the line
oXMLHTTPRequest.send (oDocument.XML)
The function code is below. I'm setting the Format property as "PDF" and I can't see why that'd be a problem. Do I have a namespace wrong, a case-sensitivity issue, or is this form of calling the Render method not supported in 2008R2?
Public Function GenerateReportingService(oDom As MSXML2.DOMDocument, sReportName As String) As Variant Dim sSOAPMsg As String Dim oDocument As New MSXML2.DOMDocument60 Dim oXMLHTTPRequest As New MSXML2.XMLHTTP60 Dim sParamName As String Dim sParamValue As String Dim sUserName As String Dim sPassword As String Dim sWebMethod As String Dim sReport As String Dim sFormat As String Dim sHistoryID As String Dim sDeviceInfo As String Dim sShowHideToggle As String Dim sWebservicesURL As String Dim sWebservicesURI As String Dim nodeReport_Line As MSXML2.IXMLDOMNodeList Dim nodeInvReport_Line As MSXML2.IXMLDOMNodeList Dim nodeXMLErrorMsg As MSXML2.IXMLDOMNodeList sWebservicesURL = Reg_ReadRegistry(HKEY_LOCAL_MACHINE, REGKEY_REPORTS, REGKEY_REPORT_PATH) 'http://sqlrs01/reportserver/reportexecution2005.asmx/ sWebservicesURI = "http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/" sReportName = Trim(sReportName) Select Case sReportName Case "XML_ELEMENT_BR01_INVENTORY_ROOT" sReport = "/Binstock Reports/InventoryReport" sParamName = "XmlString" Case "XML_ELEMENT_BR02_ADJUSTMENT_ROOT" sReport = "/Binstock Reports/AdjustmentReport" sParamName = "XMLString" Case "XML_ELEMENT_BR03_STOCK_COUNT_ROOT" sReport = "/Binstock Reports/StockcountReport" sParamName = "XMLString" End Select sFormat = "PDF" sDeviceInfo = vbNullString sShowHideToggle = vbNullString sWebMethod = "Render" sParamValue = oDom.XML Set nodeReport_Line = oDom.getElementsByTagName("report_line") Set nodeXMLErrorMsg = oDom.getElementsByTagName("error_level") Set nodeInvReport_Line = oDom.getElementsByTagName("report_line") If (nodeReport_Line.length = 1) Then If (nodeXMLErrorMsg.Item(0).Text = "0") Then sParamValue = Replace(sParamValue, "<message>", "<message>.") sParamValue = Replace(sParamValue, "<MESSAGE>", "<MESSAGE>.") End If End If sParamValue = Replace(sParamValue, vbCrLf, "") sParamValue = Replace(sParamValue, "<", "<") sParamValue = Replace(sParamValue, ">", ">") sSOAPMsg = "<?xml version='1.0' encoding='utf-8'?>" & vbCrLf sSOAPMsg = sSOAPMsg & "<soap:Envelope xmlns:soap = 'http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" sSOAPMsg = sSOAPMsg & "<soap:Body><Render xmlns = 'http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/'>" sSOAPMsg = sSOAPMsg & "<Report>" & sReport & "</Report>" sSOAPMsg = sSOAPMsg & "<Format>" & sFormat & "</Format>" sSOAPMsg = sSOAPMsg & "<DeviceInfo>" & sDeviceInfo & "</DeviceInfo>" sSOAPMsg = sSOAPMsg & "<Parameters><ParameterValue><Name>" & sParamName & "</Name><Value>" & sParamValue & "</Value></ParameterValue></Parameters>" sSOAPMsg = sSOAPMsg & "<Credentials><UserName>" & sUserName & "</UserName><Password>" & sPassword & "</Password></Credentials>" sSOAPMsg = sSOAPMsg & "<ShowHideToggle>" & sShowHideToggle & "</ShowHideToggle>" sSOAPMsg = sSOAPMsg & "</Render></soap:Body></soap:Envelope>" oDocument.loadXML sSOAPMsg oXMLHTTPRequest.open "POST", sWebservicesURL, False oXMLHTTPRequest.setRequestHeader "Accept", "text/xml" oXMLHTTPRequest.setRequestHeader "Cache-Control", "no-cache" oXMLHTTPRequest.setRequestHeader "SOAPAction", sWebservicesURI & sWebMethod oXMLHTTPRequest.setRequestHeader "Content-Type", "text/xml; charset=utf-8" oXMLHTTPRequest.send (oDocument.XML) GenerateReportingService = SavePDF(oXMLHTTPRequest.responseText, COMPONENT_NAME, sReportName) End Function
I've done extensive searching for a solution to this and am really struggling.
Thank you.
Tim Johnstone Senior Technical Consultant Computacenter (UK) Ltd