I am trying to uncompress and recompress both the msd and sd file so as to tweak some things I want. In fact I want to get inside the layers folder and for each layer.xml file to string replace the the name of the dbconnection. My goal is to create, with a bat file, 5 sd files genarated from an original sd file - for 5 users that are connected to the same oracle xe database, with the same password. It looks ambitious but It works. I tried channging the db names by hand, by getting inside the sd and the the msd packages, using 7zip following a method described by @ericchiasson here. In the same article @jpmc26 states that you can recompress and uncompress the sd, but you have to follow specific compression properties. @jpmc26 says:

By the way, you can recompress an sd file. You have to use the right compression options. Options that work for me are Format: 7z, Word Size: 16, Solid Block size: Non-solid. I also set Dictionary Size to 64KB, but I don't think that matters. All other options were left to their defaults. (I made some educated guesses based on the fact 7-zip reports the compression method as "LZMA:16" for an sd file.) – jpmc26 Jun 18 at

I followed his instruction and used 7z from command line like this: 7za a -t7z -m0=lzma -md=64k -ms=off %MAP_NAME_MXD%.7z However these properties work for compressing the sd file. Inside the .sd there is one compressed file which is of .msd type. I try compressing it with the same configutaration, after having uncompressing that so as to tweak the .xml files inside of it.

When I try to publish my generated sd it is published correctly but it fails to start. I tried replaceying with the original msd the generated msd inside of my newly generated sd, and both service publish and start worked. This made me thinking that the method of compressing the msd package is the problematic one.

Can anyone tell me what are the correct compression options for the msd files ? An alternative would be to avoid uncompression and recompression by injected in some way the tweaked layer xml files inside of the msd. But I dont know if that is possible

  • When I tampered with MSD files in ArcGIS 10.0 i just used windows "compressed folders". It uses the deflate algorithm. Have you checked the logs on AGS to see why it does not start? Are you sure the password works the same for all users when it has been encrypted? Try storing the password in plain text. Just change the tag ENCRYPTED_PASSWORD in the layer files to PASSWORD and write it in plain text. – Stefan Nov 19 '14 at 10:37
  • @stefan the password works ok. since I tweak by hand the db connction names which have the same password and it works. The server log prompts 2 messages when attempting to start: ailed to construct instance of service 'DB1_CRD_MapService.MapServer'. null Server WIN-0US6PNCMJTI 8274 3216 1 SEVERE 18 Nov 2014 15:06:47 Failed to initialize server object 'DB1_CRD_MapService': 0x80004005: Server environment property not found: requestProperties – Smalis Nov 19 '14 at 11:30
  • @Stefan how can I use windows compressed folders ?is that a tool ? I did not get you – Smalis Nov 19 '14 at 11:34
  • Just right click a selection of files in windows file explorer and click Send to->Compressed folder in the pop up menu. It will create a zip-file which you can rename to MSD (remember to not hide known file extensions in the file explorer settings). It is obviously not suitable for your script, but for testing purposes. Using 7-zip I verified that 10.2 MSD files also use deflate compression. – Stefan Nov 19 '14 at 11:48
  • I forgot: MSD files start with "PK", which is the magic number for Zip files (PKzip) using deflate. – Stefan Nov 19 '14 at 12:23

Your Answer

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

Browse other questions tagged or ask your own question.