2

I need to build a Web Service in ASP .NET 3.5 (C#) that accepts a large file (documents like DOC/PDF/XLS and similar of about 10-20 MB) as input parameter.
This Web Service is called by many 3rd party applications, many of which are developed in PHP. Once the WS has the file, it has to put it inside another .NET application documents archive.
I already tested the entire round and it works. The file wasn't passed inside the call url, it was taken by a server local path.

Now, my problem is: how can I pass a big file to the WS, when the calls come from an application that is hosted on a different server?

EDIT: added an example.

The case:

Server A is a PHP application that calls the .NET Web Service on Server B and passes it a file. Then, the WS on Server B will post the file somewhere else on Server C.

In other words my problem is the communication between Server A and Server B. I need something like a "query string" which I can use to pass a file as byte array or anything else. Something like:

http://www.myserver.com/InsertFile.ashx?file=A3Fdf3Gjy5... <-- byte array of the file

Obviously, the query string doesn't suit very well to my purpose...
I want to know if what I want to do is possible and which technic I should use to make it works.

Cheshire Cat
  • 1,941
  • 6
  • 36
  • 69

2 Answers2

0

You could use a POST instead of a GET to allow larger files (and be semantically correct). A similar question is asked here. Leading to this link

Community
  • 1
  • 1
madsny
  • 121
  • 6
0

If the web service is yours you can achieve it by changing web.config file. Please refer :

How do I upload large (> 25MB) files to a web service?

Community
  • 1
  • 1
aliassce
  • 1,197
  • 6
  • 19
  • This is not my issue. I need a way to pass a file to a WS that runs on a **different server** from the file source. – Cheshire Cat Oct 15 '12 at 10:35
  • Sorry I can't exactly see your problem. Which server is yours? If I don't misunderstand: Server C will have a GetFile method and Server B will use it. Server B will also have a GetFile method and Server A will use it.?? – aliassce Oct 15 '12 at 11:10
  • Server A is a PHP application that uses the Server B Web Service (.NET) by a direct call to a url such as: http://www.myserver.com/InsertFile.ashx?file=... Then, the Web Service has some functions that put this file to another server, Server C. The transactions between Server B and Server C are transparent to Server A. That was mentioned only to show the entire scenario. My problem is between Server A and Server B. Server A have to pass the file to Server B using the Web Service. – Cheshire Cat Oct 15 '12 at 13:11
  • I don't know PHP for ServerA. But I can provide code for ServerB – aliassce Oct 15 '12 at 20:22
  • OK. So what's your suggestion? – Cheshire Cat Oct 16 '12 at 09:13
  • Just add a service reference (ServerC) to your ServerB project. This will upload file to C. Then create a service in ServerB project. In this service Get file from the client (ServerA).and save it temporarily. After doin this user Service C to upload that file to ServerC – aliassce Oct 16 '12 at 09:35