on 11-25-2014 12:55 PM
Hi,
I am using PB 12. to develop a .NET web service.
It needs to read a PDF file stored on another server in a shared directory and returns it to the Web page for download purpose.
The problem is that the functions Fileexists() or Fileopen() always fail to find the file.
It seems that the WebService only knows the subdirectories underneath it's own virtual directory.
eg: C:\Program Files (x86)\webform\webservice_name\webservice_name_root\file\common\c\temp for c:\temp directory
Is there a way to acces other directories or is it mandatory to copy all files in subdirectories web service ?
Best Regards
Hi Thierry;
I perform these type of external file manipulations all the time in my Web Services *. Here are some observations though for you to consider ....
1) Your WS should be deployed to "C:\InetPub\wwwroot\xxxxxxxxx" and not "c:program files"!!!
2) Folders you need access to from your WS should have IIs_User read priviledges
3) You can always use the MS-Windows PowerShell from your WS to assist with external file manipulation.
HTH
* - I only use PB Classic built .Net Web Services
Regards .,.. Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK now the webservice is installed under c;\inetpub and IIS_IUSR have the read privilege.
But the webservice still can't find the file or directory
all functions fails : directoryexists - fileexists - fileopen
for example
if the folder is c:\pdfdoc
the web service is looking for the folder :
C:\inetpub\wwwroot\webservice_XXX_root\file\session\__webservice__\c\pdfdoc
it can only be found if the directroy exits in
C:\inetpub\wwwroot\webservice_xxx_root\file\common\c\pdfdoc
How can i acces and operate a fileread in the c:\pdfdoc directory ?
Any suggestion ? is it a PB 12.0 Classic bug ?
Hi Thierry;
Excellent ... now that the WS is installed properly it will have the proper rights under the IIs directory scheme. 🙂
Now, to access any external files outside the IIs realm - you need to 1st copy them to your WS's working folder (which you already have correctly identified under " .... \session\_webservice_\c\xxxxx".
So what I do is use the MS-Windows "PowerShell" in my STD Framework to move external files In/Out of the WS's work area to be accessible to the WS code. For example, the following code is used to gain access to a common INI file ...
String ls_ini_file | // Work Var's |
String ls_ini_check
String ls_session_folder
String ls_pb_version
String ls_command = "XCOPY /Y "
String ls_section_trace = "Trace"
String ls_section_system = "System"
String ls_section_debug = "Debug"
String ls_section_service = "WebService"
Char | lc_language = "E" |
// Establish INI file Location
ls_ini_file = THIS.of_get_ini_path ( ) + THIS.of_get_ini_file_name ( ) | // Get Deployed INI file name |
ls_session_folder = THIS.of_get_virtual_path ( ) // Get Session folder path
ls_command += ls_ini_file // Add source
ls_command += Space (2) + ls_session_folder // Add destination
ls_ini_check = THIS.of_get_ini_file_name ( ) // Target INI path
IF FileExists (ls_ini_check) = FALSE THEN | // INI file present? |
ii_rc = THIS.of_run (ls_command, TRUE, TRUE) // NO=>Run XCOPY
IF ii_rc <> 0 THEN // xCopy OK?
THIS.of_write_log ("XCOPY Failed for INI file: '" + ls_ini_file + & | ||
"' - RC: " + String (ii_rc)) | // NO=Log it! | |
else | ||
IF THIS.of_is_debug_mode( ) = TRUE THEN // YES=>Debug ON? | ||
THIS.of_write_log ( "INI file: '" + ls_ini_file + & | ||
"' - refreshed in the Session folder!") // YES=>Log refresh | ||
END IF |
END IF
else
IF THIS.of_is_debug_mode( ) = TRUE THEN // YES=>Debug ON?
THIS.of_write_log ( "INI file: '" + ls_ini_check + & | ||
"' - refresh bypassed in the Session folder!") | //YES=>Log Bypass |
END IF
END IF
HTH
Regards ... Chris
Great news!
BTW: I just released an updated version of the Web Service framework yesterday ...
Great White North Technical Evangelist: STD Web Service Framework - Version 2.2 Released!
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.