1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
using System;
using System.Web.Services;
using System.Web.Services.Protocols;
namespace Proxy {
[WebServiceBindingAttribute(Name="Envoyer",Namespace="http://tempuri.org/")]
public class Proxy : SoapHttpClientProtocol {
public class AuthHeader : SoapHeader {
public string Username;
public string Password;
}
public AuthHeader AuthHeaderValue;
public static void Main(string[] args) {
if (args.Length==3){
Proxy proxy=new Proxy(args[0]);
proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
proxy.Envoyer(args[1],args[2]);
}
else Console.Write("Veuillez saisir 3 parametres : proxy.exe URL REPORTING DESTINATAIRE");
}
public Proxy(string applicationRoot) {
this.Url = applicationRoot;
}
[SoapHeaderAttribute("AuthHeaderValue")]
[SoapDocumentMethodAttribute("http://tempuri.org/Envoyer", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/")]
public string Envoyer(string reporting,string destinataire) {
object[] parameters = { reporting, destinataire };
object[] results = this.Invoke("Envoyer", parameters);
return (string)results[0];
}
}// fin class |
Partager