Somebody knows ? How can I send some data to web service from arduino uno ? I want to open relay if username and password are true on remote web service ?
have a look at this page;
http://arduino.cc/en/Tutorial/XivelyClientString
I must send data to dotnet web service. how can I make it ? please help ?
how can I make it ?
Use a text editor.
If you want more help, provide more details.
Aleyna:
how can I make it ? please help ?
You need to either learn to do it, or find somebody to do it for you. Note that most people would expect to be paid for working for you, but if you're willing to pay then the Gigs & Collaborations section is the place to ask.
If you're doing it yourself and run into a problem then there are plenty of people here who will be willing to help you solve the problem, but you need to demonstrate that you're actually doing it yourself and have made a reasonable effort to solve the problem for yourself. You haven't done that yet.
ws.example.com/service.aspx
strtextbox:
linkbutton1:
labelfinished
I want to send 12345 strings to strtextbox and then push linkbutton1 on ws.example.com/service.aspx from my arduino, if my strings is 12345, labelfinished will back to me true, if my string is not 12345, labelfinished back to me false. I want to make this sketch web site is working perfectly. but arduino didnt worked please help. I tried to connect with arduino web client example, not working
it says only
connecting...
connected...
disconnecting..
Simple client test code you can try to see if you get a response from the server.
//zoomkat 9-22-12
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields
//remove SD card if inserted
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
char serverName[] = "web.comporium.net"; // zoomkat's test web page server
EthernetClient client;
//////////////////////
void setup(){
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
while(true);
}
Serial.begin(9600);
Serial.println("Better client test 9/22/12"); // so I can keep track of what is loaded
Serial.println("Send an e in serial monitor to test"); // what to do to test
}
void loop(){
// check for serial input
if (Serial.available() > 0) //if something in serial buffer
{
byte inChar; // sets inChar as a byte
inChar = Serial.read(); //gets byte from buffer
if(inChar == 'e') // checks to see byte is an e
{
sendGET(); // call sendGET function below when byte is an e
}
}
}
//////////////////////////
void sendGET() //client function to send/receive GET request data.
{
if (client.connect(serverName, 80)) { //starts client connection, checks for connection
Serial.println("connected");
client.println("GET /~shb/arduino.txt HTTP/1.1"); //download text
client.println("Host: web.comporium.net");
client.println("Connection: close"); //close 1.1 persistent connection
client.println(); //end of get request
}
else {
Serial.println("connection failed"); //error message if no client connect
Serial.println();
}
while(client.connected() && !client.available()) delay(1); //waits for data
while (client.connected() || client.available()) { //connected or data available
char c = client.read(); //gets byte from ethernet buffer
Serial.print(c); //prints byte to serial monitor
}
Serial.println();
Serial.println("disconnecting.");
Serial.println("==================");
Serial.println();
client.stop(); //stop client
}
nothing happens
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char server[] = "ws.example.com/webservicetest.asmx";
// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192,168,0,3);
IPAddress gateway(192,168,0,1);
IPAddress subnet(255,255,255,0);
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
// try to congifure using IP address instead of DHCP:
Ethernet.begin(mac, ip, gateway, subnet);
}
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println("connecting...");
// if you get a connection, report back via serial:
if (client.connect(server, 80)) {
Serial.println("connected");
// Make a HTTP request:
client.print("GET /ws.example.com/webservicetest.asmx?String1=12345");
client.println(" HTTP/1.1");
client.println("Host: ws.example.com");
client.println("Connection: close");
client.println("Content-Type: text/xml; charset=UTF-8");
client.println("Content-Length: length");
client.println();
}
else {
// if you didn't get a connection to the server:
Serial.println("connection failed");
}
}
void loop()
{
// if there are incoming bytes available
// from the server, read them and print them:
if (client.available()) {
char c = client.read();
Serial.print(c);
}
// if the server's disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
// do nothing forevermore:
while(true);
}
}
nothing happens
char server[] = "ws.example.com/webservicetest.asmx";
That isn't the name of the server. That's that name of the service running on the server.
client.print("GET /ws.example.com/webservicetest.asmx?String1=12345");
The GET request specifies the name of the script execute on the server you already connected to.
client.println("Content-Length: length");
How many bytes would that be?
In any case, something happened. You need to be a lot more specific about what happened.
It is also unlikely that the service expects just an argument like that. Services normally expect a SOAP packet.
Forget the Arduino for a while. Concentrate on getting the PC to connect to the server, pass data to the service, get a response from the service and parse the response. When that works, making the Arduino do the same thing(s) will be a lot easier.