Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Dynamics NAV crashes when attempting to Insert/Update using Web Services

Posted on by Microsoft Employee

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

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics NAV crashes when attempting to Insert/Update using Web Services

    Here is the final update for the issue I was having. I was able to get it resolved. The issue was that the request being sent to NAV had whitespace characters after the tags which NAV is very picky with. Removing the extra characters, essentially having a one line string fixed the issue. The extra characters were being added from the integration platform we're using (probably for display purposes).

    I was also provided this link from the team behind the integration platform which mentioned removing whitespace characters (stackoverflow.com/.../post-soap-envelop-to-ms-dynamics-nav-web-service). Hopefully this information helps someone else in the future.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics NAV crashes when attempting to Insert/Update using Web Services

    So sorry for the delayed update but I made some progress on the issue. So I used the C# script found here msdn.microsoft.com/.../dd355316(v=nav.80).aspx which I made a couple of minor changes but ran it on the Azure VM using Visual Studios 2015. It worked with no issue even after running it a few times. Now when I go back to using the integration platform that provides a SOAP web connector, the NAV server crashes when I try to insert a new record though I can read records from an endpoint with no problem. I'm going to try running the same script from the link above on my local machine and try to do the same in a Java program since the integration platform we're using is built using Java.

    I'll probably will need to open a support ticket with team behind the platform we're using but would anyone have an idea as to how a request could cause a NAV server to crash severely?

    Thanks!

  • aavio Profile Picture
    aavio 895 on at
    RE: Dynamics NAV crashes when attempting to Insert/Update using Web Services

    Could you try the following

    - try with different customer data.

    - dont copy paste data for testing from excel file, try to key in manually.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics NAV crashes when attempting to Insert/Update using Web Services

    Yea, I tried that and the same thing happens unfortunately.

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Dynamics NAV crashes when attempting to Insert/Update using Web Services

    Did you try just sending the No. ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics NAV crashes when attempting to Insert/Update using Web Services

    Unfortunately I do not have .net code to share. The third party connector I am using is built on a Java code base. I could share this exception that was thrown when attempting to Update if that provides any help

    com.boomi.webservices.WebServiceException: Error invoking soap operation

    at com.boomi.webservices.DocumentExecutor.execute(DocumentExecutor.java:241)

    at com.boomi.connector.wssoapclient.WSSDKExecuteOperation.executeUpdate(WSSDKExecuteOperation.java:98)

    at com.boomi.connector.wssoapclient.WSSDKExecuteOperation.executeUpdate(WSSDKExecuteOperation.java:73)

    at com.boomi.connector.util.BaseUpdateOperation.execute(BaseUpdateOperation.java:36)

    at com.boomi.connector.generic.GenericConnectorAction.invoke(GenericConnectorAction.java:165)

    at com.boomi.connector.base.BaseConnectorAction.invokeBase(BaseConnectorAction.java:275)

    at com.boomi.connector.base.BaseConnectorAction.invoke(BaseConnectorAction.java:214)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke(Method.java:483)

    at com.boomi.util.ClassUtil$InvokerWithClassLoader.invoke(ClassUtil.java:360)

    at com.sun.proxy.$Proxy36.invoke(Unknown Source)

    at com.boomi.process.shape.ConnectorShapeHandler.execute(ConnectorShapeHandler.java:152)

    at com.boomi.process.shape.ConnectorShape.execute(ConnectorShape.java:139)

    at com.boomi.process.graph.ProcessShape.executeShape(ProcessShape.java:544)

    at com.boomi.process.graph.ProcessGraph.executeShape(ProcessGraph.java:488)

    at com.boomi.process.graph.ProcessGraph.executeNextShapes(ProcessGraph.java:572)

    at com.boomi.process.graph.ProcessGraph.executeShape(ProcessGraph.java:509)

    at com.boomi.process.graph.ProcessGraph.executeNextShapes(ProcessGraph.java:572)

    at com.boomi.process.graph.ProcessGraph.execute(ProcessGraph.java:307)

    at com.boomi.process.ProcessExecution.call(ProcessExecution.java:772)

    at com.boomi.execution.ExecutionTask.call(ExecutionTask.java:891)

    at com.boomi.execution.ExecutionTask.call(ExecutionTask.java:61)

    at com.boomi.util.concurrent.CancellableFutureTask.run(CancellableFutureTask.java:172)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

    at java.lang.Thread.run(Thread.java:745)

    Caused by: javax.xml.ws.WebServiceException: java.net.SocketException: Connection reset

    at com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:212)

    at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:162)

    at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:94)

    at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:116)

    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)

    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)

    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)

    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)

    at com.sun.xml.ws.client.Stub.process(Stub.java:222)

    at com.sun.xml.ws.client.dispatch.DispatchImpl.doInvoke(DispatchImpl.java:180)

    at com.sun.xml.ws.client.dispatch.DispatchImpl.invoke(DispatchImpl.java:206)

    at com.boomi.webservices.DocumentExecutor.execute(DocumentExecutor.java:219)

    ... 27 more

    Caused by: java.net.SocketException: Connection reset

    at java.net.SocketInputStream.read(SocketInputStream.java:189)

    at java.net.SocketInputStream.read(SocketInputStream.java:121)

    at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)

    at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)

    at java.io.BufferedInputStream.read(BufferedInputStream.java:345)

    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:703)

    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)

    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1535)

    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)

    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)

    at com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:209)

    ... 38 more

    -----------------------END--------------------------

    I'm going to try to see if I can do something with C# and see if the same issue comes up.

  • aavio Profile Picture
    aavio 895 on at
    RE: Dynamics NAV crashes when attempting to Insert/Update using Web Services

    Could you also try debug from your visual studio solution? check if any exception upon executing Create/update fns.

  • aavio Profile Picture
    aavio 895 on at
    RE: Dynamics NAV crashes when attempting to Insert/Update using Web Services

    can you also share update method .net code

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans