public SprajaxSession(string baseUrl, string connString, bool storeAll) { _baseUrl = baseUrl; _connString = connString; _storeAll = storeAll; DynamicWebServiceProxy.ClearAllCached(); }
// private void bnCalc_Click(object sender, System.EventArgs e) // { // DynamicWebServiceProxy ws = new DynamicWebServiceProxy(); // // ws.WSDL = "http://www.xmlwebservices.cc/ws/v1/calc/SimpleCalc.asmx?WSDL"; // ws.TypeName = "SimpleCalc"; // ws.MethodName = "Add"; // ws.AddParameter(Convert.ToInt64(tbA.Text)); // ws.AddParameter(Convert.ToInt64(tbB.Text)); // // object result = ws.InvokeCall(); // // MessageBox.Show(result.ToString()); // } private void bnCalc_Click(object sender, System.EventArgs e) { DynamicWebServiceProxy ws = new DynamicWebServiceProxy(); ws.WSDL = "http://localhost/TestParameterValues/Test.asmx?wsdl"; ws.TypeName = "Service1"; ws.MethodName = "TestStringParameters"; //ws.AddParameter(Convert.ToInt64(tbA.Text)); //ws.AddParameter(Convert.ToInt64(tbB.Text)); //object result = ws.InvokeCall(); ParameterCollection parameters = ws.GetParameters(ws.MethodName); foreach (Parameter parameter in parameters) { // DateTime a = new DateTime(2005,05,05); parameter.ParameterValue = "a"; } Array b = ((Array)ws.InvokeWebService(ws.MethodName, parameters)); ArrayList p = new ArrayList(); foreach (object o in b) { p.Add(o); } dropParameters.DataSource = p; //MessageBox.Show(result.ToString()); }
/// <summary> /// /// </summary> /// <param name="values"></param> public void CallMethod(object[] values) { // Initialize the call DynamicWebServiceProxy wsp = new DynamicWebServiceProxy(); wsp.EnableMessageAccess = true; wsp.Wsdl = _theMethod.Parent.Parent.WSDL; wsp.TypeName = _theMethod.Parent.Name; wsp.MethodName = _theMethod.Name; wsp.Url = new Uri(_theMethod.Parent.Parent.EndPoint); foreach (object o in values) { wsp.AddParameter(o); } // Make the call try { object result = wsp.InvokeCall(); _listener.HandleCall(_theMethod, values, wsp.SoapRequest, wsp.SoapResponse, null); } catch (Exception ex) { // System.Console.WriteLine("Exception while invoking call: {0}", ex.Message); _listener.HandleCall(_theMethod, values, wsp.SoapRequest, wsp.SoapResponse, ex.InnerException); } }
public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); wsp = new DynamicWebServiceProxy(); methods = new ArrayList(); }
private HealthcareProviderDirectoryQueryResponse HandleCore(GetHealthcareProviderDirectoryEntriesRequest request) { using (var proxy = new DynamicWebServiceProxy <IHealthQueryService> ()) { HealthcareProviderDirectoryQueryRequest niemRequest = BuildNiemRequest(); HealthcareProviderDirectoryQueryResponse niemResponse = proxy.Client.Query(niemRequest); return(niemResponse); } }
private UserResult GetUserByUsername(string username) { UserResult user; //TODO: Try/Catch using (var proxy = new DynamicWebServiceProxy <IMembershipService> (_membershipServiceEndpointAddress)) { user = proxy.Client.GetUserByUsername(username); } return(user); }
private UserResult CreateUser(string username, string email) { UserResult user; using (var proxy = new DynamicWebServiceProxy <IMembershipService> (_membershipServiceEndpointAddress)) { // TODO: Do not send a password to allow for Random password generation at the Identity Provider side // The hardcoding of the password has been done to cicumvent the non-availability of an SMTP server user = proxy.Client.CreateUser(username, email, "P@$$w0rd", string.Empty, string.Empty); } return(user); }
internal WSDLProxy(string buffer) { try { //********************************************************************************************* //Para que el ensamblado del proxy se genere corréctamente debemos asegurarnos de que el //directorio de trabajo de la aplicación coincida con el directorio del ensamblado principal, //es decir, SIGUANETDesktop.exe. Un caso típico en el que puede darse esta discrepancia es si //previamente el usuario abre un fichero .sgd que se encuentra en un directorio distinto al del //ensamblado principal. Reasignando a Environment.CurrentDirectory dicha ruta evitamos //generaciones fallidas del proxy. Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); //********************************************************************************************* this._proxy = this.CreateProxy(buffer); this._proxy.EnableMessageAccess = true; //Al asignar la propiedad WSDL se enlaza con un ensamblado en cache //o se crea un nuevo ensamblado que representa a la clase proxy this._proxy.Wsdl = buffer; this._endPoint = this._proxy.Url.AbsoluteUri; Type[] types = this._proxy.ProxyAssembly.GetTypes(); foreach (Type t in types) { if (t.BaseType == typeof(SoapHttpClientProtocolExtended)) { this._type = t; this._name = t.Name; break; } } if (this._type == null) { throw new ApplicationException("No se puede enlazar con el proxy"); } MethodInfo[] methods = this._type.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly); foreach (MethodInfo mi in methods) { this._methods.Add(new WSDLProxyMethod(mi)); } } catch (Exception e) { throw e; } }
private UserResult GetUserByUniqueIdentifier(string nameIdentifier) { var result = new UserResult(); // TODO: Try/Catch using (var proxy = new DynamicWebServiceProxy <IMembershipService> (_membershipServiceEndpointAddress)) { // TODO: Implement a GetByNameIdentifier var users = proxy.Client.GetAllUsers(0, 100); var user = users.Users.ToList().Where(u => u.NameIdentifier == nameIdentifier).SingleOrDefault(); result.Ok = users.Ok; result.User = user; return(result); } }
private DynamicWebServiceProxy CreateProxy(string source) { try { //Intentamos vaciar la cache de ensamblado de clase proxy, //es decir borrar el fichero dll que se creó en una sesión //anterior, de forma que el ensamblado se genere de nuevo //y pueda reflejarse cualquier modificación en el WebService. //Normalmente esto sólo lo conseguiremos la primera vez //que iniciemos la sesión SOAP con un nuevo WSDL. //No se pueden reflejar los cambios hechos en el WebService //mientras la sesión SOAP estaba abierta ya que no se puede //borrar la dll de un ensamblado que esté cargado en memoria. //Por tanto, para reflejar cambios en el WebService en un //momento dado siempre habrá que reiniciar la sesión SIGUANETDesktop. DynamicWebServiceProxy.ClearCache(source); return(new DynamicWebServiceProxy()); } catch { return(new DynamicWebServiceProxy()); } }
public WebServiceCollection Enumerate() { // Clear the cache every time. If we are running this on a site we should // be seeing everything for the first time (hence no cache benefit), and // for development the cache just causes problems with changes not being // recognized. try { DynamicWebServiceProxy.ClearCache(WSDL); } catch { // The file handling in the DynWSLib cache is kind of strange, so this usually isn't a // big problem. Usually :) It often means that the DLL has already been loaded by this // process and can't be unloaded. } StringBuilder text = new StringBuilder(); DynamicProxy.EnableMessageAccess = true; DynamicProxy.Wsdl = WSDL; Type[] types = DynamicProxy.ProxyAssembly.GetTypes(); foreach (Type t in types) { WebService currentWebService; if (t.BaseType == typeof(SoapHttpClientProtocolExtended)) { text.Append("Found a WebService: "); text.Append(t.Name); text.Append("\n"); // Services.WebServices.Add(new WebService(t.Name)); currentWebService = new WebService(Services, t.Name); Services.WebServices.Add(currentWebService); MethodInfo[] mi = t.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly); foreach (MethodInfo m in mi) { if (!(m.Name.StartsWith("Begin") || m.Name.StartsWith("End"))) { text.Append("Found a method: "); text.Append(m.Name); text.Append(" with return type: "); text.Append(m.ReturnType); text.Append("\n"); Method currentMethod = new Method(currentWebService, m.Name, m.ReturnType); currentWebService.Methods.Add(currentMethod); ParameterInfo[] pi = m.GetParameters(); // paramInfo = pi; foreach (ParameterInfo p in pi) { text.Append("Found a parameter: "); text.Append(p.Name); text.Append(":"); text.Append(p.ParameterType); text.Append("\n"); Parameter currentParameter; currentParameter = new Parameter(p.Name, p.ParameterType); currentMethod.Parameters.Add(currentParameter); } } } } else { text.Append("Found non-standard Type: "); text.Append(t.Name); text.Append("\n"); } } // TODO - Make this have no return value and use the WebServicesCollection.ToString instead. System.Console.WriteLine(text.ToString()); // return (text.ToString()); return(_Services); }
public WebServiceEnumerator(string wsdl) { _WSDL = wsdl; _DynamicProxy = new DynamicWebServiceProxy(WSDL); _Services = new WebServiceCollection(WSDL); }
private void bnClearCache_Click(object sender, EventArgs e) { DynamicWebServiceProxy.ClearCache(tbWSDL.Text); }