Hi! I’m very new to .NET MF and gadgeteer stuff and i’m facing a lot of troubles in implementing simple tasks :wall:
I’m trying to consume a wcf web service hosted on iis, using the wsdl stack
Facts:
- device is: spider (4.3.6 firmware) + ethernet j11d + a button
- .NET MF v4.3
- I generated the service data model by using mfsvcutil
- I can ping the device’s IP address, so the network stack should be ok (?)
The program just: sets the j11d static ip address, creates the proxy after the networkUp event, calls a method from the web service after the buttonPressed event
The question is: what i’m doing wrong? is the wsdl approach the right one or should i consider something different?
IService1ClientProxy proxy;
void ProgramStarted()
{
ethernetJ11D.NetworkInterface.Open();
ethernetJ11D.UseThisNetworkInterface();
ethernetJ11D.UseStaticIP("192.168.2.2", "255.255.255.0", "192.168.2.1");
ethernetJ11D.NetworkUp += ethernetJ11D_NetworkUp;
button.ButtonPressed += button_ButtonPressed;
}
void ethernetJ11D_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
{
Debug.Print("Network up!");
Debug.Print("Binding...");
WS2007HttpBinding binding = new WS2007HttpBinding(new HttpTransportBindingConfig(new Uri(UrlToService.svc)));
Debug.Print("Initializing proxy...");
proxy = new IService1ClientProxy(binding, new ProtocolVersion11());
}
void button_ButtonPressed(Button sender, Button.ButtonState state)
{
Debug.Print("Sending request...");
GetData req = new GetData();
req.value = 100;
GetDataResponse res = proxy.GetData(req);
Debug.Print(res.GetDataResult);
}
}
this is what happens when the network goes up:
Network up!
Binding...
Initializing proxy...
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (1) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::bind [IP: 0000] ####
#### System.Net.Sockets.Socket::Bind [IP: 0016] ####
#### Ws.Services.Binding.UdpTransportBindingElement::OnOpen [IP: 00a2] ####
#### Ws.Services.Binding.BindingElement::Open [IP: 0015] ####
#### Ws.Services.Binding.BindingElement::Open [IP: 000f] ####
#### Ws.Services.Binding.ReplyChannel::Open [IP: 0012] ####
#### Dpws.Client.DpwsClient::.ctor [IP: 0077] ####
#### tempuri.org.IService1ClientProxy::.ctor [IP: 000b] ####
#### GadgeteerAppWebServiceRequest.Program::ethernetJ11D_NetworkUp [IP: 002b] ####
#### 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 = 10022
#### SocketException ErrorCode = 10022
Eccezione first-chance di tipo 'System.Net.Sockets.SocketException' in Microsoft.SPOT.Net.dll
#### SocketException ErrorCode = 10022
#### SocketException ErrorCode = 10022
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (5) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::recvfrom [IP: 0000] ####
#### System.Net.Sockets.Socket::ReceiveFrom [IP: 0026] ####
#### System.Net.Sockets.Socket::ReceiveFrom [IP: 000a] ####
#### Ws.Services.Binding.UdpTransportBindingElement::OnProcessInputMessage [IP: 0023] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 0019] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 000f] ####
#### Ws.Services.Binding.ReplyChannel::ReceiveMessage [IP: 0016] ####
#### Ws.Services.Binding.ReplyChannel::ReceiveRequest [IP: 000d] ####
#### Ws.Services.Transport.UDP.WsUdpServiceHost::Listen [IP: 0010] ####
#### SocketException ErrorCode = 10050
#### SocketException ErrorCode = 10050
Eccezione first-chance di tipo 'System.Net.Sockets.SocketException' in Microsoft.SPOT.Net.dll
#### SocketException ErrorCode = 10050
#### SocketException ErrorCode = 10050
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (5) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::recvfrom [IP: 0000] ####
#### System.Net.Sockets.Socket::ReceiveFrom [IP: 0026] ####
#### System.Net.Sockets.Socket::ReceiveFrom [IP: 000a] ####
#### Ws.Services.Binding.UdpTransportBindingElement::OnProcessInputMessage [IP: 0023] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 0019] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 000f] ####
#### Ws.Services.Binding.ReplyChannel::ReceiveMessage [IP: 0016] ####
#### Ws.Services.Binding.ReplyChannel::ReceiveRequest [IP: 000d] ####
#### Ws.Services.Transport.UDP.WsUdpServiceHost::Listen [IP: 0010] ####
#### SocketException ErrorCode = 10050
#### SocketException ErrorCode = 10050
Eccezione first-chance di tipo 'System.Net.Sockets.SocketException' in Microsoft.SPOT.Net.dll
#### SocketException ErrorCode = 10050
#### SocketException ErrorCode = 10050
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (5) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::recvfrom [IP: 0000] ####
#### System.Net.Sockets.Socket::ReceiveFrom [IP: 0026] ####
#### System.Net.Sockets.Socket::ReceiveFrom [IP: 000a] ####
#### Ws.Services.Binding.UdpTransportBindingElement::OnProcessInputMessage [IP: 0023] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 0019] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 000f] ####
#### Ws.Services.Binding.ReplyChannel::ReceiveMessage [IP: 0016] ####
#### Ws.Services.Binding.ReplyChannel::ReceiveRequest [IP: 000d] ####
#### Ws.Services.Transport.UDP.WsUdpServiceHost::Listen [IP: 0010] ####
#### SocketException ErrorCode = 10050
#### SocketException ErrorCode = 10050
Eccezione first-chance di tipo 'System.Net.Sockets.SocketException' in Microsoft.SPOT.Net.dll
#### SocketException ErrorCode = 10050
#### SocketException ErrorCode = 10050
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (5) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::recvfrom [IP: 0000] ####
#### System.Net.Sockets.Socket::ReceiveFrom [IP: 0026] ####
#### System.Net.Sockets.Socket::ReceiveFrom [IP: 000a] ####
#### Ws.Services.Binding.UdpTransportBindingElement::OnProcessInputMessage [IP: 0023] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 0019] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 000f] ####
#### Ws.Services.Binding.ReplyChannel::ReceiveMessage [IP: 0016] ####
#### Ws.Services.Binding.ReplyChannel::ReceiveRequest [IP: 000d] ####
#### Ws.Services.Transport.UDP.WsUdpServiceHost::Listen [IP: 0010] ####
#### SocketException ErrorCode = 10050
#### SocketException ErrorCode = 10050
Eccezione first-chance di tipo 'System.Net.Sockets.SocketException' in Microsoft.SPOT.Net.dll
#### SocketException ErrorCode = 10050
#### SocketException ErrorCode = 10050
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (5) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::recvfrom [IP: 0000] ####
#### System.Net.Sockets.Socket::ReceiveFrom [IP: 0026] ####
#### System.Net.Sockets.Socket::ReceiveFrom [IP: 000a] ####
#### Ws.Services.Binding.UdpTransportBindingElement::OnProcessInputMessage [IP: 0023] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 0019] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 000f] ####
#### Ws.Services.Binding.ReplyChannel::ReceiveMessage [IP: 0016] ####
#### Ws.Services.Binding.ReplyChannel::ReceiveRequest [IP: 000d] ####
#### Ws.Services.Transport.UDP.WsUdpServiceHost::Listen [IP: 0010] ####
#### SocketException ErrorCode = 10050
#### SocketException ErrorCode = 10050
Eccezione first-chance di tipo 'System.Net.Sockets.SocketException' in Microsoft.SPOT.Net.dll
#### SocketException ErrorCode = 10050
#### SocketException ErrorCode = 10050
Il thread '<Nessun nome>' (0x3) è terminato con il codice 0 (0x0).
And so, calling the web service’s method can’t work:
Sending request...
#### Exception System.IO.IOException - 0x00000000 (1) ####
#### Message:
#### Ws.Services.Binding.HttpTransportBindingElement::OnProcessInputMessage [IP: 0066] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 0019] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 000f] ####
#### Ws.Services.Binding.RequestChannel::ReceiveMessage [IP: 002c] ####
#### Ws.Services.Binding.RequestChannel::Request [IP: 0017] ####
#### tempuri.org.IService1ClientProxy::GetData [IP: 0047] ####
#### GadgeteerAppWebServiceRequest.Program::button_ButtonPressed [IP: 001a] ####
#### Gadgeteer.Modules.GHIElectronics.Button::OnButtonEvent [IP: 0057] ####
#### 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] ####
Eccezione first-chance di tipo 'System.IO.IOException' in MFWsStack.dll
Error invoking method "Gadgeteer.Modules.GHIElectronics.Button" (check arguments to Program.BeginInvoke are correct)