Can I create a web service that uploads a PDF file for download

I do not have much experience with web services, but I think I have a problem for which the web service will work fine.

My company just bought the .net version of Cete Pdf Merger (great product). We use .Net and asp code and, most likely, we will use java in the future.

The scenario is that one technology (asp, java, .net) will have a list of raw data, such as an array of field names and values. This data will be published in the web service, which will then open the given PDF file, match the fields of the PDF form with an array of field names, capture the corresponding value, fill it in pdf, and then transfer the PDF back to the user for download.

Is it possible? For some booty, may I come across what you know? Any preferred execution method (web services, WCF, ???)

+3
source share
5 answers

Short answer: WCF

Longer answer: you seem to be making a distinction between WCF and "web services." You might be thinking of the old .asmx web services. Microsoft now considers them to be “legacy software” and suggests using WCF for all new web service developments.

+2
source

If you intend to use web services with .NET, I recommend using WCF (Windows Communication Foundation).

+1
source

WCF (MSDN) - , (, HTML- ), - HTTP, PDF MIME.

+1

. - .asmx( .asmx).

-:

( , )

[WebMethod]
public void CreatePdfIncomeTax(IncomeTaxForm itf)
{
    // integrate with Cete Pdf Merger 
    string fileName = SomePdfMerging(itf);

    Response.ContentType = "application/pdf";
    Response.AddHeader("Content-Disposition", "inline; filename=foo.pdf");
    Response.WriteFile(path);
    Response.Flush();
    Response.End();
}

...
// a class that the caller would populate as param to the webmethod
public class IncomeTaxForm 
{
   public string FirstName {get;set;}
   public string AddressLine1 {get;set;}
   ...
}
+1

, Aspose PDF. - .asmx, WFC, . , , , , WCF - . , , , , .

0

Source: https://habr.com/ru/post/1760627/


All Articles