Unable to access the methods envolved in Reddot webservice.

226 views
Skip to first unread message

Sami Dubey

unread,
Dec 5, 2014, 4:40:41 AM12/5/14
to reddot-c...@googlegroups.com
Dear All,
 
We are trying to access the page's HTML using page GUID. However we are not able to achieve this using RQL in .Net 4.0 version.
 
Please find the code below we are trying so far
---------------------------------
// look up how to transfer asp session to aspx session
// Basically, asp page loop through all sessions and submit them to aspx
// which then save the received sessions into aspx sessions
string _LoginGuid = HttpContext.Current.Session["projectguid"].ToString();
string _SessionKey = HttpContext.Current.Session["sessionkey"].ToString();
string _PageGuid = HttpContext.Current.Session["treeguid"].ToString();
 
// RqlService is a class manually generated using Visual Stuio by pointing to the web service URL
RqlService RqlServiceObj = new RqlService();
 
string RQL_Command = string.Format("<IODATA sessionkey=\"{0}\" loginguid=\"{1}\"><PAGE action=\"load\" guid=\"{2}\"/></IODATA>", _LoginGuid, _SessionKey, _PageGuid);
object retObj = RqlServiceObj.ExecuteString(RQL_Command);
 
if (retObj != null)
{
    // parse that retObj
}
----------------------------
 
Please help on this if any one have already used it so far.
 
Thanks in Advance,
With Regards
Samridhi

Bernd Braun

unread,
Dec 5, 2014, 4:45:18 AM12/5/14
to reddot-c...@googlegroups.com
Hi Samridhi,

normally you receive a string and not a object, are you sure that you receive a object from the execute command? maybe this is the issue.

Cheers

Bernd


--
You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reddot-cms-use...@googlegroups.com.
To post to this group, send email to reddot-c...@googlegroups.com.
Visit this group at http://groups.google.com/group/reddot-cms-users.
For more options, visit https://groups.google.com/d/optout.

Sami Dubey

unread,
Dec 5, 2014, 4:58:52 AM12/5/14
to reddot-c...@googlegroups.com
Hi Bernd,
 
We are unable to get the classes available in the CMS webservice. Could you please let us know how we can get that. It is failing in the first step itself.
// RqlService is a class manually generated using Visual Stuio by pointing to the web service URL
RqlService RqlServiceObj = new RqlService();
 
However we are able to reference the webservice in .Net 4.0 as add reference and gave the webservice URL.
After referring to it we are unable to view any methods or classes so that we could get the page HTML using page GUID.
 
Thanks,
Regards
Samridhi

Jian Huang

unread,
Dec 7, 2014, 11:59:33 PM12/7/14
to reddot-c...@googlegroups.com
Hi Samridhi,

The session variables are ASP sessions.  Please first google "transfering asp sessions to .net sessions"

There are .NET code samples for both MS 10.x (.NET 2, I think) and MS 11.x (.NET 4) in the RQL manual, please download that and have a look.

If you are going the .NET route, instead of the JQuery RQL route, please have a look at Hilmar's https://github.com/erminas/smartapi

If you are going the JQuery RQL route, here is the 7.x to 11.x compatible connector, https://github.com/jhuangsoftware/j-rql-connector-https

Sami Dubey

unread,
Dec 8, 2014, 1:34:00 AM12/8/14
to reddot-c...@googlegroups.com
Hi Jian,
 
Thank you for the information :)
 
Regards
Samridhi

Sami Dubey

unread,
Dec 11, 2014, 12:29:16 AM12/11/14
to reddot-c...@googlegroups.com
Hi Jian,
 
We are able to get the page using page guid and also we are able to see the placeholders/elements of  it.
Could you please assist how could we retrieve html of any text placeholder, we tried below code and we are failing in that.
 

var newpage = project.Pages.GetByGuid(pageGuid, project.LanguageVariants.Current);

var element = newpage.ContentClass.Elements.GetByName("txt_body");

Thanks in Advance,
With Regards
Samridhi

Jian Huang

unread,
Dec 11, 2014, 12:53:37 AM12/11/14
to reddot-c...@googlegroups.com
Hi,

The code provide is rendertag, not RQL.

Also, one can simply get the content of a text placeholder via the native placeholder <%txt_body%>, no need for the costly use of rendertag.

Anyways, the solution I have suggested would look something like this

<div class="my-text">
     <%txt_body%>
</div>
<script>
    $('.my-text a').each(function(){
          // is this link to PDF?
          // if yes, AJAX to a server side page to get file size
          // append info after $(this)
    });
</script>

Sami Dubey

unread,
Dec 11, 2014, 6:18:40 AM12/11/14
to reddot-c...@googlegroups.com
Hi Jian,
 
We are able to get the text placeholder using rendertag.
Now we are stuck at position where we need this page to be published via rendertag as mentioned below. However we are unable to achieve this. Also how to pass the email ID, so that to get the successful message whenever a page is published via below mentioned rendertag.
 

var publish = newpage.CreatePublishJob();

publish.ProjectVariants = project.ProjectVariants;

publish.LanguageVariants = project.LanguageVariants;

publish.IsSendingEmailOnCompletion = true;

//publish.EMailReceipient.EMail = project.Users.

publish.IsPublishingAllFollowingPages = false;

publish.IsPublishingRelatedPages = false;

publish.PublishOn = DateTime.Now.AddSeconds(5.0);

publish.RunAsync();

 

Your input will help us a lot.

 

Thanks,

With Regards

Samridhi Dubey

Jian Huang

unread,
Dec 16, 2014, 10:30:34 PM12/16/14
to reddot-c...@googlegroups.com
Hi Samridhi,

It has been sometime since your last question, I hope you have made progress.

The code you have provided is not rendertag, but .NET code, to be more specific, it is .NET code using Hilmar's RQL library (awesome library for anything more than a quick/simple page plugin).

I think you meant to ask "Why do the following code won't publish a page?  Do the publish function in this library support email parameter?".

If you have found your answer, it would be great to share it back to the community so other people may benefit in the future.

Sami Dubey

unread,
Dec 17, 2014, 4:57:42 AM12/17/14
to reddot-c...@googlegroups.com
Hi Jian,
 
Yes, we are able to publish the page using the code lines I have mentioned in earlier chat.
 
We are getting problem in commiting the text placeholder content changes.
We are able to get the text placeholder content and modified it using .Net code.When we page preview it is not appearing however changed contents are reflecting on the text placeholder.
 
Code where we can set the textplaceholder content:

project.SetTextContent(elementGuid, project.LanguageVariants.Current, "TextHtml", text);

 When we click on 'OK' button of 'Edit Element via Form' in Reddot Tool it appears in the page preview as well.
 
So we are stuck at place where we are not getting any method which could trigger the 'OK' button to reflect our changes in preview as well as publish the same changes.
 
It would be great help for us if some one can give us idea for the same.
 
Thanks,
With Regards
Samridhi Dubey
 

Jian Huang

unread,
Dec 17, 2014, 10:52:15 PM12/17/14
to reddot-c...@googlegroups.com
Hi,

What is the code used to display the content of the text element?

-Jian

Jian Huang

unread,
Dec 17, 2014, 10:58:51 PM12/17/14
to reddot-c...@googlegroups.com
Hi Sami,

My apology, the provided code is actually not rendertag.  I assumed too soon after taking just a quick look.

The code is just using the 3rd party RQL library to handle RQLs via . NET.

-Jian

Sami Dubey

unread,
Dec 17, 2014, 11:05:16 PM12/17/14
to reddot-c...@googlegroups.com
Sorry couldn't get you for the code line....
We are just trying to change the content of text placeholder and publish the same...where we are able to change the content using server manager's set method..... also we are able to release the page.

It is not publishing the content we changed for text placeholder, however we could see our changed content in management server.

If we open the same content using 'Edit element via form' snd then 'ok' . It is appearing in page preview as well as publishes the same.

We are unable to find the method to save or ok the changed content of text placeholder.

Jian Huang

unread,
Dec 17, 2014, 11:16:45 PM12/17/14
to reddot-c...@googlegroups.com
Hi Sami,

I am a little confused.

If the content of text placeholder was changed by the .NET RQL, did the changed content display in page preview?  Did the changed content display in edit via form?

If no in page preview, but yes in edit via form, then that means the 3rd party implementation saved the content correctly,  However, it is your implementation on the template code that prevents update of the cache.

Then again, manually editing the content via form refreshes cache, so I can assume the template code might be correct, but only 70% sure.

The ability to see the snippet of code that is responsible for displayed the text content will help to answer a lot of questions.

-Jian

Sami Dubey

unread,
Dec 18, 2014, 12:04:59 AM12/18/14
to reddot-c...@googlegroups.com
Hi,
 
Yes the content of text placeholder was changed by .NET.
Yes we are able to see changed content in the 'edit via form' , not in page preview.
Then manually if we press 'OK' it appears on the page preview.
 
As you explained about caching, can you please help us on the clearing the text placeholder caching or any mechanism to save/ok the content for text placeholder.
Code Snippet below:
==============================================================

            var pageGuid = new Guid(pageGUID);

            var newpage = project.Pages.GetByGuid(pageGuid, project.LanguageVariants.Current);

            var elementGuid = new Guid(elementGUIDArray[count]);

            count++;

            newpage.ResetToDraft();

            string text = project.GetTextContent(elementGuid, project.LanguageVariants.Current, "TextHtml");

            text = text.Replace("Recent", "Reciiient");

            //text placeholder content are getting changed in below code

            project.SetTextContent(elementGuid, project.LanguageVariants.Current, "TextHtml", text);

            newpage.Release();

            var publish = newpage.CreatePublishJob();

            publish.ProjectVariants = project.ProjectVariants;

            publish.LanguageVariants = project.LanguageVariants;

            publish.IsPublishingAllFollowingPages = true;

            publish.IsPublishingRelatedPages = true;

            publish.RunAsync();

=========================================================================

Thanks in Advance,
With Regards
Samridhi Dubey

Jian Huang

unread,
Dec 23, 2014, 4:26:54 PM12/23/14
to reddot-c...@googlegroups.com
Hi Samridhi,

Since you are unable to provide template code that is responsible for displaying the text element content.  I assume you have no access or the previously provided .NET RQL code runs outside of the system.

Just run this RQL or whatever similar function this library provides to clear page cache

<PAGEBUILDER><PAGES action="pagevaluesetdirty"><PAGE guid="###PAGEGUID###"/></PAGES></PAGEBUILDER>

-Jian

Sami Dubey

unread,
Dec 30, 2014, 5:51:59 AM12/30/14
to reddot-c...@googlegroups.com
Hi Jian,
 
Thank you for the information.
Code we tried:
const string MARK_DIRTY =

                  @"<PAGEBUILDER><PAGES action=""pagevaluesetdirty""><PAGE sessionkey=""{0}"" guid=""{1}""/></PAGES></PAGEBUILDER>";

            project.ExecuteRQL( MARK_DIRTY.RQLFormat(project.Session.SessionKey, pageGuid),RqlType.SessionKeyInProject);
Still hardluck we are not able to see the changed content either via page preview or via publishing using .Net RQL.
This is the only place where we are lacking, we are able to change the content of text placeholder dynamically. However we are not able to preview and publish. If any one has any idea please let us know.
 
Thanks,
Regards
Samridhi Dubey

Hilmar Bunjes

unread,
Jan 6, 2015, 10:15:40 AM1/6/15
to reddot-c...@googlegroups.com
Hi Sami,
I've just seen this discussion (and thanks to Jian for the very positive statement about the SmartAPI :-) ). I'm wondering if the Page Preview looks correctly if you clear the page cache before viewing the page.

In the SmartAPI support Google group there was another question from Abhishek Singhal with the same kind of problem. I'm not sure if you are connected. The project.GetTextContent(...) is not the way you should change an element. Unfortunately, it has been provided in the 1.0 version and, therefore, we cannot remove it and stay API-compatible the same way. 

To change the element you should navigate to the page (get it either by ID or GUID from the project) and then change the element of that page.


Best,
Hilmar

Jian Huang

unread,
Jan 6, 2015, 11:40:28 AM1/6/15
to reddot-c...@googlegroups.com
Hilmar, not a problem.  The library is an excellent addition to the community.

Is Sami sending the RQL correctly?  I noticed she did not include <IODATA loginguid="###" sessionkey="###">...</IODATA> in the RQL string.

-Jian

Hilmar Bunjes

unread,
Jan 7, 2015, 4:28:43 AM1/7/15
to reddot-c...@googlegroups.com
Hi Jian,
yes, the IODATA including the attributes is added automatically by the SmartAPI. However, reading it again I'd expect to use "SessionKeyInIodata" (to put the session key into the IODATA block) as RqlType instead of "SessionKeyInProject".

Best,
Hilmar
--
You received this message because you are subscribed to a topic in the Google Groups "RedDot CMS Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/reddot-cms-users/vSRKTK98ds0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to reddot-cms-use...@googlegroups.com.

Sami Dubey

unread,
Jan 23, 2015, 1:24:58 AM1/23/15
to reddot-c...@googlegroups.com
Hi All,
 
Would like to share that, now we are able to achieve our solution using below RQL
const string MARK_DIRTY =

@"<ELEMENTS action=""Save""><ELT guid=""{0}"" /></ELEMENTS>";

project.ExecuteRQL(MARK_DIRTY.RQLFormat(elementGuid), RqlType.SessionKeyInIodata);

So the flow was like.

1. Setting the text placeholder value using below code:

 project.SetTextContent(elementGuid, project.LanguageVariants.Current, "TextHtml", text);

2. Saving the placeholder value using RQL:

const string MARK_DIRTY =

@"<ELEMENTS action=""Save""><ELT guid=""{0}"" /></ELEMENTS>";

project.ExecuteRQL(MARK_DIRTY.RQLFormat(elementGuid), RqlType.SessionKeyInIodata);

3. Releasing the page as mentioned below code:

  newpage.Release();

 

And this solution helped us to change the content of text placeholder, save the content and publish it automatically.

Which helped us to reduce half of the time we used to spent on the same activity.

 

Thanks for everyones help.

 

Regards

Samridhi Dubey

 

Hilmar Bunjes

unread,
Jan 23, 2015, 8:16:19 AM1/23/15
to reddot-c...@googlegroups.com
Hi Sami,
great to hear that it works for you.

Just for my interest, is there any reason to stick with project.SetTextContent(...) instead of using the object hierarchy and navigate to the text element to change it?

Thanks,
Hilmar

Sami Dubey

unread,
Jan 23, 2015, 9:06:38 AM1/23/15
to reddot-c...@googlegroups.com
Hi Hilmar
 
We did try getting the hierarchy for same. After navigating we were just getting the placeholder's GUID and its name, however unable to get the TextHTML/Content residing in the textplaceholder.
 
Hence the project's get and set method helped us to get the content and set as well. So we have used it. We were lacking to save the changed content which we achieved via RQL "Save" action.
 
Have a nice weekend :)
 
Thanks,
With Regards
Samridhi Dubey
Reply all
Reply to author
Forward
0 new messages