Access Sitecore Elements through the .NET Web Service

Is anyone lucky using the .NET web service to access Sitecore items? I have several web applications on my server that are still in Coldfusion. I would like to be able to call the web service to pull the elements, but when I tried to do this, I got the exception "Sitecore.Data.Items.Item cannot be serialized because it does not have a constructor without parameters."

+6
web-services sitecore
source share
3 answers

Take a look at the standard Sitecore web service, you can find it in the / sitecore / shell / WebService folder of your solution. It offers some basic operations with Sitecore elements and fields, but is often enough to pull or save data.

Hope this helps.

+7
source share

I answered that

+2
source share

If both the serializer and deserializer have access to the Sitecore database, you can easily create a wrapper that simply serializes the identifier, database name, version, and language. Then, when deserializing at the other end, you can reselect the same Sitecore element from the database using this information.

If the deserializer does not have access to the database at all, it really depends on your data usage needs. I usually item.Fields.ReadAll() over all the fields (remember to use item.Fields.ReadAll() ) and save them in the dictionary for easy access. For serialization, I convert this to a pair of List<T> values ​​and ignore the Dictionary member (since it cannot be serialized), and then re-populates it with deserialization. I also save several other properties, such as ID, language, version, template, path, etc.

Alternatively, if you create an entire library of model classes so that each template is mapped to a class (some people do this), you can (possibly) serialize these strings since they (probably) are no longer bound to the Sitecore item.

+1
source share

All Articles