I generated a proxy via this command -
svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config https://service100.emedny.org:9047/MHService?wsdl
and then copied the elements from the resulting app.config into the app.config file of an existing project.
When I try to access the client in that config file via-
MHSClient serviceProxy = new MHSClient("MHSPort");
it should reference the second client below:
<client>
<endpoint address="https://webservices.hmsa.com/EDI27X/cstc/Hipaa27XService.svc"
binding="customBinding"
bindingConfiguration="wsHttpEndpoint"
contract="HIPAA27XServiceContract"
name="wsHttpEndpoint" />
<endpoint address="https://12.23.28.113:9047/MHService"
binding="customBinding"
bindingConfiguration="MHService_MHSPort"
contract="MHS"
name="MHSPort" />
</client>
but instead I get the error;
Could not find endpoint element with name 'MHSPort' and contract 'MHS' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.'
If I go to definition of MHSClient, it takes me to the proxy.cs file and this line;
public partial class MHSClient : System.ServiceModel.ClientBase, MHS
solved with the following-
endptAddress = new EndpointAddress(new Uri("uri"/xxxx"), EndpointIdentity.CreateDnsIdentity("xxxxxx"), addressHeaders);
MHSClient serviceProxy = new MHSClient(b, endptAddress);
solved with the following-
endptAddress = new EndpointAddress(new Uri("uri"/xxxx"), EndpointIdentity.CreateDnsIdentity("xxxxxx"), addressHeaders);
MHSClient serviceProxy = new MHSClient(b, endptAddress);
@Guanxi gave me the clue when asking about endpoint address from the config file.
Once I created the endpoint address then I could instantiate/create the service using the correct overload;
var b = new CustomBinding() as the first argument and for the second argument,
the correct endpoint address.
complicated - WS-Security - IBM Websphere server interop <-> wcf client
within the context of various .NET and Visual Studio implementations of web services...
oh my
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With