EDIT: I cleaned a little up to make more clear, what's my problem. Sorry, it's less than it may look like. The whole xml is blowing up this post pretty much
I have a web service running on a remote server - a Linux device where some hardware is attached. This hardware, usually controlled by the linux server may also be connected over a web service by using wsdl. I got this project from a former employee and totally hung right now, because the web service won't work as I expect it.
As far as I understood the concept of webservices they deliver an interface which can be imported to a project to access the webservice as if it was a local library.
Hence I have added a new library to my solution, added a new service reference and downloaded the whole interface into my project (Project explorer->References->Add service reference). Now I have a DLL containing all the methods of webservice (service.dll) - so far, so good.
What I dont understand: This wizzard now created an app.config which - for my understanding is obsolete. The app.config contains:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ImageServerServiceSoapBinding" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://10.80.30.200:50000/xxxDataServer"
binding="basicHttpBinding" bindingConfiguration="ImageServerServiceSoapBinding"
contract="ServiceReference1.ImageServer" name="ImageServerPort" />
</client>
</system.serviceModel>
</configuration>
Now I use this Service DLL in another project (driver.dll) where I implement access and unsage of the service encapsuled in a driver.
using MyService.ServiceReference1
// ...
public class MyClient
{
public void Connect() {
this._Client = new ImageServerClient(
_Settings.EndPointConfigurationName,
@"http://" + _Settings.Physicals.IPAdress + ":" +
_Settings.Physicals.Port + _Settings.Physicals.SubDir);
}
The address built in the upper code points at: http://10.80.30.200:50000/xxxDataServer which is the same directory as the one used in the wsdl import wizzard.
The ImageServerClient is a part of the imported interface. It's definition is:
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class ImageServerClient : System.ServiceModel.ClientBase<MySerivce.ServiceReference1.ImageServer>, MySerivce.ServiceReference1.ImageServer {
public ImageServerClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
For debugging purposes I have another Project (test.exe) in my solution referencing to the driver.dll.
In this test.exe I call the function
Client = new MyClient(MySettings);
Client.Connect();
So far so good. Calling the connect function in my driver.dll will call the service.dll to connect to the remote client.
This will work as long as the calling test.exe is holding the following information in the app.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ImageServerServiceSoapBinding" messageEncoding="Mtom" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://10.80.30.200:50000/xxxDataServer" binding="basicHttpBinding" bindingConfiguration="ImageServerServiceSoapBinding" contract="ServiceReference1.ImageServer" name="ImageServerPort"/>
</client>
</system.serviceModel>
The the then calling LabView is not compatible with the app.config scheme and therefore the driver.dll has to work autonomously without any additional config outside the driver.dll or the service.dll.
Removing the app.config data will end up in an error in the line:
this._Client = new ImageServerClient(Settings.EndPointConfigurationName,
@"http://" + _Settings.Physicals.IPAdress + ":" +
_Settings.Physicals.Port + _Settings.Physicals.SubDir);
InvalidOperationException in System.ServiceModel.dll There was no endpoint element found with the Name "..." and the contract "..." in the ServiceModel-ClientConfiguration. This may have the folowing reasons: There was no configuration file found for this application or there was no EndPoint-Element found within the client element that matches the name. (Translated from german).
So what is wrong in my thoughts that this is not working? Why is it not enough, that all the basicHttpBinding stuff is already in the app.config from the service.dll (created by the wizzard)? Thank you :)