Calling XMLPORT - error Works Fine when calling from Form

nav_studentnav_student Member Posts: 175
edited 2013-09-26 in NAV Three Tier
Hello guys,

use this code from the Form
   modxmlport.SetIDFilter("DocumentNo");
  _File.CREATE('C:\temp\xmlport_document\docABC.xml');
  _File.CREATEOUTSTREAM(_DatafileOutstream);
   modxmlport.SETDESTINATION(_DatafileOutstream);
   modxmlport.EXPORT;
  _File.CLOSE;

But when i apply on the Pages

View -> Page Actions
(Type Action)

appears a strange behaviour
window appears
the server "localhost:7046/DynamicsNAV" is not available. The connection was lost...

What i´m doing wrong?

Updated:
I have comment code lines one by one and the problem is on this line
modxmlport.EXPORT;

Event Viewer
Service: MicrosoftDynamicsNavServer
User: DMVS\Administrator
Type: System.InvalidOperationException
Message: The Writer is closed or in error state.
StackTrace:
at Microsoft.Dynamics.Nav.Runtime.NavApplicationMethod.InvokeMethod(Object obj, String methodName, Object[] args)
at Microsoft.Dynamics.Nav.Service.NSField.ActionField(NavConnection con)
at Microsoft.Dynamics.Nav.Service.NSField.Action(NavConnection connection)
at Microsoft.Dynamics.Nav.Service.NSService.<>c__DisplayClass21.<ActionField>b__20(Connection connection)
at Microsoft.Dynamics.Nav.Service.NSService.ExecuteOperation[T](String operationName, ServiceOperation`1 operation, Connection connection, Boolean revertLanguageChanges, WindowsIdentity impersonationIdentity)
Source: Microsoft.Dynamics.Nav.Ncl

Type: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
StackTrace:
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Dynamics.Nav.Runtime.NavApplicationMethod.InvokeMethod(Object obj, String methodName, Object[] args)
Source: mscorlib
Type: System.InvalidOperationException
Message: The Writer is closed or in error state.
StackTrace:
at System.Xml.XmlWellFormedWriter.AdvanceState(Token token)
at System.Xml.XmlWellFormedWriter.WriteEndElement()
at Microsoft.Dynamics.Nav.Runtime.NavXmlPortXmlAdapter.WriteEndElement(XmlPortNodeSourceType sourceType)
at Microsoft.Dynamics.Nav.Runtime.NavXmlPortExporter.ProcessTableElement(NavXmlPortTableNode node)
at Microsoft.Dynamics.Nav.Runtime.NavXmlPortExporter.ProcessElement(NavXmlPortNode node)
at Microsoft.Dynamics.Nav.Runtime.NavXmlPortExporter.TryProcessElement(NavXmlPortNode node)
at Microsoft.Dynamics.Nav.Runtime.NavXmlPortExporter.Export()
at Microsoft.Dynamics.Nav.Runtime.NavXmlPort.WriteContentToStream()
at Microsoft.Dynamics.Nav.Runtime.NavXmlPort.Export(DataError errorLevel)
at Microsoft.Dynamics.Nav.BusinessApplication.Page50100.Control1000000024_OnAction()
Source: System.Xml

Comments

  • Wisa123Wisa123 Member Posts: 308
    Is the file properly Created?
    Austrian NAV/BC Dev
  • nav_studentnav_student Member Posts: 175
    The file is properly created from the Form.

    I notice that the problems is on the code
    XMLPORT.EXPORT when the begining is from the RTC client.

    Strange issue.

    Can you help me?
Sign In or Register to comment.