C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » Webservices »

Webservices method to create and write a pdf file


Posted Date: 04 Sep 2008      Posted By: Ben      Member Level: Bronze     Points: 1   Responses: 7



The webservices I have developed is to create and write a pdf file in a specified directory using the document printer SDK com object. This works fine in development system, but when deployed into the webserver the file is not created. All the other methods of the webservice work fine expect this method which is to create and write the pdf file into the specified directory. When i copied that pdf file from developer machine to the webserver folder the webservice method works fine. Is that i am missing any ASP.NET security issues in the webserver that blocks to create a file ?. My webserver is windows2003





Responses

Author: J Ramesh    04 Sep 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

Hi Ben,

Did you check whether you have the write permissions to the folder where you are trying to generate the PDF file through webservice.

Check that may be the folder does not have permission to write.

Regards
Ramesh



Author: Ben    05 Sep 2008Member Level: BronzeRating: 2 out of 52 out of 5     Points: 2

Hi Ramesh,
Thanks for your reply. Yes i do have the write permission for that folder. I have opened a txt editor and i was able to save a file. i was also copy few pdf documents to that folder also. Let me know if anything else i can do in this regard.

Thanks



Author: J Ramesh    08 Sep 2008Member Level: SilverRating: 1 out of 5     Points: 1

Hi Ben,

What is the error (if any) you are getting when trying to write the file in folder.

I think the other issue can be the com object which you use, check if the ASP.Net user has permissions to access the com object and the com object is available in the webserver.

Hope this helps

regards
Ramesh



Author: Ben    08 Sep 2008Member Level: BronzeRating: 2 out of 52 out of 5     Points: 2

Hi ramesh,

Thanks for the reply. i think that the web services object has permission.. can u be more specfif how can i check that..
To be more clear form me .. The web service works very well in the developer machine. When published into the web server all the web services works well EXCEPT one service.( This web service is to check for an existing pdf file. if that file does not exist then create it in the root folder say ABC folder that has all the rights to write a file into it). The users can open the file if exists and shows http 500 error if not exists. I tried to install VS in the web server and debug the web services and the files get created in that folder. But when i try browse as a user..it gives me a error that file is not existing. I also tried to debug the website source file in the webserver and it give me a file not found catch error. Hope i am clear and let me know if i hve to do something else.



Author: J Ramesh    09 Sep 2008Member Level: SilverRating: 3 out of 53 out of 53 out of 5     Points: 3

Hi Ben,

I think I understand your problem, it is that if you dont have a file (pdf) in the specific location then you are getting error.
I think you are getting the error because you are not checking if the file exists before opening.

I suggest you do the following:
1. Check for the File in the Directory before trying to open.

2. If the file exists then you say it works, if the file is not there then write a else case to create the file and then try to open,

regards
Ramesh



Author: Ben    09 Sep 2008Member Level: BronzeRating: 3 out of 53 out of 53 out of 5     Points: 3

Hi Ramesh . Thanks for your time.I hve that file check option coded when i was doing my webmethod itself.. to be more clear.. i am giving you the issue again.

I developed a web services with few methods. one of the web method is called as getpaycheckimg() is to create a pdf file in a C:\foldername, and display that file to the user. All the web methods including this method works great in the DEVELOPMENT machine. When the webservice is being published into the WEBSERVER (ie. in Inetpub/wwwroot/webservice/foldername.) all the web methods works fine except this one and i get an error in the client machine that the pdf file is not found. When i installed vs2008 in the webserver and tried to copy the source code of the web services and debug it it works great creating the file and no errors come up. But when i tried to openup the website source code in the webserver and tried to invoke the web method this web method alone gives me an error as http 500 and upon refresh of the error page i get " Request format is unrecognized for URL unexpectedly ending in '/Getpaycheckimg'. I tried to browse in the google and found few step to work out but i am unable to fix this. Let me know what changes i have to do so that i can solve the issue. note: Inside the web method i am using the doucument com object( a third party software) to write the pdf file the return type is as a Byte[] array. All the webmethod expect this method works great and fine in the development machine. and also in the web server. I am struck out and not able to move futher. Solving this would be a great help. Thanks



Author: J Ramesh    19 Sep 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

Hi Ben,

Iam assuming that you have provided physical path in your webservice "C:\foldername". You cannot use physical path, It should be the virtual path like "http://yourwebsitename/foldername".

If your webservice/virtualdirectory is in location say
"C:\Inetpub\wwwroot\foldername\*.asmx", then create a folder at this place to write your pdf and use "~/foldername/*.pdf" to write it.

I hope it is the problem.

Regards
Ramesh



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Free software tutorials for commercial purpose
Previous : Hosting JAVA web services on IIS
Return to Discussion Forum
Post New Message
Category: Webservices

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use