I'm trying to work with WSDL using .NET core. Currently, I'm able to import the WSDL and the related files are generated:
The structure is done in the right way and it seems that everything should work as expected. Now in ASP.NET I would have an XML having this information:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SI_SearchItem_OutBinding" />
<binding name="SI_SearchItem_OutBinding1">
<security mode="Transport">
<transport clientCredentialType="Basic" proxyCredentialType="Basic" realm="XISOAPApps" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="HTTP_ENDPOINT_LINK"
binding="basicHttpBinding" bindingConfiguration="SI_SearchItem_OutBinding"
contract="SI_Out.SI_SearchItem_Out" name="HTTP_Port" />
<endpoint address="HTTPS_ENDPOINT_LINK"
binding="basicHttpBinding" bindingConfiguration="SI_SearchItem_OutBinding1"
contract="SI_Out.SI_SearchItem_Out" name="HTTPS_Port" />
</client>
</system.serviceModel>
Since we don't have web.config anymore in core, I'm trying to programmatically add these configurations.
While looking at the Reference.cs I noticed two things:
ConfigureEndpointis not implemented in the generated files, which made me thought that I needed to do my configurations there.ConfigureEndpointis defined as follows:static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials);
But this function is called by
public SI_SearchItem_OutClient(EndpointConfiguration endpointConfiguration) :
base(SI_SearchItem_OutClient.GetBindingForEndpoint(endpointConfiguration), SI_SearchItem_OutClient.GetEndpointAddress(endpointConfiguration))
{
this.Endpoint.Name = endpointConfiguration.ToString();
ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
}
Which does not takes the client credentials in the constructor parameters, so I'm not able to actually replicate the above xml code programmatically inside the configureEndpoint function.
I hope I explained myself well, practically the only thing I'm trying to do, is to be able to authenticate my SOAP calls with the credentials, by replicating the above XML code programmatically inside the ConfigureEndpoint partial function.
Thanks for taking your time to reply, Zeno
