vantagetim

Open Project "mxd" by web service and its transmission to Application

Discussion created by vantagetim on Feb 28, 2012
May be Adept can help me.
I asked my question in "forum ArcGIS Server - SOAP API" and I have not answer.
I can't find which ArcObject I have use for convert open Project "mxd" to image variable

Application1 call a web-servis1 which works on server ArcGis Server 10.
Web-servis1 Should open project MXD (C:\mydoc.mxd)
And return Image in such in container

public class clImage
{
public byte[] Image;
public double Scale = -1;
public clExtent Extent;
public clSize Size;
public double PageScaleNeed = -1;
public double PagePercent = -1;
}

I did the following in webservic1

IServerObjectManager pServerObjectManager = CreateServerObjectManager();
IServerContext serverContext = pServerObjectManager.CreateServerContext("", "");
IMapDocument mxd = serverContext.CreateObject("esriCarto.MapDocument") as IMapDocument;
mxd.Open("C:/mydoc.mxd", string.Empty);


then I try extract "image" from open file


IMapServerLayout LayoutServer = serverContext.ServerObject as IMapServerLayout;

IPageDescription pageDescription = LayoutServer.DefaultPageDescription;
//in this i have error  "Message="Server was unable to process request. ---> Object reference not set to an instance of an object."


IMapArea mapArea = serverContext.ServerObject as IMapArea;

What I do incorrect?

Thanks

Outcomes