Hello,
First of all, yes, I have read all the posts about magic path, <TEMP>, 3 tier automation, etc. I'm comfortable with this.
My problem is that the same code behaves differently from the "Web Service Tier" than the regular service tier.
When I call BLOBExport from the service tier it says "Callback functions are not allowed."
When I run it from RTC, there is no callback functions though. (No prompt to save file, etc.) so everything from web service should be good, right?
Any hints would be appreciated. I'm running it as the same user in both instances. The only difference as far as I can tell is the web vs nav tier.
This is in NAV 2009 build 33729.
- Reinhard
fileLoc := tierMgt.BLOBExport(tmpBlob,'',FALSE);
///////////////
BLOBExport(VAR BLOBRef : TEMPORARY Record TempBlob;Name : Text[1024];CommonDialog : Boolean) : Text[1024]
IF NOT ISSERVICETIER THEN
EXIT(BLOBRef.Blob.EXPORT(Name,CommonDialog))
ELSE BEGIN
BLOBRef.Blob.CREATEINSTREAM(NVInStream);
IF STRPOS(Name,'*') = 0 THEN
ToFile := Name
ELSE BEGIN
ToFile := INSSTR(Name,Text001,1);
ToFile := DELCHR(ToFile,'=','*');
END;
WHILE STRPOS(ToFile,'\')<>0 DO BEGIN
p := STRPOS(ToFile,'\');
ToFile := COPYSTR(ToFile, p+1);
END;
Path := 'C:\TEMP';
IF NOT CommonDialog THEN
Path := Magicpath;
DOWNLOADFROMSTREAM(NVInStream,Text006,Path,Text009,ToFile);
EXIT(ToFile);
END
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I think the thing is in ISSERVICETIER statement. Looks like webservice service does present himself as servicetier.
Maybe it worth to try ISGUIALLOWED istead?
ppavuk: yes, that's correct. the web service presents itself as service tier, since it is.
In 2009 there are four environments: Classic, RTC, NAS, and Web. Using a cominbation of GUIALLOWED and ISSERVICETIER you can identify which one you are on. Web is ISSERVICETIER AND (NOT GUIALLOWED)
To verify, I have given your suggestion a try, but it gives the error "The EXPORT() method is obsolete" which is as expected.
I think I'm going to convert this to run from NAS.
But the code works fine running from RTC, it's even using the same user, so I figured web service should work as well, so that is still bugging me.
- Reinhard
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
ah I see. I have taken a closer look at the definition of DOWNLOADFROMSTREAM and it specifies that it is to the client.
I agree with you here. This is where I was stuck, but you have pointed me in the right direction:
viewtopic.php?f=5&t=36646&start=0
It describes how to take a blob, create an outstream, and create a file and create an instream. Then COPYSTREAM will do the trick.
I guess it might be nice to work this function into the 3-tier blob export function under a "if not guiallowed" section inside the ISSERVICETIER
then the function would work in all four of the possible setups, rather than just 3.
thanks for your help! (sorry too much coffee the last couple of days, wasn't thinking straight!)
- Reinhard