I had a webmethod working which returned a byte array to the caller:
public byte[] DownloadPDF(string URI)
I had to change this to return another output (a string). So, I decided to change the method completely by now returning void and having 3 parameters like this:
public void DownloadFile(string URI, out byte[] docContents, out string returnFiletype)
My web service compiles correctly but I suspect something is wrong with the 2nd parameter (i.e. the byte array) because when I "Add Web Reference" and build my proxy class, the method has only 2 parameters, not 3):
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DownloadFile", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("docContents", DataType="base64Binary")]
public byte[] DownloadFile(string URI, out string returnFiletype) {
object[] results = this.Invoke("DownloadFile", new object[] {
URI});
returnFiletype = ((string)(results[1]));
return ((byte[])(results[0]));
}
I don't see why my 2nd parameter, the byte array, is being ignored, but it appears to be the source of the problem.
This of course messes me up in the web client app where I get an error message at compile time:
No overload for method 'DownloadFile' takes '3' arguments
Here is the code in the web client where I need to pass 3 arguments:
myBrokerASMXProxy.ASMXProxy.FileService client = new myASMXProxy.ASMXProxy.FileService();
byte[] fileDataBytes;
string fileType;
client.DownloadFile(URI, fileDataBytes, fileType);
I am thinking of changing it back to return a byte array and add just a single "out" parameter but I thought I should ask you experts about this and in general, what is the best practice for handling multiple output requirements.