none
NullReference exception while invoking an RFC RRS feed

  • General discussion

  • I'm getting the null Reference exception when calling an RFC which is pretty straight forward.

    I've also attached the stack trace

    "\r\nServer stack trace: \r\n   at Microsoft.Adapters.SAP.XmlGenerator.Read()\r\n   at System.Xml.XmlReader.ReadEndElement()\r\n   at System.Xml.XmlDictionaryReader.ReadElementContentAsString()\r\n   at ReadRHOM_ESA_EMPLOYEE_TABFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )\r\n   at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)\r\n   at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)\r\n   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)\r\n   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)\r\n   at ReadArrayOfRHOM_ESA_EMPLOYEE_TABFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )\r\n   at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)\r\n   at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)\r\n   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)\r\n   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)\r\n   at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)\r\n   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)\r\n   at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName)\r\n   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)\r\n   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameter(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)\r\n   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameters(XmlDictionaryReader reader, PartInfo[] parts, Object[] parameters, Boolean isRequest)\r\n   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)\r\n   at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)\r\n   at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)\r\n   at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)\r\n   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)\r\n   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)\r\n   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)\r\n   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)\r\n   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)\r\n\r\nException rethrown at [0]: \r\n   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)\r\n   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)\r\n   at Rfc.RHOM_ESA_MAN_BY_EMP_QUERY(RHOM_ESA_MAN_BY_EMP_QUERYRequest request)\r\n   at RfcClient.Rfc.RHOM_ESA_MAN_BY_EMP_QUERY(RHOM_ESA_MAN_BY_EMP_QUERYRequest request) in D:\\TimesheetApp\\ConsoleApplication8\\SAPBindingClient.cs:line 371\r\n   at RfcClient.RHOM_ESA_MAN_BY_EMP_QUERY(String IV_EMPLOYEE_NUMBER, String IV_KEYDATE, BAPIRET2[]& ET_MESSAGES) in D:\\TimesheetApp\\ConsoleApplication8\\SAPBindingClient.cs:line 385\r\n   at ConsoleApplication8.Program.Main(String[] args) in D:\\TimesheetApp\\ConsoleApplication8\\Program.cs:line 17\r\n   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   at System.Threading.ThreadHelper.ThreadStart()"

    The RFC name is "RHOM_ESA_MAN_BY_EMP_QUERY"

    RfcClient client = new RfcClient();
                client.ClientCredentials.UserName.UserName = "username";
                client.ClientCredentials.UserName.Password = "password";
                string dateCurrent = DateTime.Now.ToString("yyyyMMdd");
                BAPIRET2[] ret = new BAPIRET2[1];
                RHOM_ESA_EMPLOYEE_TAB[] employeeTab = client.RHOM_ESA_MAN_BY_EMP_QUERY("1000", dateCurrent, ref ret);
    Is there anything which am missing here?
    Wednesday, May 27, 2009 6:47 PM

All replies

  • Not sure why you put a null value in the array.

    MSMVP VC++
    Wednesday, May 27, 2009 10:04 PM
  • I tried all.
    I believe if you have SAP access, it worth trying the same RFC.
    Wednesday, May 27, 2009 10:05 PM
  • I was not able to find the RFC at my local SAP deployment.

    What are the types of the parameters that you are passing ?

    Also,  RHOM_ESA_EMPLOYEE_TAB looks like a tabe type.

    In the proxy genrated from AddAdapterService reference,  table types are always INOUT(ref) parammeters.

    But here, the table is manifesting as the return type of  of the genrated proxy function (i.e  a OUT parameter ).

    How did you genrate the proxy code(using Add adapter Service reference  or some other mechanism)?

    Did you make some changes to the genrated proxy ?

    What is the version of svcutil.exe on your machine ?


    Thursday, May 28, 2009 8:35 AM
  • Hi,shrinidhi5048

    We are changing the issue type to “General Disscusion” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question”  If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

    Thank you!
    Microsoft Online Community Support
    Thursday, June 4, 2009 1:09 AM
    Moderator