3
I have an application that accesses third-party Webservice. To improve the testing process, I am setting up a website to simulate Webservice.
This site consists of several Actions, which return XML, simulating data. This part is okay.
My problem is that I’m not getting the input parameters, which comes from my application.
Remembering that my application continues with the same structure to send the data to the Webservice, but only with the URL pointing to my site.
I tried to use Request in the controller, and I couldn’t get the data.
Reference generated by C# when importing WSDL
[System.Web.Services.Protocols.SoapRpcMethodAttribute("", RequestNamespace="http://services.teste.com.br", ResponseNamespace="http://services.teste.com.br", Use=System.Web.Services.Description.SoapBindingUse.Literal)]
[return: System.Xml.Serialization.XmlElementAttribute("result")]
public moedasExportarOut Exportar(string user, string password, int encryption, moedasExportarIn parameters) {
object[] results = this.Invoke("Exportar", new object[] {
user,
password,
encryption,
parameters});
return ((moedasExportarOut)(results[0]));
}
Action
[HttpPost]
public ActionResult XML(string user, string password, int? encryption, string methodName,
Moeda.moedasExportarIn parameters,
Moeda.moedasExportarIn arg, int? codEmpField)
{
XmlDocument xd = new XmlDocument();
var teste = "";
teste =
"<?xml version='1.0' encoding='UTF-8'?> " +
"<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"> " +
" <S:Body>" +
" <ns2:ExportarResponse xmlns:ns2=\"http://services.teste.com.br\">" +
" <result>" +
" <erroExecucao xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:nil=\"true\"/>" +
" <finalizaramRegistros>S</finalizaramRegistros>" +
" <mensagemRetorno xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:nil=\"true\"/>" +
" <numLot>0</numLot>" +
" <tipoRetorno>1</tipoRetorno>" +
" </result>" +
" </ns2:ExportarResponse>" +
" </S:Body>" +
"</S:Envelope>";
xd.LoadXml(teste);
return new XmlResult(xd);
}
Call from Webservice, made by my app
public Teste.Moedas.moedasExportarOut ExportarMoeda(DadosParaIntegracao dados, Teste.Moedas.moedasExportarIn parameters)
{
System.Net.ServicePointManager.DefaultConnectionLimit = conexaoSimultaneaPorServico;
var service = new Teste.Moedas.g5services();
service.Url = dados.Configuracao.URL;
service.Timeout = ConfiguarTimeOut(service, dados.Configuracao);
ConfigurarProxy(service, dados.Proxy);
try
{
ConfigurarIntegracao(service);
System.Net.ServicePointManager.Expect100Continue = false;
return service.Exportar(dados.Login.Login, dados.Login.Senha, 0, parameters);
}
finally
{
LimparIntegracao();
}
}
I couldn’t even get the value of user, password or any other parameter.
How are you doing to call the Action?
– Leonel Sanches da Silva
@Ciganomorrisonmendez added the form that is called the Webservice
– Tiedt Tech
Not the Web Service. To Action.
– Leonel Sanches da Silva
@The Action simulates the return of the Webservice. Instead of my URL pointing to Webservice, point to my Action and send the same data if the data was sent to Webservice. In the above code was Controller is actually my Action. I’ve already set.
– Tiedt Tech
@Ciganomorrisonmendez some idea of how to do?
– Tiedt Tech
I confess that I still don’t understand how the call chain works. In theory,
XML
calling forExportarMoeda
, who calls the Webservice that’s right?– Leonel Sanches da Silva