I need to use 2 different SoapServices but I can only access 1 at the time, why?
<p>I have a school assignment and I've run into a problem which I just can't understand what's wrong.</p>

<p>In my school assignment we created a Service which is identical to my teachers service. The point of the service were to be able to communicate with our chat clients which we connected to our service.</p>

<p>The problem I have is when I got the task to be able to switch between the two services (which is the type servicename.ServiceSoapClient("ServiceSoap12")). In my service, which I created I put in a namespace to my teachers service: [WebService(Namespace = "http://dsweb.tmd.hv.se/users/wsi400/ChatService/")]
(That was for a later purpose, see below)</p>

<p>The code for my service (which should be almost identical (same return and input values)) is here: <a href="http://pastie.org/2461928" rel="nofollow">http://pastie.org/2461928</a></p>

<p><strong>Now to the real problem..</strong></p>

<p>When creating the client for one service is a piece of cake, trying it to be able to change between them using only 1 reference in the client seems impossible (but others have managed to do it, but after examination of code and such, we have no idea what's wrong with mine). I have, as I've said added the local reference to my service (my asmx file) and that's because I apparently needed the namespace pointed to my teachers service from mine.</p>

<p>When connecting to my service I use the following code:</p>

<pre><code>   wsChatService.ServiceSoapClient wsService = new wsChatService.ServiceSoapClient("ServiceSoap12");
</code></pre>

<p>When adding my service, it generates a lot of stuff in app.config and I changed a value to be able to switch to my teachers service:</p>

<pre><code>    &lt;client&gt;
        &lt;endpoint address="http://dsweb.tmd.hv.se/users/wsi400/ChatService/Service.asmx" binding="basicHttpBinding"
            bindingConfiguration="ServiceSoap" contract="wsChatService.ServiceSoap"
            name="ServiceSoap" /&gt;
        &lt;endpoint address="http://dsweb.tmd.hv.se/users/wsi400/ChatService/Service.asmx" binding="customBinding"
            bindingConfiguration="ServiceSoap12" contract="wsChatService.ServiceSoap"
            name="ServiceSoap12" /&gt;
    &lt;/client&gt;
</code></pre>

<p>Now I have tried to switch with a simple button and the test function always works when switching between the services but depending on what service I choose to use as an assembly reference, that's the one that I can post messages to.</p>

<p>This is the code for the client:</p>

<pre><code>    private void service1_Click(object sender, EventArgs e)
    {
        if (connNr == 2)
        {
            wsService = new wsChatService.ServiceSoapClient("ServiceSoap12", "http://localhost:63280/Service.asmx");
            connNr = 1;
            MessageBox.Show("Connection changed to: Markus \nTesting connection: " + wsService.Test());
            textarray.Text = "";
            MessageBox.Show("Trying to send message: " + wsService.SendMessage("babbel", "Connecting..", "Connected?"));
        }
    }

    private void service2_Click(object sender, EventArgs e)
    {
        if (connNr == 1)
        {
            wsService = new wsChatService.ServiceSoapClient("ServiceSoap12", "http://dsweb.tmd.hv.se/users/wsi400/ChatService/Service.asmx");
            connNr = 2;
            MessageBox.Show("Connection changed to: http://dsweb.tmd.hv.se/users/wsi400/ChatService/Service.asmx \nTesting connection: " + wsService.Test());
            textarray.Text = "";
            MessageBox.Show("Trying to send message: " + wsService.SendMessage("babbel", "Connecting..", "Connected?"));
        }
    }
</code></pre>
