When I expose a codeunit to web service the automation not work and cannot be created.
I have a codeunit that works fine with an automation that calls a custom dll compiled from visual basic 6 sp6.
We never had a problem with that and it worked as a charm. Now we decided that we want this functionality as a web service and when I exposed the codeunit the automation crash and cannot be created. Why?
Ok := NOT ISCLEAR(automation);
IF NOT Ok THEN
Ok := CREATE(automation, FALSE, ISSERVICETIER);
IF Ok THEN BEGIN
returnvalue := automation.function(variable1,variable2,variable3,variable4);
CLEAR(automation);
END;
EXIT(returnvalue);
When I run it through Classic or RTC the Ok is TRUE which means the automation was created succesfully. When call it from Web Service the Ok is FALSE.
The names automation, function, returnvalue, variable1,2,3 and 4 are hypothetical but the structure of the code is exactly the same.
Comments
is it possible that ISSSERVICETIER is true? Should be true because the WS is a service. So you need to create the automation on the server.
try
With kind regards
mik
So for the classic is false, for the web service is false but for the RTC is true?
when you run on RTC or WS, the parameter is always true in your case (because you set ISSERVICETIER as the third parameter.).
i think that the client from where you consumed the WS couldn't create the automation (because it's not installed on that pc?).
this link could help:
http://dynamicsuser.net/blogs/waldo/archive/2009/12/01/where-am-i.aspx
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
I can't believe that it would work even if you install the automation on the client. The automation must be on the machine where the code is running. In your case on the service tier.
With kind regards
mik
but I've a question:
example:
i have excel on my pc, but there's no excel on the pc of the service tier. thus i program my automation to run "onclient", that is, on my client pc. In that case, you don't need to have excel on service tier, isn't it?
so, why does't work the same way for webservices, too? I've not much experience with webservice, but if i tell nav that the automation must run on client, it HAVE to run on client...what am i missing? :roll:
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
hmmm ... :-k
I think we need someone who knows the architecture of this behavior.
But I would guess that the excel automation in your case is not started from the service tier. Instead the RTC will do that work.
But I repeat myself ... hmmmm :-k
greetings
With kind regards
mik
I've done code that is using the automation on client side if its classic, and on server side if its RTC/Webservice. this works fine:
btw: i guess if you are using webservice the OnClient is ignored because its both Client&Server. so you could also have a TRUE for OnClient parameter and it would have the same effect. I'am using the "NOT ISSERVICETIER" because we only use classic & webservices on that project, so this code makes more sense for me, but a TRUE would work too i guess.
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog