Call Web Service
pinbot
Texas
Is is possible to call a web service directly from FR .Net script?
Right now my .Net app that runs my FastReport Studio report calls a web service and then does a FindObject in the report to replace one of the picture with a map.
I'd like to be able to embed that part directy in the FR.NET report.
Here is the .net code (for FR Studio) I'm using to call one of my web services to return a URL that is a Microsoft Mappoint map.
//***** MAP
Int32 NewID;
IfrxPictureView pict = (IfrxPictureView)frx.FindObject("MAP");
if (pict != null)
{
NewID = Convert.ToInt32(id);
(mywebserviceurl).Service ws = new (mywebserviceurl).Service();
URL = ws.GetCPRMap("XXXt", NewID, (int)((IfrxComponent)pict).Width, (int)((IfrxComponent)pict).Height);
WebClient wc = new WebClient();
byte[] myDataBuffer = wc.DownloadData(URL);
System.IO.MemoryStream s = new System.IO.MemoryStream();
s.Write(myDataBuffer, 0, myDataBuffer.Length);
s.Position = 0;
System.Drawing.Image pic;
pic = System.Drawing.Image.FromStream(s, true);
s.Position = 0;
System.IO.MemoryStream s2 = new System.IO.MemoryStream();
pic.Save(s2, ImageFormat.Jpeg);
s2.Position = 0;
pict.LoadViewFromStream(s2);
s = null;
wc = null;
ws = null;
s2 = null;
}
Comments
You can put the code in the report script. You may use the report.StartReport event handler to call the code (to create an event handler, go to the Properties window, select "Report" item in the combobox, and click "Events" button).