0

I have a back-end service layer that needs to communicate with an external service that is accessible through an HTTP POST.

The external service does not contain a WSDL definition and is not a REST API.

The following HTML code successfully communicates with the external http service:

<html>
<body>
    <form enctype="multipart/form-data" action="http://externaladress/fileService/upload" 
          method="post">
        <input type="hidden" name="username" value="username" />
        <input type="hidden" name="password" value="password" />
        <input type="hidden" name="destinationId" value="10" />

        Choose a file to upload: <input name="uploadfile" type="file" /><br />
        <input type="submit" value="Upload File" />
    </form>
</body>
</html>

The problem is I am not in the context of a web page, but in the context of a web-service that is running on the back end looking to call said external service.

How can I accomplish this?

Lastwall
  • 219
  • 3
  • 10
  • 1
    If the external service is over HTTP, then it *is* a web service. – Matias Cicero Aug 30 '16 at 18:17
  • @MatiasCicero Ok thanks, I have edited the post to remove the mention that it is not a web service. I guess I was thinking in terms of a traditional ".net" web service that I can discover in VS using the WSDL. – Lastwall Aug 30 '16 at 18:19
  • 1
    run Fiddler as you post this form, then figure out how to do what it does with c#. I suggest you use an extremely small file as the test. – Crowcoder Aug 30 '16 at 18:31
  • http://stackoverflow.com/questions/7688350/c-sharp-how-to-make-a-http-call - sounds like you're wondering how to directly make a web request from C# code – Don Cheadle Aug 30 '16 at 18:32
  • @Crowcoder I made it work using Fiddler and HttpWebRequest. I reproduced the output from the html form byte by byte until my request in Fiddler was exactually the same as the original request in Fiddler. – Lastwall Aug 30 '16 at 19:04

0 Answers0