Dim ICS As New RetailItemCard_Service Dim CRED As New System.Net.NetworkCredential("user", "XXXXX", "ourdomain.com") ICS.Credentials = CRED Dim IC As New RetailItemCard.RetailItemCard() IC = ICS.Read(0, "123123123") dim description as string description = IC.Description
Server Error in '/' Application. -------------------------------------------------------------------------------- Unable to cast object of type 'Microsoft.Dynamics.Nav.Runtime.NavInteger' to type 'Microsoft.Dynamics.Nav.Runtime.NavCode'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.Services.Protocols.SoapException: Unable to cast object of type 'Microsoft.Dynamics.Nav.Runtime.NavInteger' to type 'Microsoft.Dynamics.Nav.Runtime.NavCode'. Source Error: Line 16: Line 17: IC = ICS.Read(0, No.Text) Line 18: dim description as string Line 19: description = IC.Description Source File: c:\inetpub\wwwroot\tools\nav\Default.aspx.vb Line: 17 Stack Trace: [SoapException: Unable to cast object of type 'Microsoft.Dynamics.Nav.Runtime.NavInteger' to type 'Microsoft.Dynamics.Nav.Runtime.NavCode'.] System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +431766 System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +204 RetailItemCard.RetailItemCard_Service.Read(Int32 ShowStandardCard, String No) +85 Tools_NAV_Default.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\tools\nav\Default.aspx.vb:17 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Don't think so... I think the problem may have something to do with the "showstandardcard" (Integer) parameter on the "Read" method. The typical ItemCard reference does not have this parameter. I'm guess that it would take either 0 or 1 (0 = don't show standard card, 1 = show standard card) but perhaps my guess is wrong.
If there are any LSRetail folks reading this, perhaps you could shed some light on this parameter to help us out? (Since it seems like this is an LSRetail page, and not a standard NAV page).
Thanks for your suggestions!
Problem Solved!!!
We found out that the extra parameter on the Retail Item Card (show standard card) was appearing in the web services because the on page 10000807 the Control ShowStandardCard was indented incorrectly. We corrected this, updated the web-reference, then the "showstandardcard" parameter disappeared! We had only the "No" (representing the Item No.) parameter available.
We recompiled and everything worked great!