Creating a Autodesk Revit addin. I want it to be able to talk to SOAP Web Services
The addin is created as a Class Library. The SOAP client code is generated by using the Visual Studio Service Reference and pointing at the wsdl url.
When I launch the Addin from Revit I get the following error
Revit encountered a System.InvalidOperationException: Could not find endpoint element with name '{xxx}' and contract '{yyy}' in the ServiceModel client configuration section.
Note1 that the SOAP calls work fine if I create the Visual Studio Project as a command line Project and run it directly.
Note2 the build folder which I point to in the addin manifest has a .config file in it.
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<RevitAddIns>
<AddIn Type="Command">
<Name>AIMRevitTestTwo</Name>
<Assembly>
C:\Users\greg.bluntzer\Documents\Visual Studio 2015\Projects\AIMRevitTestTwo\AIMRevitTestTwo\bin\Debug\AIMRevitTestTwo.dll
</Assembly>
<AddInId>604b1052-f742-4951-8576-c261d1993109</AddInId>
<FullClassName>App</FullClassName>
<VendorId>xxx</VendorId>
<VendorDescription>yyy</VendorDescription>
Is there something else I need to configure in my Visual Studio Project or Revit Manifest so that it will look at the .config file.
Update: I found this link That says to try and create/update the revit.exe.config file and add the bindings to that. It resolves my issue locally.That is not a good solution for me as I want to distribute this addin. So I still would like to know a way of making the addin so that it can read the config file that comes with the class library.
SOLUTION: as suggested I build the config information in the code
<binding name="findAePReqEByDocumentSoapBinding" allowCookies="true">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic" proxyCredentialType="Basic" realm="fmax" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
Turns into
BasicHttpBinding binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
binding.AllowCookies = true;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic;
binding.Security.Transport.Realm = "fmax";
binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
binding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default;
binding.MaxReceivedMessageSize = int.MaxValue;
binding.MaxBufferSize = int.MaxValue;
EndpointAddress endPointAddress = new EndpointAddress(DataAccess.END_POINT);