static async Task Main(string[] args) { var wsdl = await WsdlHelper.Build(K_URI_SERVICE + "?wsdl"); var soapRequest = await SoapHelper.BuildSoapRequest(K_URI_SERVICE, K_OPERATION); var soapClient = new SoapClient(K_URI_SERVICE, wsdl.Definitions.Binding.OperationsBinding.First(o => o.Name == K_OPERATION).Action); var soapResponse = await soapClient.PostAsync("POST", soapRequest); }
private async void button2_Click(object sender, EventArgs e) { var wsdl = await WsdlHelper.Build(textBox1.Text + "?wsdl"); var soapClient = new SoapClient(textBox1.Text, wsdl.Definitions.Binding.OperationsBinding.First(o => o.Name == comboBox1.SelectedItem.ToString()).Action); var xmlDocument = new XmlDocument(); xmlDocument.LoadXml(richTextBox1.Text); var soapResponse = await soapClient.PostAsync("POST", xmlDocument); richTextBox2.Text = XmlFormatParserHelper.GetFormattedXml(soapResponse); }
private async void button1_Click(object sender, EventArgs e) { var wsdl = await WsdlHelper.Build(textBox1.Text + "?wsdl"); ClearForm(); comboBox1.Items.Clear(); wsdl.Definitions.PortType.Operations.ForEach(o => { comboBox1.Items.Add(o.Name); }); }
public async Task <String> InvokeMethodWS(string uri, string method, string request) { var wsdl = await WsdlHelper.Build($"{uri}?wsdl"); var soapClient = new SoapClient(uri, wsdl.Definitions.Binding.OperationsBinding.First(o => o.Name == method).Action); var xmlDocument = new XmlDocument(); xmlDocument.LoadXml(request); var soapResponse = await soapClient.PostAsync("POST", xmlDocument); return(XmlFormatParserHelper.GetFormattedXml(soapResponse)); }
private ArrayList BuildWebServceAssemblyDescriptors(string path, Hashtable typeDescriptorDictionary) { ArrayList result = new ArrayList(); try { foreach (string file in Directory.GetFiles(path, "*.asmx")) { string fileName = Path.GetFileName(file); Assembly assembly = null; try { assembly = WsdlHelper.GetAssemblyFromAsmx(fileName); if (assembly != null) { AssemblyDescriptor assemblyDescriptor = new AssemblyDescriptor(); assemblyDescriptor.Build(assembly, true, typeDescriptorDictionary); assemblyDescriptor.Name = fileName; assemblyDescriptor.IsWebServiceProxy = true; result.Add(assemblyDescriptor); } } catch (Exception ex) { AssemblyDescriptor assemblyDescriptor = AssemblyDescriptor.GetNullAssemblyDescriptor(fileName); assemblyDescriptor.Description = ex.ToString(); assemblyDescriptor.IsWebServiceProxy = true; result.Add(assemblyDescriptor); } } } catch (UnauthorizedAccessException) { } try { foreach (string dir in Directory.GetDirectories(path)) { if (dir.EndsWith("_vti_cnf")) { continue; } result.AddRange(BuildWebServceAssemblyDescriptors(dir, typeDescriptorDictionary)); } } catch (UnauthorizedAccessException) { } return(result); }
private Type GetTypeForWebService(string webService) { if ((log != null) && log.get_IsInfoEnabled()) { log.Info(__Res.GetString("Wsdl_ProxyGen", new object[] { webService })); } Assembly assemblyFromAsmx = WsdlHelper.GetAssemblyFromAsmx(webService); if (assemblyFromAsmx != null) { Type[] types = assemblyFromAsmx.GetTypes(); if (types.Length > 0) { return(types[0]); } } return(null); }
private Type GetTypeForWebService(string webService) { if (log != null && log.IsInfoEnabled) { log.Info(__Res.GetString(__Res.Wsdl_ProxyGen, webService)); } Assembly assembly = WsdlHelper.GetAssemblyFromAsmx(webService); if (assembly != null) { Type[] types = assembly.GetTypes(); if (types.Length > 0) { return(types[0]); } } return(null); }
public static void ExportHeaderToAllOpreations(Type headerType, WsdlExporter exporter, string headerMessageName, string headerPartName, WsdlHeaderOptionElement option) { if ((option != null) && ((option.ExportInputEnabled) || (option.ExportOutputEnabled))) { XmlQualifiedName xqn = ExportTypeToXsd(headerType, exporter); Wsdl.Message msg = WsdlHelper.CreateSinglePartMessage(headerMessageName, headerPartName, xqn); foreach (Wsdl.ServiceDescription svc in exporter.GeneratedWsdlDocuments) { if (svc.Messages.Count > 0) { svc.Messages.Add(msg); } WsdlHelper.AddHeaderToAllOperationsInService(svc, msg, null, option.ExportInputEnabled, option.ExportInputRequired, option.ExportOutputEnabled, option.ExportOutputRequired); } } }
public void ContractHasNotChanged() { var expectedXml = new XmlDocument(); expectedXml.LoadXml(Wsdl.ISampleService); string[] errors; var actualXml = WsdlHelper.GetSingleWsdl <ISampleService>(out errors); if (errors.Length > 0) { Console.WriteLine(@"Warning(s) were generated while creating the WSDL."); foreach (var error in errors) { Console.WriteLine(error); } } XmlDocument diffGramXml; Assert.True(WsdlHelper.CompareXml(actualXml, expectedXml, out diffGramXml), "WSDL has changed - contract broken"); }
/// <summary> /// Builds the proxy. /// </summary> private void BuildProxy() { if (enableMessageAccess) { PipelineConfiguration.InjectExtension(typeof(SoapMessageAccessClientExtension)); pipelineProperlyConfigured = true; } //check cache first Assembly cachedAssembly = CompiledAssemblyCache.CheckCacheForAssembly(wsdl); if (cachedAssembly == null) { wsdlSource = WsdlHelper.GetWsdl(wsdl); ass = BuildAssemblyFromWsdl(wsdlSource); } else { ass = cachedAssembly; } proxyInstance = CreateInstance(typeName); }
public async Task <List <String> > GetMethodsWS(string uri) { var wsdl = await WsdlHelper.Build($"{uri}?wsdl"); return(wsdl.Definitions.PortType.Operations.Select(o => o.Name).ToList()); }