Sunday, 15 March 2015

xpages - Post status update to IBM Connections using extlib -



xpages - Post status update to IBM Connections using extlib -

i trying post update i.e. status message ibm connections using extlib.

i have used extlib connectionsltpa endpoint works getting communities list. wish add together functionality update users status.

so far have tried using

<xp:this.data> <xe:connectionsdata var="connectionsdata1" endpoint="connections" serviceurl="/profiles/atom/mv/theboard/entry/status.do?email=#{userbean.email}"> </xe:connectionsdata> </xp:this.data>

and in event handler

var sb = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<author><name>#{userbean.displayname}</name></author>" + "<entry xmlns=\"http://www.w3.org/2005/atom\">" + "<content type=\"html\">" +input + "</content>" + "<category scheme=\"http://www.ibm.com/xmlns/prod/sn/type\" term=\"status\" />"+ "</entry>\r\n"; var output = #{connectionsdata1}.post(null, sb, "xml");

however throws error trying phone call post on binded info point.

anybody able point me in right direction?

thanks

i have found implementing sbt doing follwing:

<xp:button id="button2"> <xp:this.value>update status</xp:this.value> <xp:eventhandler event="onclick" submit="true" refreshmode="partial"> <xp:this.action><![cdata[#{javascript:try { var svc = new sbt.connectionsservice("/profiles/atom/mv/theboard/entry/status.do?email=" +userbean.email); var sb = new java.lang.stringbuilder(); sb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); sb.append("<entry xmlns=\"http://www.w3.org/2005/atom\">"); sb.append("<category scheme=\"http://www.ibm.com/xmlns/prod/sn/type\" term=\"entry\"/>"); sb.append("<category scheme=\"http://www.ibm.com/xmlns/prod/sn/message-type\" term=\"status\"></category>"); sb.append("<content type=\"text\">"); sb.append(getcomponent("inputtext1").getvalue()); sb.append("</content>"); sb.append("</entry>"); var msg = svc.put(null, sb.tostring(),"xml"); var msg = "updated users profile status"; @warningmessage(msg) } catch(e) {} }]]></xp:this.action> </xp:eventhandler> </xp:button>

the reason wasn't working correctly atom feed needed declared entry. article in connections doc 2.5 http://publib.boulder.ibm.com/infocenter/ltscnnct/v2r0/index.jsp?topic=/com.ibm.connections.25.help/r_api_prof_update_photo.html explains required parts of xml atom document.

xpages xpages-extlib ibm-connections

No comments:

Post a Comment