2015-10-20 146 views
0

我想連接到AzureML Web服務。我已經調查的Arduino的首頁POST方法和這裏https://iotguys.wordpress.com/2014/12/25/communicating-with-microsoft-azure-eventhub-using-arduino/Arduino Uno - WebService(AzureML)

這裏是我的設置方法:

void setup() 
    { 
     Serial.begin(9600); 
     while (!Serial) { 
     ; // wait for serial port to connect. 
     } 

    Serial.println("ethernet"); 

    if (Ethernet.begin(mac) == 0) { 
     Serial.println("ethernet failed"); 
     for (;;) ; 
    } 
    // give the Ethernet shield a second to initialize: 
    delay(1000); 
} 

POST方法是基於這樣的:http://playground.arduino.cc/Code/WebClient

我只是說sprintf(outBuf, "Authorization: Bearer %s\r\n", api_key);到標頭,與char* api_key = "the ML Web Service API KEY"

此外,與WebClient中指定的不同,我使用整個WebService URI作爲url並且不指定頁面名稱。

這不起作用。

我連接的網絡具有Internet訪問權限。

我在做什麼錯?

回答

0

您創建的Machine Learning Studio服務需要接收來自具有SSL功能的設備的請求,以執行HTTPS請求。 AFAIK,Arduino不支持SSL功能。

一個常見的情況是將Arduino連接到第三個設備,如Raspberry Pi 2等,將其用作網關並從Pi本身進行呼叫。

以下是來自Microsoft Open Technologies團隊的示例project,該團隊利用Arduino Uno,Raspberry pi和Azure的東西。

希望這會有所幫助!