Hello Community,
I'm attempting to see if I can integrate with a Dynamics NAV system. I am using Dynamics NAV 2015 on a MS Azure VM. I have the web services setup on NAV's end and I can hit the endpoints I set up in NAV. I'm also using a third party integration platform that provides a Web Services SOAP Client connector which I'm able to successfully retrieve records from an endpoint. So ReadMultiple works as expected however when I attempt to use Create, CreateMultiple, or Update on an endpoint such as Customer or Sales Order my connection gets reset and NAV on the VM crashes/loses its connection. I'm forced to restart the NAV Server Instance in order to connect to again.
I can update / add a record from either the NAV application itself (on the VM) or using the Web Client from a browser. I can even retrieve records using ReadMultiple multiple time without any problems but any Insert or Update breaks NAV.
Here are the four errors I saw from the server's Event log (Sorry to make this post longer than it needs to be)
1)
HSNAVTEST 7034 Error Microsoft-Windows-Service Control Manager System 11/18/2015 8:02:54 PM
The Microsoft Dynamics NAV Server [NAV] service terminated unexpectedly. It has done this 11 time(s).
2)
HSNAVTEST 1025 Error .NET Runtime Application 11/18/2015 8:02:50 PM
Application: Microsoft.Dynamics.Nav.Server.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Unable to cast object of type 'System.Xml.XmlWhitespace' to type 'System.Xml.XmlElement'.
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceFormXmlAdapter.WriteEntity(XmlElement entity)
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceFormXmlAdapter.InsertEntity(XmlElement entity, Boolean insertBefore)
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceFormXmlAdapter.<>c__DisplayClass19.<CreateMultiple>b__16()
at Microsoft.Dynamics.Nav.Runtime.SessionTransactionManager.TransactionScope(Action code)
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceFormXmlAdapter.CreateMultiple(XmlElement input, XmlWWriter output)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceFormXmlAdapter.<>c__DisplayClass41.<Microsoft.Dynamics.Nav.Service.WebServices.IXmlRequestHandler.Dispatch>b__3d()
at Microsoft.Dynamics.Nav.Service.WebServices.XmlWWriter.SetNamespace(QNamespace namespace, XmlCallback nodeHandler)
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceFormXmlAdapter.Microsoft.Dynamics.Nav.Service.WebServices.IXmlRequestHandler.Dispatch(XmlElement input, XmlWWriter output)
at Microsoft.Dynamics.Nav.Service.WebServices.XmlWWriter.Element(String name, XmlCallback elementHandler)
at Microsoft.Dynamics.Nav.Service.WebServices.XmlWWriter.Element(String name, XmlCallback elementHandler)
at Microsoft.Dynamics.Nav.Service.WebServices.XmlWWriter.SetNamespace(QNamespace namespace, XmlCallback nodeHandler)
at Microsoft.Dynamics.Nav.Service.WebServices.SoapHandler.Microsoft.Dynamics.Nav.Service.WebServices.IXmlRequestHandler.Dispatch(XmlElement input, XmlWWriter output)
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceBroker.DispatchSoap(WebServiceUrlInfo relivantURLPart, XmlReader input, TextWriter output)
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceBroker.Invoke(Boolean isSoapMessage, Uri url, XmlReader input, TextWriter output, NavUserAuthentication navUserAuth)
Stack:
at System.Environment.FailFast(System.String, System.Exception)
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceBroker.Invoke(Boolean, System.Uri, System.Xml.XmlReader, System.IO.TextWriter, Microsoft.Dynamics.Nav.Runtime.NavUserAuthentication)
at Microsoft.Dynamics.Nav.Service.WebServices.NavWebService+<>c__DisplayClass5+<>c__DisplayClass7.<ProcessMessage>b__3()
at Microsoft.Dynamics.Nav.Service.WebServices.Disposer.Scope(Code)
at Microsoft.Dynamics.Nav.Service.WebServices.WCFUtil.GetPopulatedMemoryStream(Microsoft.Dynamics.Nav.Service.WebServices.StreamFillingCallback)
at Microsoft.Dynamics.Nav.Service.WebServices.NavWebService.ProcessMessage(System.ServiceModel.Channels.Message)
at DynamicClass.SyncInvokeProcessMessage(System.Object, System.Object[], System.Object[])
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(System.Object, System.Object[], System.Object[] ByRef)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(System.ServiceModel.Dispatcher.MessageRpc ByRef)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(System.ServiceModel.Dispatcher.MessageRpc ByRef)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(System.ServiceModel.Dispatcher.MessageRpc ByRef)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean)
at System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(System.ServiceModel.Channels.RequestContext, Boolean, System.ServiceModel.OperationContext)
at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(System.ServiceModel.Channels.RequestContext, System.ServiceModel.OperationContext)
at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(System.IAsyncResult)
at System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(System.IAsyncResult)
at System.Runtime.Fx+AsyncThunk.UnhandledExceptionFrame(System.IAsyncResult)
at System.Runtime.AsyncResult.Complete(Boolean)
at System.Runtime.InputQueue`1+AsyncQueueReader[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Set(Item<System.__Canon>)
at System.Runtime.InputQueue`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].EnqueueAndDispatch(Item<System.__Canon>, Boolean)
at System.Runtime.InputQueue`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].EnqueueAndDispatch(System.__Canon, System.Action, Boolean)
at System.ServiceModel.Channels.SingletonChannelAcceptor`3[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Enqueue(System.__Canon, System.Action, Boolean)
at System.ServiceModel.Channels.HttpPipeline+EnqueueMessageAsyncResult.CompleteParseAndEnqueue(System.IAsyncResult)
at System.ServiceModel.Channels.HttpPipeline+EnqueueMessageAsyncResult.HandleParseIncomingMessage(System.IAsyncResult)
at System.Runtime.AsyncResult.SyncContinue(System.IAsyncResult)
at System.ServiceModel.Channels.HttpPipeline+EmptyHttpPipeline.BeginProcessInboundRequest(System.ServiceModel.Channels.ReplyChannelAcceptor, System.Action, System.AsyncCallback, System.Object)
at System.ServiceModel.Channels.HttpChannelListener`1+HttpContextReceivedAsyncResult`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].ProcessHttpContextAsync()
at System.ServiceModel.Channels.HttpChannelListener`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].BeginHttpContextReceived(System.ServiceModel.Channels.HttpRequestContext, System.Action, System.AsyncCallback, System.Object)
at System.ServiceModel.Channels.SharedHttpTransportManager.EnqueueContext(System.IAsyncResult)
at System.ServiceModel.Channels.SharedHttpTransportManager.OnGetContextCore(System.IAsyncResult)
at System.Runtime.Fx+AsyncThunk.UnhandledExceptionFrame(System.IAsyncResult)
at System.Net.LazyAsyncResult.Complete(IntPtr)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(System.Object, IntPtr)
at System.Net.ListenerAsyncResult.IOCompleted(System.Net.ListenerAsyncResult, UInt32, UInt32)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
3)
HSNAVTEST 1000 Error Application Error Application 11/18/2015 8:02:50 PM
Faulting application name: Microsoft.Dynamics.Nav.Server.exe, version: 8.0.42603.0, time stamp: 0x55e020c7
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0x80131623
Fault offset: 0x00007ffa978abc41
Faulting process id: 0xaf78
Faulting application start time: 0x01d122395200f67c
Faulting application path: C:\Program Files\Microsoft Dynamics NAV\80\Service\Microsoft.Dynamics.Nav.Server.exe
Faulting module path: unknown
Report Id: 583d8f67-8e2f-11e5-80ca-000d3a7104f0
Faulting package full name:
Faulting package-relative application ID:
4)
HSNAVTEST 216 Error MicrosoftDynamicsNavServer$NAV Application 11/18/2015 8:02:50 PM
Server instance: NAV
User:
Type: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
StackTrace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceFormXmlAdapter.<>c__DisplayClass41.<Microsoft.Dynamics.Nav.Service.WebServices.IXmlRequestHandler.Dispatch>b__3d()
at Microsoft.Dynamics.Nav.Service.WebServices.XmlWWriter.SetNamespace(QNamespace namespace, XmlCallback nodeHandler)
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceFormXmlAdapter.Microsoft.Dynamics.Nav.Service.WebServices.IXmlRequestHandler.Dispatch(XmlElement input, XmlWWriter output)
at Microsoft.Dynamics.Nav.Service.WebServices.XmlWWriter.Element(String name, XmlCallback elementHandler)
at Microsoft.Dynamics.Nav.Service.WebServices.XmlWWriter.Element(String name, XmlCallback elementHandler)
at Microsoft.Dynamics.Nav.Service.WebServices.XmlWWriter.SetNamespace(QNamespace namespace, XmlCallback nodeHandler)
at Microsoft.Dynamics.Nav.Service.WebServices.SoapHandler.Microsoft.Dynamics.Nav.Service.WebServices.IXmlRequestHandler.Dispatch(XmlElement input, XmlWWriter output)
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceBroker.DispatchSoap(WebServiceUrlInfo relivantURLPart, XmlReader input, TextWriter output)
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceBroker.Invoke(Boolean isSoapMessage, Uri url, XmlReader input, TextWriter output, NavUserAuthentication navUserAuth)
Source: mscorlib
HResult: -2146232828
----------------------------------
Type: System.InvalidCastException
Message: Unable to cast object of type 'System.Xml.XmlWhitespace' to type 'System.Xml.XmlElement'.
StackTrace:
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceFormXmlAdapter.WriteEntity(XmlElement entity)
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceFormXmlAdapter.InsertEntity(XmlElement entity, Boolean insertBefore)
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceFormXmlAdapter.<>c__DisplayClass19.<CreateMultiple>b__16()
at Microsoft.Dynamics.Nav.Runtime.SessionTransactionManager.TransactionScope(Action code)
at Microsoft.Dynamics.Nav.Service.WebServices.ServiceFormXmlAdapter.CreateMultiple(XmlElement input, XmlWWriter output)
Source: Microsoft.Dynamics.Nav.Service.WebServices
HResult: -2147467262
---------------------------END-------------------------
I'm wondering if the XML I'm sending over to NAV is messing it up based on this message from the 4th log
Unable to cast object of type 'System.Xml.XmlWhitespace' to type 'System.Xml.XmlElement'.
Here is a sample Customer Update Request I'm sending to NAV (Added the key due to a previous mentioning something about it)
<?xml version='1.0' encoding='UTF-8'?>
<ns1:Envelope xmlns:ns1="schemas.xmlsoap.org/.../envelope">
<ns1:Body>
<ns2:Update xmlns:ns2="urn:microsoft-dynamics-schemas/page/customer">
<ns2:Customer>
<ns2:Key>24;EgAAAAJ7BTMAMQAzADMANw==6;2914150;</ns2:Key>
<ns2:No>31337</ns2:No>
<ns2:Address>123 Fake Street</ns2:Address>
<ns2:Contact>Rossey</ns2:Contact>
</ns2:Customer>
</ns2:Update>
</ns1:Body>
</ns1:Envelope>
Are there fields that are required that I'm missing or is the XML wonky?
I sincerely thank you for your time and patience for reading this very long post!
*This post is locked for comments