Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
XML
data.xmlanalysis
mappoint.webservice
msf
msxml-webrelease
netmyservices.sdk
passport.sdk
soap
soapsdk
uddi.general
uddi.programming
uddi.specification
xml
xmlsqlwebrelease
xsl
  
 
date: 9 Mar 2007 10:19:32 -0800,    group: microsoft.public.mappoint.webservice        back       


Method RenderServiceSoap.GetMap can not be reflected   
Hi,

I'm trying to use the MapPoint web service to return a map view in a
simple VS 2005 project. When I run the following code locally (using
IIS 5.1) it works fine. When I move the project to a development
server (using IIS 6.0) I get the following error on the first line of
code:

"Method RenderServiceSoap.GetMap can not be reflected."

Here is my test code:

protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            MapPointService.RenderServiceSoap render = new
MapPointService.RenderServiceSoap();

           string sUser =
System.Configuration.ConfigurationManager.AppSettings["MapPointUserID"];
            string sPassword =
System.Configuration.ConfigurationManager.AppSettings["MapPointUserPassword"];
            render.Credentials = new
System.Net.NetworkCredential(sUser, sPassword);


            MapPointService.MapSpecification mapSpec = new
MapPointService.MapSpecification();
            mapSpec.DataSourceName = "MapPoint.NA";


            //Set the view.
            mapSpec.Views = new MapPointService.MapView[1];
            mapSpec.Views[0] = SetView();


            mapSpec.Options = new MapPointService.MapOptions();
            mapSpec.Options.ReturnType =
MapPointService.MapReturnType.ReturnImage;
            mapSpec.Options.Format = new
MapPointService.ImageFormat();
            mapSpec.Options.Format.MimeType = "image/png";
            mapSpec.Options.Format.Width = 400;
            mapSpec.Options.Format.Height = 400;

            MapPointService.MapImage map = new
MapPointService.MapImage();
            map = render.GetMap(mapSpec)[0];


            MemoryStream imageStream = new
MemoryStream(map.MimeData.Bits);
            Bitmap rawBitmap = new Bitmap(imageStream, false);
            WritePngToStream(rawBitmap, Response.OutputStream);
        }
        catch (Exception Ex)
        {
            Response.Write(Ex.Message.ToString());
        }
    }



    private MapPointService.ViewByBoundingLocations SetView()
    {
        MapPointService.Location[] myLocations = new
MapPointService.Location[2];
        MapPointService.ViewByBoundingLocations tempView = new
MapPointService.ViewByBoundingLocations();

        //set NE corner
        myLocations[0] = new MapPointService.Location();
        myLocations[0].LatLong = new MapPointService.LatLong();
        myLocations[0].LatLong.Latitude = 42.3595;
        myLocations[0].LatLong.Longitude = -71.0151;

        //set SW corner
        myLocations[1] = new MapPointService.Location();
        myLocations[1].LatLong = new MapPointService.LatLong();
        myLocations[1].LatLong.Latitude = 41.8999;
        myLocations[1].LatLong.Longitude = -71.9;

        tempView.Locations = myLocations;

        return tempView;
    }



    private void WritePngToStream(Bitmap image, Stream outStream)
    {
        MemoryStream writeStream = new MemoryStream();
        image.Save(writeStream,
System.Drawing.Imaging.ImageFormat.Png);
        writeStream.WriteTo(outStream);
        image.Dispose();
    }


Any ideas as to why this might be happening? The problem only seems to
occur with VS 2005 projects running under IIS 6.0. The VS 2003
projects have not been problematic.

Thanks in advance for your help.
date: 9 Mar 2007 10:19:32 -0800   author:   unknown

RE: Method RenderServiceSoap.GetMap can not be reflected   
Sounds like something went wrong inside your reference.cs

http://vijaymodi.wordpress.com/2007/02/01/web-services-error-method-testdata-cannot-be-reflected/

Also something similar on the MSDN about looking into innerexceptions:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=320698&SiteID=1

Hope that helps,
-- 
Infusion Development
http://www.infusiondev.com


"vancejulia@comcast.net" wrote:

> Hi,
> 
> I'm trying to use the MapPoint web service to return a map view in a
> simple VS 2005 project. When I run the following code locally (using
> IIS 5.1) it works fine. When I move the project to a development
> server (using IIS 6.0) I get the following error on the first line of
> code:
> 
> "Method RenderServiceSoap.GetMap can not be reflected."
> 
> Here is my test code:
> 
> protected void Page_Load(object sender, EventArgs e)
>     {
>         try
>         {
>             MapPointService.RenderServiceSoap render = new
> MapPointService.RenderServiceSoap();
> 
>            string sUser =
> System.Configuration.ConfigurationManager.AppSettings["MapPointUserID"];
>             string sPassword =
> System.Configuration.ConfigurationManager.AppSettings["MapPointUserPassword"];
>             render.Credentials = new
> System.Net.NetworkCredential(sUser, sPassword);
> 
> 
>             MapPointService.MapSpecification mapSpec = new
> MapPointService.MapSpecification();
>             mapSpec.DataSourceName = "MapPoint.NA";
> 
> 
>             //Set the view.
>             mapSpec.Views = new MapPointService.MapView[1];
>             mapSpec.Views[0] = SetView();
> 
> 
>             mapSpec.Options = new MapPointService.MapOptions();
>             mapSpec.Options.ReturnType =
> MapPointService.MapReturnType.ReturnImage;
>             mapSpec.Options.Format = new
> MapPointService.ImageFormat();
>             mapSpec.Options.Format.MimeType = "image/png";
>             mapSpec.Options.Format.Width = 400;
>             mapSpec.Options.Format.Height = 400;
> 
>             MapPointService.MapImage map = new
> MapPointService.MapImage();
>             map = render.GetMap(mapSpec)[0];
> 
> 
>             MemoryStream imageStream = new
> MemoryStream(map.MimeData.Bits);
>             Bitmap rawBitmap = new Bitmap(imageStream, false);
>             WritePngToStream(rawBitmap, Response.OutputStream);
>         }
>         catch (Exception Ex)
>         {
>             Response.Write(Ex.Message.ToString());
>         }
>     }
> 
> 
> 
>     private MapPointService.ViewByBoundingLocations SetView()
>     {
>         MapPointService.Location[] myLocations = new
> MapPointService.Location[2];
>         MapPointService.ViewByBoundingLocations tempView = new
> MapPointService.ViewByBoundingLocations();
> 
>         //set NE corner
>         myLocations[0] = new MapPointService.Location();
>         myLocations[0].LatLong = new MapPointService.LatLong();
>         myLocations[0].LatLong.Latitude = 42.3595;
>         myLocations[0].LatLong.Longitude = -71.0151;
> 
>         //set SW corner
>         myLocations[1] = new MapPointService.Location();
>         myLocations[1].LatLong = new MapPointService.LatLong();
>         myLocations[1].LatLong.Latitude = 41.8999;
>         myLocations[1].LatLong.Longitude = -71.9;
> 
>         tempView.Locations = myLocations;
> 
>         return tempView;
>     }
> 
> 
> 
>     private void WritePngToStream(Bitmap image, Stream outStream)
>     {
>         MemoryStream writeStream = new MemoryStream();
>         image.Save(writeStream,
> System.Drawing.Imaging.ImageFormat.Png);
>         writeStream.WriteTo(outStream);
>         image.Dispose();
>     }
> 
> 
> Any ideas as to why this might be happening? The problem only seems to
> occur with VS 2005 projects running under IIS 6.0. The VS 2003
> projects have not been problematic.
> 
> Thanks in advance for your help.
> 
>
date: Mon, 12 Mar 2007 10:16:52 -0700   author:   Derek Chan

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us