2

それは今、私にとって非常に難しいパズルになります。C# Windows アプリ、Titanium iOS アプリ、Java アプリケーションなど、複数の言語を使用して実装された製品を友人のチームと共に開発しました。

datatype のパラメーターを使用する ac# Web サービスを使用していますbyte[]。サービス参照に追加して、Windows アプリでの作業を完了しました。

Titanium のチーム メイトから、この Web サービスのサンプル コードを、URL で直接サービス参照を使用せずに、次のいずれかで作成するように依頼されました。

  • soap または http post メソッドで呼び出します。
  • チタンで簡単に使えるWebサービスを作る
  • チタンで同じWebサービスを使用する方法に関するその他の有用なアイデア

チタンの少年は今チタンでより新鮮なので、私は何かをしなければなりませんが、私も立ち往生していて、彼に何かを提案する方法がわからないので、あなたの側からの助けが必要です.

4

2 に答える 2

1

バイナリ データを Base64 文字列にエンコードし、そのまま C# サービスに送信することをお勧めします。SOAP を使用しているため、非常に単純なソリューションになります。

于 2012-09-21T20:06:50.287 に答える
0

組み込みの Titanium ユーティリティを使用して、データを base64 にエンコードするだけです。

// Encode your data
var data = Titanium.Utils.base64encode(dataToSendToWebService);

HTTPClient を使用して送信します。

var postDataTOServer = Ti.Network.createHTTPClient({
    onload : function(e) {
         // If the service returns successfully : true, or false
         var isUserAllowed = this.responseText; 
    },
    onerror : function(e) {
        // Web service failed for some reason
        Ti.API.info(this.responseText);
        Ti.API.info('webservice failed with message : ' + e.error);
    }
});

// POST
postDataTOServer.open('POST', 'http://yoursite.com/aspwebservice');

// you may have to change the content type depending on your service
// but this is the correct type for binary data
postDataTOServer.setRequestHeader("Content-Type", "application/octet-stream");

// This does a POST to server
postDataTOServer.send(data);
于 2012-09-22T14:51:59.677 に答える