Call Web Service

pinbotpinbot Texas
edited 2:35PM in FastReport .NET

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

  • edited 2:35PM
    Hello,

    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).

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.