Search This Blog

Monday, January 23, 2012

.NET C# Jasper Server SOAP Web Services using Microsoft.Web.Services2.dll

I had some problems connecting to Jasper server using SOAP web services and the standard library System.Web.Services.dll.

The solution uses basic connectivity, the runReport() method and Microsoft.Web.Services2.dll from “Web Services Enhancements 2.0 for Microsoft .NET Framework”. You can download the library here.

You need path to reference it Visual Studio:

C:\Program Files (x86)\Microsoft WSE\v2.0\Microsoft.Web.Services2.dll

Whole needed source is available here.

var jasperService = new JasperService("http://localhost:8088/jasperserver/services/repository");
var credentials = new NetworkCredential("perspectiv", "perspectiv");
jasperService.Credentials = credentials;

string requestXML = "[.....]";
                   
jasperService.runReport(requestXML);
var attachments = jasperService.ResponseSoapContext.Attachments;
if (attachments.Count > 0)
{
    var atach = attachments[0];
    var atachStream = atach.Stream;
    using (var fileStream = File.Create("C:\\test\\test.pdf"))
    {
        atachStream.CopyTo(fileStream);
    }
}

12 comments:

  1. Remember to use Target framework: ".NET Framework 4" instead of target: ".NET Framework 4 Client profile"

    Sample Visual Studio project can be downloaded here

    ReplyDelete
    Replies
    1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from .Net Training in Chennai. or learn thru ASP.NET Essential Training Online

      Delete
  2. Cześć, rozwiązanie pomogło !, czy udało Ci się może przez .Net przypisac na jasperserver do raportu, lub poslac/wskazac w requescie do wywolania raportu z serwera plik xml jako datasource do raportu?

    ReplyDelete
  3. thank you very much, helped me a lot!

    ReplyDelete
  4. Hai Author Good Information that i found here,do not stop sharing and Please keep updating us..... Thanks. Hire dot net developer

    ReplyDelete
  5. I really enjoyed while reading your article, the information you have mentioned in this post was damn good. Keep sharing your blog with updated and useful information.
    You can also visit here .net certification training gurgaon

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea.
    here by i also want to share this.
    Java training in Chennai

    Java training in Bangalore

    Java online training

    Java training in Pune

    ReplyDelete
  8. شركة اللمسة الأخيرة تقدم لك الحل الأمثل فلا حشرات بعد اليوم ولن تعود مرة أخرى. فنحن نستخدم أفضل المبيدات العالمية الفعالة صديقة البيئة التي لا تترك رائحة ولا سيوثر على صحة الأنسان ويقوم باستخدامها عمال مدربون يقومون برش المبيدات بشكل علمي مما يضمن لك الراحة التامة نرجو التواصل على هذا الرقم 0580002467
    شركة رش مبيدات بأبها
    شركة مكافحة حشرات بأبها
    شركة مكافحة النمل الابيض بأبها
    شركة رش مبيدات بخميس مشيط
    شركة مكافحة حشرات بخميس مشيط
    شركة مكافحة النمل الابيض بخميس مشيط
    شركة رش مبيدات بالقصيم
    شركة مكافحة حشرات بالقصيم
    شركة مكافحة حشرات بجازان
    شركة رش مبيدات بجازان

    ReplyDelete
  9. I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge. I truly adored reading your posting. Thank you! security company

    ReplyDelete

If you like this post, please leave a comment :)