Hello
Is it possible to return a Crystal ReportDocument from a WebService?
I keep getting the following error:
Exception: System.Web.Services.Protocols.SoapException: Server was unable
to process request. ---System.InvalidOperationException: There was an error
generating the XML document. ---System.InvalidOperationException: The type
CrystalDecisions.CrystalReports.Engine.ReportDocum ent was not expected. Use
the XmlInclude or SoapInclude attribute to specify types that are not known
statically.
at
System.Xml.Serialization.XmlSerializationWriter.Wr iteTypedPrimitive(String
name, String ns, Object o, Boolean xsiType)
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationWriter1.Write1_Object(String n, String ns, Object o, Boolean isNullable, Boolean needType)
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationWriter1.Write13_GetReportResponse(Obje ct[] p)
at
Microsoft.Xml.Serialization.GeneratedAssembly.Arra yOfObjectSerializer21.Serialize(Object objectToSerialize, XmlSerializationWriter writer)
at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter,
Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter,
Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter,
Object o, XmlSerializerNamespaces namespaces, String encodingStyle)
at System.Web.Services.Protocols.SoapServerProtocol.W riteReturns(Object[]
returnValues, Stream outputStream)
at System.Web.Services.Protocols.WebServiceHandler.Wr iteReturns(Object[]
returnValues)
at System.Web.Services.Protocols.WebServiceHandler.In voke()
--- End of inner exception stack trace ---
Method: ReadResponse
How would I use the XmlInclude or SoapInclude? The following is the coee
for the WebMethod:
<WebMethod()_
Public Function GetReport(ByVal strDB_Locale As String, _
ByVal dsReportInfo As System.Data.DataSet, _
ByRef crReport As Object, _
ByRef strMessage As String, _
ByRef strDetailedMessage As String) As Boolean
'************************************************* ************************************************** *******************
'
' Procedure: GetReport
'
' Description: This WebMethod accepts a dataset with report parameters
'
' Parameters:
' strDB_Locale: Database locale (LOCAL or REMOTE)
' dsReportInfo: DataSet containing report parameters
' crReport: Crystal Report Document
' strMessage: Exception message or other user feedback
' strDetailedMessage: Detailed exception message or other user feedback
'
' Return Value: True/False identifying whether report creation was
successful
'
'************************************************* ************************************************** *******************
Dim clsReporting As New Reporting(strDB_Locale.ToUpper)
'Class object to process login request
'Begin structured error handling "Try" block
Try
'Execute "GetReport" method to process report request
Return clsReporting.GetReport(dsReportInfo, _
crReport, _
strMessage, _
strDetailedMessage)
Catch ex As Exception
'Concatenate existing message with exception message
strMessage = String.Concat(strMessage, ControlChars.CrLf,
ControlChars.CrLf, ex.Message)
'Concatenate existing detailed message with detailed exception message
strDetailedMessage = String.Concat(strDetailedMessage,
ControlChars.CrLf, ControlChars.CrLf, ex.StackTrace)
Finally
Try
'Release objects for disposal
clsReporting.Dispose()
Catch ex As Exception
End Try
'Release objects for disposal
clsReporting = Nothing
End Try
End Function
All help would be greatly appreciated.
Thanks
Tom