-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7fbaf3
commit 3f774b8
Showing
16 changed files
with
619 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
// Use IntelliSense to find out which attributes exist for C# debugging | ||
// Use hover for the description of the existing attributes | ||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": ".NET Core Launch (web)", | ||
"type": "coreclr", | ||
"request": "launch", | ||
"preLaunchTask": "build", | ||
// If you have changed target frameworks, make sure to update the program path. | ||
"program": "${workspaceRoot}/WebApi/SyonOnline.WebApi/bin/Debug/netcoreapp1.1/SyonOnline.WebApi.dll", | ||
"args": [], | ||
"cwd": "${workspaceRoot}/WebApi/SyonOnline.WebApi", | ||
"stopAtEntry": false, | ||
"internalConsoleOptions": "openOnSessionStart", | ||
"launchBrowser": { | ||
"enabled": true, | ||
"args": "${auto-detect-url}", | ||
"windows": { | ||
"command": "cmd.exe", | ||
"args": "/C start ${auto-detect-url}" | ||
}, | ||
"osx": { | ||
"command": "open" | ||
}, | ||
"linux": { | ||
"command": "xdg-open" | ||
} | ||
}, | ||
"env": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"sourceFileMap": { | ||
"/Views": "${workspaceRoot}/Views" | ||
} | ||
}, | ||
{ | ||
"name": ".NET Core Attach", | ||
"type": "coreclr", | ||
"request": "attach", | ||
"processId": "${command:pickProcess}" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"version": "0.1.0", | ||
"command": "dotnet", | ||
"isShellCommand": true, | ||
"args": [], | ||
"tasks": [ | ||
{ | ||
"taskName": "build", | ||
"args": [ | ||
"${workspaceRoot}/WebApi/SyonOnline.WebApi/SyonOnline.WebApi.csproj" | ||
], | ||
"isBuildCommand": true, | ||
"problemMatcher": "$msCompile" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 8 additions & 6 deletions
14
ServiceReference/SyonOnline.ServiceFacade/SyonOnline.ServiceFacade.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>netstandard1.6</TargetFramework> | ||
<TargetFramework>netstandard1.1</TargetFramework> | ||
<AssemblyName>SyonOnline.ServiceFacade</AssemblyName> | ||
<PackageId>SyonOnline.ServiceFacade</PackageId> | ||
<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion> | ||
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback> | ||
</PropertyGroup> | ||
|
||
</Project> | ||
<ItemGroup> | ||
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0"/> | ||
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0"/> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Text; | ||
using System.Runtime.Serialization; | ||
using System.IO; | ||
using System.Xml; | ||
using System.Net; | ||
using System.Xml.Serialization; | ||
using SyonOnline.ServiceFacade.Interface; | ||
using System.Net.Http; | ||
|
||
//using System.Web.Services.Protocols; | ||
|
||
namespace SyonOnline.ServiceFacade | ||
{ | ||
public class Util | ||
{ | ||
/* | ||
private static readonly string testarNaUrl2 = ConfigurationManager.AppSettings["testarNaUrl2"]; | ||
private static readonly string urlAdquirencia = ConfigurationManager.AppSettings["urlAdquirencia"]; | ||
private static readonly string urlAdquirenciaV2 = ConfigurationManager.AppSettings["urlAdquirenciaV2"]; | ||
private static readonly string urlDatacash = ConfigurationManager.AppSettings["urlDatacash"]; | ||
private static readonly string urlKomerci = ConfigurationManager.AppSettings["urlKomerci"]; | ||
private static readonly string url2Adquirencia = ConfigurationManager.AppSettings["url2Adquirencia"]; | ||
private static readonly string url2AdquirenciaV2 = ConfigurationManager.AppSettings["url2AdquirenciaV2"]; | ||
private static readonly string url2Datacash = ConfigurationManager.AppSettings["url2Datacash"]; | ||
private static readonly string url2Komerci = ConfigurationManager.AppSettings["url2Komerci"]; | ||
public static string GetUrlAdquirencia() | ||
{ | ||
if (testarNaUrl2 == "0") | ||
{ | ||
return urlAdquirencia; | ||
} | ||
return url2Adquirencia; | ||
} | ||
public static string GetUrlAdquirenciaV2() | ||
{ | ||
if (testarNaUrl2 == "0") | ||
{ | ||
return urlAdquirenciaV2; | ||
} | ||
return url2AdquirenciaV2; | ||
} | ||
public static string GetUrlDatacash() | ||
{ | ||
if (testarNaUrl2 == "0") | ||
{ | ||
return urlDatacash; | ||
} | ||
return url2Datacash; | ||
} | ||
public static string GetUrlKomerci() | ||
{ | ||
if (testarNaUrl2 == "0") | ||
{ | ||
return urlKomerci; | ||
} | ||
return url2Komerci; | ||
} | ||
*/ | ||
public static T Deserialize<T>(string xml) | ||
{ | ||
XmlSerializer serializer = new XmlSerializer(typeof(T)); | ||
T result; | ||
using (TextReader reader = new StringReader(xml)) | ||
{ | ||
result = (T)serializer.Deserialize(reader); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
public static string Serialize<T>(T request) | ||
{ | ||
XmlSerializerNamespaces xmlSerializerNamespaces = new XmlSerializerNamespaces(); | ||
xmlSerializerNamespaces.Add("", ""); | ||
|
||
XmlSerializer xsSubmit = new XmlSerializer(typeof(T)); | ||
var subReq = request; | ||
var xml = ""; | ||
|
||
using (var sww = new StringWriter()) | ||
{ | ||
using (XmlWriter writer = XmlWriter.Create(sww, new XmlWriterSettings { OmitXmlDeclaration = true })) | ||
{ | ||
xsSubmit.Serialize(writer, subReq, xmlSerializerNamespaces); | ||
xml = sww.ToString(); // Your XML | ||
} | ||
} | ||
|
||
return xml; | ||
} | ||
|
||
/* public static string PostXMLData(string destinationUrl, string requestXml, IServiceFacade service) | ||
{ | ||
var horaInicial = DateTime.Now; | ||
new HttpClient().PostAsync(destinationUrl, ); | ||
WebRequest request = (WebRequest)WebRequest.Create(destinationUrl); | ||
byte[] bytes; | ||
bytes = Encoding.ASCII.GetBytes(requestXml); | ||
request.ContentType = "text/xml; encoding='utf-8'"; | ||
request.ContentLength = bytes.Length; | ||
request.Method = "POST"; | ||
Stream requestStream = request.GetRequestStream(); | ||
requestStream.Write(bytes, 0, bytes.Length); | ||
requestStream.Close(); | ||
HttpWebResponse response; | ||
Util.SaveXmlRequest(requestXml, service.GetTestId(), service.GetMethodName()); | ||
response = (HttpWebResponse)request.GetResponse(); | ||
if (response.StatusCode == HttpStatusCode.OK) | ||
{ | ||
Stream responseStream = response.GetResponseStream(); | ||
string responseStr = new StreamReader(responseStream).ReadToEnd(); | ||
Util.SaveXmlResponse(responseStr, horaInicial, service.GetTestId(), service.GetMethodName()); | ||
return responseStr; | ||
} | ||
return null; | ||
} | ||
public static void SaveXmlResponse(string xml, DateTime horaInicial, string testId, string methodName) | ||
{ | ||
Warning.SecondsExecution = (DateTime.Now - horaInicial).TotalSeconds; | ||
Console.WriteLine(string.Format("Tempo : {0}", Warning.SecondsExecution)); | ||
SaveXml(xml, "Response", testId, methodName); | ||
} | ||
public static void SaveXmlRequest(string xml, string testId, string methodName) | ||
{ | ||
SaveXml(xml, "Request", testId, methodName); | ||
} | ||
private static void SaveXml(string xml, string type, string testId, string methodName) | ||
{ | ||
var baseDirectory = System.AppDomain.CurrentDomain.BaseDirectory; | ||
var testResults = Path.Combine(baseDirectory, "Test Results"); | ||
Directory.CreateDirectory(testResults); | ||
var fullName = GetNextFileName(Path.Combine(testResults, string.Concat(testId, "-", type, "-", methodName, ".xml"))); | ||
File.WriteAllText(fullName, xml); | ||
} | ||
private static string GetNextFileName(string fileName) | ||
{ | ||
string extension = Path.GetExtension(fileName); | ||
int i = 0; | ||
while (File.Exists(fileName)) | ||
{ | ||
if (i == 0) | ||
fileName = fileName.Replace(extension, "(" + ++i + ")" + extension); | ||
else | ||
fileName = fileName.Replace("(" + i + ")" + extension, "(" + ++i + ")" + extension); | ||
} | ||
return fileName; | ||
} | ||
public static string GetUrlService<TServiceFacase, TService>(object type, object service) where TServiceFacase : IServiceFacade | ||
{ | ||
var url = string.Empty; | ||
url = ((IServiceFacade)type).GetUrl(); | ||
if (string.IsNullOrEmpty(url) && service != null) | ||
{ | ||
url = ((SoapHttpClientProtocol)service).Url; | ||
} | ||
Console.WriteLine(string.Format("Data Hora : {0}", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"))); | ||
Console.WriteLine(string.Format("URL Serviço : {0}", url)); | ||
return url; | ||
} | ||
*/ | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
ServiceReference/SyonOnline.ServiceFacade/WebReferences/Adquirencia/References.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace SyonOnline.ServiceFacade.WebReferences.Adquirencia | ||
{ | ||
|
||
} |
Oops, something went wrong.