I would like support. I'm having serious problems with a client. I have a C # application that fetches data from a system and sends it data to a SOAP service. This SOAP service requires a header:
<soapenv:Header>
<wsAutenticacao>
<login>us1</login>
<senha>b81476fc88f1a2a4</senha>
<codigoEmpresa>1</codigoEmpresa>
</wsAutenticacao>
</soapenv:Header>
When mapping through Visual Studio, I can not find where to insert the header data. The solution was not started by me and I need to continue the same pattern.
The services are mapped in the app.config as Properties.Settings and not as binding:
<setting name="wsSGOSituacaoProjeto_SituacaoProjetoWSImplService"
serializeAs="String">
<value>http://ser:8080/erp/ws/situacaoProjeto</value>
</setting>
The call in the reference does not contain anything about the Header:
public ProjetoWSImplService() {
this.Url = global::Integracao.SGO.Properties.Settings.Default.Projeto_ProjetoWSImplService;
if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
this.UseDefaultCredentials = true;
this.useDefaultCredentialsSetExplicitly = false;
}
else {
this.useDefaultCredentialsSetExplicitly = true;
}
}
public new string Url {
get {
return base.Url;
}
set {
if ((((this.IsLocalFileSystemWebService(base.Url) == true)
&& (this.useDefaultCredentialsSetExplicitly == false))
&& (this.IsLocalFileSystemWebService(value) == false))) {
base.UseDefaultCredentials = false;
}
base.Url = value;
}
}
public new bool UseDefaultCredentials {
get {
return base.UseDefaultCredentials;
}
set {
base.UseDefaultCredentials = value;
this.useDefaultCredentialsSetExplicitly = true;
}
}
/// <remarks/>
public event consultarProjetoCompletedEventHandler consultarProjetoCompleted;
/// <remarks/>
public event inserirCompletedEventHandler inserirCompleted;
/// <remarks/>
public event consultarCompletedEventHandler consultarCompleted;
/// <remarks/>
public event alterarCompletedEventHandler alterarCompleted;
The part of the code that is giving error for lack of the header is the following one:
if (WebServiceSGO == null)
{
Iniciar("http://ser:8080/erp/ws/projeto?wsdl");
//WebServiceSGO = new Integracao.SGO.wsSGOProjeto.ProjetoWSImplService();
}
WebClient client = new WebClient();
var ret = WebServiceSGO.consultar(Param.Empresa, Param.EmpresaEspecificada, Param.UnidadeAdministrativa, Param.Datainicio, Param.DatainicioEspecificada, Param.Projeto, Param.AnoProjeto, Param.AnoProjetoEspecificado, Param.TipoProjeto, Param.Cliente, Param.ClienteEspecificado);
return ToXML(ret);
return: "Login failed!"