Hi
I add a reference to a service in my .net core 2.2 project using svcutil 2.0.2 from here :
http://sms.magfa.com/services/urn:SOAPSmsQueue?wsdl
the created service proxy send the request to server and server send reply back to the us but the proxy can not get the result !!
we use this service in our asp .net web app but in .net core 2.2 using svcutil 2.0.2 we can not get the result.
what is the problem ?
thank you
Hello @mgolikhatir ,
Hello does your web service use wsHttpBinding or basicHttpBinding . We recently have this problem an switched to basicHttpBinding which solved our issue in asp.net core.
It seems asp.net core uses basicHttpBinding.
Thank you.
my code :
BasicHttpBinding basicHttpBinding = null;
EndpointAddress endpointAddress = null;
ChannelFactory
ServiceReference1.SoapSmsQueuableImplChannel serviceProxy = null;
try
{
basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
endpointAddress = new EndpointAddress(new Uri("https://sms.magfa.com/services/urn:SOAPSmsQueue?wsdl"));
factory = new ChannelFactory<ServiceReference1.SoapSmsQueuableImplChannel>(basicHttpBinding, endpointAddress);
factory.Credentials.UserName.UserName = "**";
factory.Credentials.UserName.Password = "****";
serviceProxy = factory.CreateChannel();
//((ICommunicationObject)serviceProxy).Open();
//var opContext = new OperationContext((IClientChannel)serviceProxy);
//var prevOpContext = OperationContext.Current; // Optional if there's no way this might already be set
//OperationContext.Current = opContext;
using (var scope = new OperationContextScope((IContextChannel)serviceProxy))
{
var result = await serviceProxy.getCreditAsync("**").ConfigureAwait(false);
}
factory.Close();
((ICommunicationObject)serviceProxy).Close();
}
catch (MessageSecurityException ex)
{
throw;
}
catch (Exception ex)
{
throw;
}
finally
{
// *** ENSURE CLEANUP (this code is at the WCF GitHub page *** \\
CloseCommunicationObjects((ICommunicationObject)serviceProxy, factory);
}
and I test this one :
ServiceReference1.SoapSmsQueuableImplClient client = new ServiceReference1.SoapSmsQueuableImplClient();
//GetBindingForEndpoint returns a BasicHttpBinding
var httpBinding = client.Endpoint.Binding as BasicHttpBinding;
httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
client.ClientCredentials.HttpDigest.ClientCredential = new NetworkCredential("***", "*****");
var result2 = await client.getCreditAsync("***");
@imcarolwang can you please see if you could repro this issue?
I can't repro this since I don't have the credentials used by the client code.
@mgolikhatir do you have the same issue with svcutil.exe as well? Does the problem repro with .NET framework?
Close out as we didn't get a response,
Feel free to re-activate if this is still an issue.
and I test this one :
ServiceReference1.SoapSmsQueuableImplClient client = new ServiceReference1.SoapSmsQueuableImplClient(); //GetBindingForEndpoint returns a BasicHttpBinding var httpBinding = client.Endpoint.Binding as BasicHttpBinding; httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; client.ClientCredentials.HttpDigest.ClientCredential = new NetworkCredential("***", "*****"); var result2 = await client.getCreditAsync("***");
i'm having the same problem. i get null as result, did anyone solve this problem?