dotnet / dotnet/wcf

Consume SOAP on .net 8 generate 'Forced circuit exception', but it works on .Net 4.8

Open
#5,639 1 comment 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
1.8k
Forks
576
Avg merge
6d 9h
Merged PRs (30d)
2

Description

**Describe the bug**
I'm consumming the Soap service located at https://servicos.saude.gov.br/cadsus/CadsusService/v5r0?wsdl. I added the Connected Service Reference (WCF Web Service) through Visual Studio 2022 Community. All classes are generated and I setup my workflow just as I did on .NET 4.8.1 (VS 2015 or 2017, don't remember exactly).
But I'm getting the error 'Forced circuit exception' when calling the method "Pesquisar" (Search), which should search for a user given an document id.

The project runs fine on .net 4.8. Any reason why the project is not working on .net Core?

Sample Console application project to reproduce the error.
[https://github.com/DaybsonPaisante/cadsus-demo](https://github.com/DaybsonPaisante/cadsus-demo)

CadsusServicePortTypeClient client;

client = new CadsusServicePortTypeClient(CadsusServicePortTypeClient.EndpointConfiguration.CadsusServicePort);

//Public credentials for test environment
var clientCredentials = client.ClientCredentials;
clientCredentials.UserName.UserName = "CADSUS.CNS.PDQ.PUBLICO";
clientCredentials.UserName.Password = "kUXNmiiii#RDdlOELdoe00966";

var result = client.pesquisar(
new requestPesquisar
{
FiltroPesquisa = new FiltroPesquisa
{
CPF = new CPFType
{
numeroCPF = "66105234368" // search for some person using his ID
},
tipoPesquisa = TipoPesquisaType.IDENTICA
}
});

foreach (var item in result)
{
Console.WriteLine(item.NomeCompleto); //print the full name person's
}

**To Reproduce**
Call stack:
System.ServiceModel.FaultException
HResult=0x80131500
Message=Forced circuit exception

Source=System.ServiceModel.Primitives
StackTrace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(MethodCall methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(MethodInfo targetMethod, Object[] args)
at generatedProxy_1.pesquisar(requestPesquisar1 )
at CadsusServiceReference.CadsusServicePortTypeClient.CadsusServiceReference.CadsusServicePortType.pesquisar(requestPesquisar1 request) in C:\Users\m127391\Downloads\cadsus-demo\ConsoleApp\Connected Services\CadsusServiceReference\Reference.cs:line 5186
at CadsusServiceReference.CadsusServicePortTypeClient.pesquisar(requestPesquisar requestPesquisar) in C:\Users\m127391\Downloads\cadsus-demo\ConsoleApp\Connected Services\CadsusServiceReference\Reference.cs:line 5193
at ConsoleApp.Program.Main(String[] args) in C:\Users\xxxxx\Downloads\cadsus-demo\ConsoleApp\Program.cs:line 17

**Screenshots**
![image](https://github.com/user-attachments/assets/6367e4fc-2185-4e79-bc37-0ba55ed73b4d)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.