WCF proxy on Gadgeteer does not send request

Hi,

I’m trying to make Gadgeteer to communicate with a SOAP web service that is hosted on IIS, it is written by means of WCF.
I generated the proxy by means of MFSvcUtil.
I set a static IP to gadgeteer and checked that the interface is up (I’m able to ping it).
However when I try to send a request to the web service I encounter the following exception:

 #### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (1) ####
    #### Message: 
    #### Microsoft.SPOT.Net.SocketNative::getaddrinfo [IP: 0000] ####
    #### System.Net.Dns::GetHostEntry [IP: 0008] ####
    #### System.Net.HttpWebRequest::EstablishConnection [IP: 00e1] ####
    #### System.Net.HttpWebRequest::SubmitRequest [IP: 0019] ####
    #### System.Net.HttpWebRequest::GetRequestStream [IP: 0008] ####
    #### Ws.Services.Binding.BindingElement::ProcessOutputMessage [IP: 0006] ####
    #### Ws.Services.Binding.BindingElement::ProcessOutputMessage [IP: 001a] ####
    #### Ws.Services.Binding.RequestChannel::SendMessage [IP: 000d] ####
    #### Ws.Services.Binding.RequestChannel::Request [IP: 000e] ####
    #### tempuri.org.IServiceClientProxy::login [IP: 0043] ####
    #### ClientPolistudio.Program::eth_NetworkUp [IP: 005b] ####
    #### Gadgeteer.Modules.Module+NetworkModule::OnNetworkEvent [IP: 004d] ####
    #### System.Reflection.MethodBase::Invoke [IP: 0000] ####
    #### Gadgeteer.Program::DoOperation [IP: 001a] ####
    #### Microsoft.SPOT.Dispatcher::PushFrameImpl [IP: 0054] ####
    #### Microsoft.SPOT.Dispatcher::PushFrame [IP: 001a] ####
    #### Microsoft.SPOT.Dispatcher::Run [IP: 0006] ####
    #### Gadgeteer.Program::Run [IP: 001d] ####
    #### SocketException ErrorCode = 10060
    #### SocketException ErrorCode = 10060
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll
    #### SocketException ErrorCode = 10060
    #### SocketException ErrorCode = 10060
    #### Exception System.Net.WebException - 0x00000000 (1) ####
    #### Message: host not available
    #### System.Net.HttpWebRequest::EstablishConnection [IP: 00f1] ####
    #### System.Net.HttpWebRequest::SubmitRequest [IP: 0019] ####
    #### System.Net.HttpWebRequest::GetRequestStream [IP: 0008] ####
    #### Ws.Services.Binding.BindingElement::ProcessOutputMessage [IP: 0006] ####
    #### Ws.Services.Binding.BindingElement::ProcessOutputMessage [IP: 001a] ####
    #### Ws.Services.Binding.RequestChannel::SendMessage [IP: 000d] ####
    #### Ws.Services.Binding.RequestChannel::Request [IP: 000e] ####
    #### tempuri.org.IServiceClientProxy::login [IP: 0043] ####
    #### ClientPolistudio.Program::eth_NetworkUp [IP: 005b] ####
    #### Gadgeteer.Modules.Module+NetworkModule::OnNetworkEvent [IP: 004d] ####
    #### System.Reflection.MethodBase::Invoke [IP: 0000] ####
    #### Gadgeteer.Program::DoOperation [IP: 001a] ####
    #### Microsoft.SPOT.Dispatcher::PushFrameImpl [IP: 0054] ####
    #### Microsoft.SPOT.Dispatcher::PushFrame [IP: 001a] ####
    #### Microsoft.SPOT.Dispatcher::Run [IP: 0006] ####
    #### Gadgeteer.Program::Run [IP: 001d] ####
A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll
A first chance exception of type 'System.Net.WebException' occurred in MFWsStack.dll
host not available

I sniffed with Wireshark the incoming traffic on the server and I found out that the only packets sent by gadgeteer are IGMP ones.
I have no idea about what the problem can be…Does anyone have any suggestions?

Here the code that sets the ethernet interface up:

void ProgramStarted()
        {
            Debug.Print("Program Started");
            ethernetJ11D.UseStaticIP("192.168.1.10", "255.255.255.0", "0.0.0.0");
            ethernetJ11D.UseThisNetworkInterface();
            ethernetJ11D.NetworkUp += new GTM.Module.NetworkModule.NetworkEventHandler(eth_NetworkUp);
            ethernetJ11D.NetworkDown += new GTM.Module.NetworkModule.NetworkEventHandler(eth_NetworkDown);
            button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
            camera.PictureCaptured += new Camera.PictureCapturedEventHandler(camera_PictureCaptured);

            Debug.Print("Network joined");
            multicolorLED.TurnRed();
        }

Here the code that sends the request to the web service:

void eth_NetworkUp(GT.Modules.Module.NetworkModule sender, GT.Modules.Module.NetworkModule.NetworkState state)
        {
            if (state == GT.Modules.Module.NetworkModule.NetworkState.Up)
            {
                Debug.Print("Network Up event; state = Up");
                Debug.Print("IP Address: " + ethernetJ11D.NetworkSettings.IPAddress);
                multicolorLED.TurnGreen();
                try
                {               
                    proxy = new IServiceClientProxy(new WS2007HttpBinding(), new ProtocolVersion11());
                    proxy.EndpointAddress = "https://192.168.1.2/gadgeteer";
                    
                    login tmpLogin = new login();
                    tmpLogin.username = "root";
                    tmpLogin.hashPw = "toor";
                    Debug.Print("Login request...");
                    loginResponse respLogin = proxy.login(tmpLogin);
                    token = respLogin.loginResult;
                    Debug.Print("Login Successfully, token: " + token);                    
                }
                catch (Exception e)
                {
                    Debug.Print(e.Message);
                }
            }
            else
                Debug.Print("Network Up event; state = Down");
        }

@ cyberh0me - Thanks for your answer, I got the same problem both with http and https…

@ cyberh0me - It’s the first time I use WCF so I’m not sure about anything :smiley:
The web service is accessible from a client deployed in localhost so it shold be configured properly.

The problem is that the server does not receive any request from gadgeteer, accordingly to this the connection timeout exception is the reaction I expect from it because it does not receive any response.

The gadgeteer is directly connected with the server so with a correct use of the proxy I expect a SOAP message to be received by the server, however the only packets received by the interface connected with gadgeteer are IGMP ones…

The instruction causing the exception is the following one:


It is part of a proxy method in charge of sending a request to the web service, following the method containing such an instruction:


```cs
public virtual loginResponse login(login req)
        {

            // Create request header
            String action;
            action = "http://tempuri.org/IService/login";
            WsWsaHeader header;
            header = new WsWsaHeader(action, null, EndpointAddress, m_version.AnonymousUri, null, null);
            WsMessage request = new WsMessage(header, req, WsPrefix.None);

            // Create request serializer
            loginDataContractSerializer reqDcs;
            reqDcs = new loginDataContractSerializer("login", "http://tempuri.org/");
            request.Serializer = reqDcs;
            request.Method = "login";


            // Send service request
            m_requestChannel.Open();
            WsMessage response = m_requestChannel.Request(request);
            m_requestChannel.Close();

            // Process response
            loginResponseDataContractSerializer respDcs;
            respDcs = new loginResponseDataContractSerializer("loginResponse", "http://tempuri.org/");
            loginResponse resp;
            resp = ((loginResponse)(respDcs.ReadObject(response.Reader)));
            response.Reader.Dispose();
            response.Reader = null;
            return resp;
        }
        

Do you have any idea about the reason gadgeteer does not send SOAP packets through the ethernet interface?

[SOLVED] Ok someway I fixed it :smiley:
I’ve deleted all dpws references from the project and then I added them again and now it works.
Go figure…