私はクライアント側のプレーンJavaScript とクライアント側のいくつかのjQuery JavaScriptでよく使われるWCFサービスを作成しています( )。それは それが一度にSystem.IO.Streamの コレクションを取得しますようにWCFサービスを呼び出すようにクライアントjQueryを使用してJavaScriptまたはJavaScriptコードを呼び出すWCFサービスを呼び出すSystem.IO.Streamのコレクションを取得していますか?
1)どのように私は、プレーン、クライアントJavaScriptを実装することができますか?また、コレクション内のSystem.IO.Stream オブジェクトをそれぞれHTMLイメージ要素に関連付けることができるように、平らなJavaScript側で受け取ったコレクションを通じて を反復する方法はありますか?
jqueryを使用するJavaScriptコードを実装すると、 がすぐにSystem.IO.Streamのコレクションを取得するようにWCFサービスを呼び出すことはできますか?さらに、 コレクション内の 各System.IO.StreamオブジェクトをHTMLイメージ要素に関連付けることができるように、jQueryを使用するJavaScript によって受け取られたコレクションを反復処理する方法はありますか?それは それが一度にSystem.IO.Streamの コレクションを取得しますようにWCFサービスを呼び出すように
/*********Start of Excerpt from the Interface Code of a WCF Service
Contract*****************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Text;
using System.ServiceModel.Web;
using System.IO;
using ConsoleForWCFServiceTutorial.PerlsDataContracts;
using ConsoleForWCFServiceTutorial.DataAccessObjectsDAO;
namespace ConsoleForWCFServiceTutorial
{
[ServiceContract(Namespace =
"http://ConsoleForWCFServiceTutorial.CarService")]
public interface ICarService
{
[OperationContract]
[WebInvoke(Method = "GET",
BodyStyle = WebMessageBodyStyle.WrappedRequest)]
Stream[] getImagesList();
}
}
/*********End of Excerpt from the Interface Code of a WCF Service
Contract*****************/
/*********Start of Excerpt of the code associated with the Class that
implements the WCF Service Contract*****************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.ServiceModel.Activation;
using System.Configuration;
using System.Data;
using System.IO;
using System.ComponentModel;
using ConsoleForWCFServiceTutorial.PerlsDataContracts;
using ConsoleForWCFServiceTutorial.DataAccessObjectsDAO;
namespace ConsoleForWCFServiceTutorial
{
[AspNetCompatibilityRequirements(RequirementsMode =
AspNetCompatibilityRequirementsMode.NotAllowed)]
class CarService : ICarService
{
public Stream[] getImagesList()
{
List<Stream> myImagesList = new List<Stream>();
string fileName = Path.Combine("BMWpicture.jpg");
FileStream fileStream =
new FileStream(fileName, FileMode.Open, FileAccess.Read);
// Set the content type as image/ jpeg
System.ServiceModel.Web.WebOperationContext.
Current.OutgoingResponse.ContentType = "image/jpeg";
myImagesList.Add(fileStream);
string fileName2 = Path.Combine("MercedesBenzpicture.jpg");
FileStream fileStream2 =
new FileStream(fileName2, FileMode.Open, FileAccess.Read);
// Set the content type as image/ jpeg
System.ServiceModel.Web.WebOperationContext.
Current.OutgoingResponse.ContentType = "image/jpeg";
myImagesList.Add(fileStream2);
return myImagesList.ToArray();
}
}
}
/*********End of Excerpt of the code associated with the Class that
implements the WCF Service Contract*****************/
<!--Start of Excerpt of the plain JavaScript client code that
invokes one of the Methods in the WCF Service
Contract-->
<script type="text/javascript">
function getImagesList2() {
var listOfStreams =
'http://localhost:8732/Design_Time_Addresses/ConsoleForWCFServiceTutorial/carService /getImagesList'
document.getElementById("image11").onload = function() {
}; // img.onload = function()
document.getElementById("image11").src = listOfStreams[0];
document.getElementById("image12").onload = function() {
}; // img.onload = function()
document.getElementById("image12").src = listOfStreams[1];
}
</script>
<!--End of Excerpt of the plain JavaScript client code that
invokes one of the Methods in the WCF Service
Contract-->
<!--Start of Excerpt of the HTML code that is affected by the
JavaScript client and WCF Service interaction-->
<body>
<form id="form1" runat="server">
<div>
<img src="" id="image11" alt="Smiley face" />
<img src="" id="image12" alt="Smiley face" />
<br />
<a class="large blue button" id="A7"
onClick="getImagesList2()">getImagesList2</a>
</div>
</form>
</body>
</html>
<!--End of Excerpt of the HTML code that is affected by the
JavaScript client and WCF Service interaction-->
1)どのように私は、プレーン、クライアントJavaScriptを実装することができますか?また、コレクション内のSystem.IO.Stream オブジェクトをそれぞれHTMLイメージ要素に関連付けることができるように、平らなJavaScript側で受け取ったコレクションを通じて を反復する方法はありますか?
2)それはそう、それは 一度System.IO.Streamのコレクションを取得しますようにWCFサービスを呼び出す をjqueryのを使用するJavaScriptコードを実装することは可能ですか?さらに、 コレクション内の 各System.IO.StreamオブジェクトをHTMLイメージ要素に関連付けることができるように、jQueryを使用するJavaScript によって受け取られたコレクションを反復処理する方法はありますか?