WebOS タブレットで使用されている JavaScript を介して、ローカル ネットワーク上の Web サービス ページにコマンドを送信しようとしています。問題は、私がこれまでにこれをやったことがなく、そもそもそれが可能かどうか疑問に思っていたことです? VB.net を作成して、Web サービスの呼び出しや Web ページをリッスンすることはできますか?
Dreamweaver を使用して phonegap から「アプリ」を作成します。アプリで押すボタンに応じて必要に応じてタスクを実行するために、JavaScript を使用して PC 上で常に読み取ることができる文字列を Web サービスに送信する例を探しています。
例として:
WebOS app >
button pushed in app to call up Internet Explorer >
sends "IE" string to WS >
WS triggers the correct exec to start depending on the string sent to it (IE) >
WS sends back "OK" to WebOS app when program is launched
誰かがこのような例を持っていますか?
更新 だから私は私のjavascriptでそのようなことをしますか?:
<!DOCTYPE html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
function buttonClicked(str what2Pass)
{
$.ajax({
async : false, /* set as true if you want asynchronous behavior */
type: "POST",
contentType: "application/json; charset=utf-8",
url: "http://localhost:7777/WebService.asmx/PerformAction",
data: { "webOSCommand" : what2Pass},
dataType: "json",
success: function(data){
alert(true);
}
});
}
<html>
<body>
<input type="button" id="button1" value="run IE on PC" onClick="buttonClicked('IE');" />
</body>
</html>
私のWSの場合は次のようになります。
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Diagnostics
Imports System.Web.Script.Services
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<ScriptService()> _
Public Class Service
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function PerformAction(byRef webOSCommand as String) As String
Dim oPro As New Process
With oPro
.StartInfo.UseShellExecute = True
.StartInfo.Arguments = "http://www.google.com"
.StartInfo.FileName = "internet explorer.exe"
.Start()
End With
Return "Started"
End Function
End Class