Commit ec53de99 by martin.slowinski

add read me

parent 39a3424d
...@@ -34,10 +34,12 @@ namespace SoapConsumer.Infrastructure.Proxy ...@@ -34,10 +34,12 @@ namespace SoapConsumer.Infrastructure.Proxy
soapAttribute)) soapAttribute))
throw new InvalidOperationException("Object doesn't have soap attribute."); throw new InvalidOperationException("Object doesn't have soap attribute.");
var host = this._configuration.GetSection(soapAttribute.Host ?? "WebService:Hosts:0:DefaultHost") var host = _configuration.GetSection(soapAttribute.Host ?? "WebService:Hosts:0:DefaultHost")
.GetValue(); .GetValue();
var endpoint = this._configuration.GetSection(soapAttribute.Endpoint).GetValue(); //var endpoint = _configuration.GetSection(soapAttribute.Endpoint).GetValue();
var operation = this._configuration.GetSection(soapAttribute.Operation).GetValue(); //var operation = _configuration.GetSection(soapAttribute.Operation).GetValue();
var endpoint = soapAttribute.Endpoint;
var operation = soapAttribute.Operation;
var request = CreateWebRequest(host, endpoint, operation); var request = CreateWebRequest(host, endpoint, operation);
var soapEnvelopeXml = new XmlDocument(); var soapEnvelopeXml = new XmlDocument();
...@@ -66,7 +68,7 @@ namespace SoapConsumer.Infrastructure.Proxy ...@@ -66,7 +68,7 @@ namespace SoapConsumer.Infrastructure.Proxy
private HttpWebRequest CreateWebRequest(string host, string endpoint, string operation) private HttpWebRequest CreateWebRequest(string host, string endpoint, string operation)
{ {
var webRequest = (HttpWebRequest)WebRequest.Create($@"{host}{endpoint}?op={operation}"); var webRequest = (HttpWebRequest)WebRequest.Create($@"{host}{endpoint}/{operation}");
webRequest.Headers.Add(@"SOAP:Action"); webRequest.Headers.Add(@"SOAP:Action");
webRequest.ContentType = "text/xml;charset=\"utf-8\""; webRequest.ContentType = "text/xml;charset=\"utf-8\"";
webRequest.Accept = "text/xml"; webRequest.Accept = "text/xml";
......
using System; using System.Threading.Tasks;
using System.Threading.Tasks;
using SoapConsumer.Infrastructure.CQRS.Queries.Generic; using SoapConsumer.Infrastructure.CQRS.Queries.Generic;
using SoapConsumer.Infrastructure.Proxy.Abstract; using SoapConsumer.Infrastructure.Proxy.Abstract;
using SoapConsumer.Soap;
namespace SoapConsumer.Queries.Handlers namespace SoapConsumer.Queries.Handlers
{ {
...@@ -16,7 +16,7 @@ namespace SoapConsumer.Queries.Handlers ...@@ -16,7 +16,7 @@ namespace SoapConsumer.Queries.Handlers
public async Task<TestQueryResponse> HandleAsync(TestQuery query) public async Task<TestQueryResponse> HandleAsync(TestQuery query)
{ {
_webServiceProxy.ExecuteAsync<>(); var a = await _webServiceProxy.ExecuteAsync<GetResult, GetData>(new GetData { value = 1 });
return new TestQueryResponse return new TestQueryResponse
{ {
......
using System; using SoapConsumer.Infrastructure.CQRS.Queries.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using SoapConsumer.Infrastructure.CQRS.Queries.Generic;
namespace SoapConsumer.Queries namespace SoapConsumer.Queries
{ {
......
Request processing mechanism using pipline transformer to distinguish and translate different formats of incomming messages
\ No newline at end of file
using System;
using SoapConsumer.Infrastructure.Proxy.Attributes;
namespace SoapConsumer.Soap
{
[Serializable]
[Soap(Endpoint = "Service.svc/IService", Operation = "GetData",
Namespace = "http://tempuri.org/")]
public class GetData
{
public int value { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SoapConsumer.Soap
{
public class GetResult
{
public string Value { get; set; }
}
}
using System;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using Autofac; using Autofac;
using Autofac.Configuration; using Autofac.Configuration;
using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
...@@ -54,15 +52,5 @@ namespace SoapConsumer ...@@ -54,15 +52,5 @@ namespace SoapConsumer
builder.RegisterAssemblyModules(Assemblies); builder.RegisterAssemblyModules(Assemblies);
builder.RegisterModule(new ConfigurationModule(Configuration)); builder.RegisterModule(new ConfigurationModule(Configuration));
} }
//private void ConfigureAutofacContainer(IServiceCollection services)
//{
// var builder = new ContainerBuilder();
// builder.Populate(services);
// builder.RegisterAssemblyModules(Assemblies);
// builder.RegisterModule(new ConfigurationModule(Configuration));
// AutofacContainer = builder.Build();
//}
} }
} }
...@@ -6,5 +6,23 @@ ...@@ -6,5 +6,23 @@
"Microsoft.Hosting.Lifetime": "Information" "Microsoft.Hosting.Lifetime": "Information"
} }
}, },
"AllowedHosts": "*" "AllowedHosts": "*",
"WebService": {
"Hosts": [
{
"DefaultHost": "http://localhost:60314/"
}
],
"Endpoints": [
{
"Endpoint": "Service.svc",
"Operations": [
{
"Operation": "GetData"
}
]
}
]
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment