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");
}