dymosoftware / DCD-SDK-Sample

DYMO Connect SDK Samples
Other
60 stars 26 forks source link

PreviewAndPrintLabel sample code broken #25

Open JamesHouden opened 3 years ago

JamesHouden commented 3 years ago

Running the PreviewAndPrintLabel sample code in github, forcing the load of the sample .dymo or .label file using openLabelXml results in the below exception from https://127.0.0.1:41951/DYMO/DLS/Printing/RenderLabel

I'm using Dymo Connect 8.7.3

Here's the full error. See the sample application to repro issue.

VM172:1 POST https://127.0.0.1:41951/DYMO/DLS/Printing/RenderLabel 500
(anonymous) @ VM172:1
ajaxSync @ dymo.connect.framework.js:2
invokeWsCommand @ dymo.connect.framework.js:2
DlsWebService.renderLabel @ dymo.connect.framework.js:2
renderLabel @ dymo.connect.framework.js:2
dymo.label.framework.renderLabel @ dymo.connect.framework.js:2
dymo.label.framework.Label.render @ dymo.connect.framework.js:2
updatePreview @ PreviewAndPrintLabel.js:46
(anonymous) @ PreviewAndPrintLabel.js:114
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
l @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
load (async)
send @ jquery.min.js:2
ajax @ jquery.min.js:2
S.<computed> @ jquery.min.js:2
labelFile.onchange @ PreviewAndPrintLabel.js:103
dymo.connect.framework.js:2 Uncaught Error: {"message"

{"message":"An error has occurred.","exceptionMessage":"ReadElementContentAs() methods cannot be called on an element that has child elements. Line 3, position 6.","exceptionType":"System.Xml.XmlException","stackTrace":"   at System.Xml.XsdValidatingReader.InternalReadElementContentAsObject(XmlSchemaType& xmlType, Boolean unwrapTypedValue, String& originalString)\r\n   at System.Xml.XsdValidatingReader.ReadElementContentAsString()\r\n   at DYMO.LabelAPI.DYMOLabel`1.Deserialize(XmlReader reader)\r\n   at DYMO.CrossPlatform.Common.Helpers.SerializationHelper.Deserialize[T](XmlReader reader)\r\n   at DYMO.LabelAPI.LabelHelper.ReadAndOpenLabel(XmlReader reader)\r\n   at DYMO.LabelAPI.LabelHelper.OpenLabel(XmlReader reader)\r\n   at DymoSDK.Implementations.DymoLabel.LoadLabelFromXML(String xmlContent)\r\n   at DYMOWebApi.Windows.Controllers.DymoDLSSDKController.RenderLabel(FormDataCollection formDataCollection)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()"}: 
    at ajaxSync (dymo.connect.framework.js:2)
    at invokeWsCommand (dymo.connect.framework.js:2)
    at DlsWebService.renderLabel (dymo.connect.framework.js:2)
    at Object.renderLabel (dymo.connect.framework.js:2)
    at Object.dymo.label.framework.renderLabel (dymo.connect.framework.js:2)
    at dymo.label.framework.Label.render (dymo.connect.framework.js:2)
    at updatePreview (PreviewAndPrintLabel.js:46)
    at Object.success (PreviewAndPrintLabel.js:114)
    at c (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)

the loaded labels cause isValidLabel return as false

dymosoftware commented 3 years ago

Running the PreviewAndPrintLabel sample code in github, forcing the load of the sample .dymo or .label file using openLabelXml results in the below exception from https://127.0.0.1:41951/DYMO/DLS/Printing/RenderLabel

I'm using Dymo Connect 8.7.3

Here's the full error. See the sample application to repro issue.

VM172:1 POST https://127.0.0.1:41951/DYMO/DLS/Printing/RenderLabel 500
(anonymous) @ VM172:1
ajaxSync @ dymo.connect.framework.js:2
invokeWsCommand @ dymo.connect.framework.js:2
DlsWebService.renderLabel @ dymo.connect.framework.js:2
renderLabel @ dymo.connect.framework.js:2
dymo.label.framework.renderLabel @ dymo.connect.framework.js:2
dymo.label.framework.Label.render @ dymo.connect.framework.js:2
updatePreview @ PreviewAndPrintLabel.js:46
(anonymous) @ PreviewAndPrintLabel.js:114
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
l @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
load (async)
send @ jquery.min.js:2
ajax @ jquery.min.js:2
S.<computed> @ jquery.min.js:2
labelFile.onchange @ PreviewAndPrintLabel.js:103
dymo.connect.framework.js:2 Uncaught Error: {"message"

{"message":"An error has occurred.","exceptionMessage":"ReadElementContentAs() methods cannot be called on an element that has child elements. Line 3, position 6.","exceptionType":"System.Xml.XmlException","stackTrace":"   at System.Xml.XsdValidatingReader.InternalReadElementContentAsObject(XmlSchemaType& xmlType, Boolean unwrapTypedValue, String& originalString)\r\n   at System.Xml.XsdValidatingReader.ReadElementContentAsString()\r\n   at DYMO.LabelAPI.DYMOLabel`1.Deserialize(XmlReader reader)\r\n   at DYMO.CrossPlatform.Common.Helpers.SerializationHelper.Deserialize[T](XmlReader reader)\r\n   at DYMO.LabelAPI.LabelHelper.ReadAndOpenLabel(XmlReader reader)\r\n   at DYMO.LabelAPI.LabelHelper.OpenLabel(XmlReader reader)\r\n   at DymoSDK.Implementations.DymoLabel.LoadLabelFromXML(String xmlContent)\r\n   at DYMOWebApi.Windows.Controllers.DymoDLSSDKController.RenderLabel(FormDataCollection formDataCollection)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()"}: 
    at ajaxSync (dymo.connect.framework.js:2)
    at invokeWsCommand (dymo.connect.framework.js:2)
    at DlsWebService.renderLabel (dymo.connect.framework.js:2)
    at Object.renderLabel (dymo.connect.framework.js:2)
    at Object.dymo.label.framework.renderLabel (dymo.connect.framework.js:2)
    at dymo.label.framework.Label.render (dymo.connect.framework.js:2)
    at updatePreview (PreviewAndPrintLabel.js:46)
    at Object.success (PreviewAndPrintLabel.js:114)
    at c (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)

the loaded labels cause isValidLabel return as false

Hi @JamesHouden, which label are you trying to load? Did you create the label from DYMO Connect or DLS? There is no DYMO Connect 8.7.3, I think what you mean is DYMO Label Software(DLS) 8.7.3.

JamesHouden commented 3 years ago

I created a simple label in Dymo Connect. When going into the About popup it says 1.3.2.18.

JamesHouden commented 3 years ago

test.txt Here's the file, I had to rename the suffix to .txt so github would allow it. Rename back to .dymo

andrewlorenz commented 3 years ago

exact same issue here, for a very similar dymo XML file (that was exported from the Dymo Connect software)

darojuv-aegis commented 2 years ago

Any update on this?

edvn0 commented 1 year ago

I quote-unquote solved this by using DLS instead of DYMO connect. It seems that the DYMO Connect format for labels is very different to that of DLS. DLS + these APIs works fine for me on my M1 Pro Mac. So until DYMO Connect fixes their format, this will be my preferred solution. @darojuv-aegis @andrewlorenz @JamesHouden