呼び出し元にバイト配列を返す webmethod が機能していました。
public byte[] DownloadPDF(string URI)
別の出力 (文字列) を返すようにこれを変更する必要がありました。そこで、メソッドを完全に変更して、void を返し、次のような 3 つのパラメーターを指定することにしました。
public void DownloadFile(string URI, out byte[] docContents, out string returnFiletype)
Web サービスは正しくコンパイルされますが、「Web 参照を追加」してプロキシ クラスをビルドすると、メソッドには 3 ではなく 2 つのパラメーターしかないため、2 番目のパラメーター (バイト配列など) に何か問題があると思われます。
[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]));
}
2 番目のパラメーターであるバイト配列が無視される理由はわかりませんが、それが問題の原因のようです。
これはもちろん、コンパイル時にエラー メッセージが表示される Web クライアント アプリで私を台無しにします。
No overload for method 'DownloadFile' takes '3' arguments
3 つの引数を渡す必要がある Web クライアントのコードは次のとおりです。
myBrokerASMXProxy.ASMXProxy.FileService client = new myASMXProxy.ASMXProxy.FileService();
byte[] fileDataBytes;
string fileType;
client.DownloadFile(URI, fileDataBytes, fileType);
バイト配列を返し、単一の「出力」パラメーターのみを追加するように変更することを考えていますが、これについて専門家に尋ねるべきだと思いました。一般的に、複数の出力要件を処理するためのベストプラクティスは何ですか.