Hi everyone,
I try to use XMLPorts as Webservices, using a codeunit with global functions which I publish as a Webservice.
The response when entering the URL in IE or Chrome is not what I expected to get:
<s:Fault>
<faultcode xmlns:a="urn:microsoft-dynamics-schemas/error">
a:Microsoft.Dynamics.Nav.Types.Exceptions.NavCSideException
</faultcode>
<faultstring xml:lang="nl-NL">
You must choose a company before you can access the "PSA920_App Resources Timesheet" table.
</faultstring>
<detail>
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">
You must choose a company before you can access the "PSA920_App Resources Timesheet" table.
</string>
</detail>
</s:Fault>
The same XMLPorts and Codeunit work fine in NAV 2009R2, but I get this error in NAV 2013 RTM build 34902.
Webservices working without XML Ports work fine, but as soons as there is one or more global function in the codeunit which uses an XMLPort, the error occurs.
The XMLPort itself works fine when I run it directly.
The tables used by the XMLPorts (as TEMPORARY) can be accessed without problems when I run them directly.
Neither the XMLPort, nor the codeunit, have compile errors.
The Codeunit consists of several functions that use XMLPorts, for instance:
RetrieveLeaveEntries(ResourceCode : Code[20];VAR XMLLeaveEntries : XMLport "PSA920_App Leave Entries")
// Available as Webservice
XMLLeaveEntries.SetParameters(ResourceCode);
IF NOT XMLLeaveEntries.EXPORT THEN
ERROR(TxcErrExportLaveEntries);
The URL is constructed as follows:
http://server:port/service/WS/company/Codeunit/Name
Does this sound familiar to anyone and what might solve this issue?
Thanks!
Answers
PSA920AppResourcesTimesheet.GET;
Please move the code from OnInitXMLport trigger to OnPreXMLport trigger and try
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
The compiler does not warn for it...
=D> =D>