4
\$\begingroup\$

I am wondering if this code will work in 10.1.

This video at 1:02 says not to create mxd based services. I think that just means not using IMapServerObjects3, but seems like IMapDocument should be OK.

#region IServerObjectExtension Members

private IPageLayout m_Layout = null;
public void Init(IServerObjectHelper pSOH)
{
    serverObjectHelper = pSOH;
    // open an mxd and grab the layout
    IMapDocument mapDoc = new MapDocumentClass();
    mapDoc.Open(@"\\sharedFolder\Mymapdocument.mxd");
    m_Layout = mapDoc.PageLayout;
    mapDoc.Close();
}

public void Shutdown()
{
    System.Runtime.InteropServices.Marshal.FinalReleaseComObject(m_Layout);
}

#endregion

Edit: Here's a related question on GIS.stackexchange.

\$\endgroup\$
4
\$\begingroup\$

The reason why the video states that you should not create SOEs on top of MXD based map services is because in 10.1 you will not be able to start a service from an mxd. You will need to convert your map document into a service definition.

One of the issues you will find with MXD-based SOEs in 10 when you upgrade to 10.1, is that your code most likely will be accessing layers or layouts in the map service. This is pretty common in MXD-based SOEs because it is through layers that you get to the datasets you want to use in your code etc. At 10.1, your SOE code will break, because layers, layouts etc are only available in MXD-based SOE map services. If you create an MSD-based map service and build an SOE on top of it, you will notice the same. With MSD-based SOEs you need to use IMapServerDataAccess to get to the data sources in your map. And that code will just work in 10.1. So writting SOE's on top of MSD is a good way to understand what will be possible in 10.1

I suggest you look at this and this.

As for using IMapDocument... go for it. It will work fine in 10.1

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.