cancel
Showing results for 
Search instead for 
Did you mean: 

PB 12.0 .Net Webservice PDF file open

Former Member
0 Kudos


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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

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 ?

Former Member
0 Kudos

Try with inetmgr to create a Virtual directory under your WS application.

Regards.

Abdallah.

Former Member
0 Kudos

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

Former Member
Former Member
0 Kudos

Thanks for help Chris.

i managed to copy the PDF to the virtual directory with Powershell command and by changing the application pool's identity.

Regards

Former Member
0 Kudos

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!