Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8871423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:59:28+00:00 2026-06-14T17:59:28+00:00

Can anyone give me an example how to create new IBM Connections Activity using

  • 0

Can anyone give me an example how to create new IBM Connections Activity using xPages Social Enabler? I cant find any usefull info in documentation so I have adapted an example from Niklas Heidloff on how to create a new bookmark in Connections. I have the following code for creating a new activity:

try { 
   var svc = new sbt.ConnectionsService("/activities/service/atom2/activities"); 

   var sb = new java.lang.StringBuilder(); 
   sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); 
   sb.append("<entry xmlns:snx=\"http://www.ibm.com/xmlns/prod/sn\" xmlns:opensearch=\"http://a9.com/-/spec/opensearch/1.1/\" xmlns:thr=\"http://purl.org/syndication/thread/1.0\" xmlns=\"http://www.w3.org/2005/Atom\">"); 
   sb.append("<title type=\"text\">"); 
   sb.append("test activity from xpages"); 
   sb.append("</title>"); 
   sb.append("<content type=\"html\">"); 
   sb.append("</content>"); 
   sb.append("</entry>");                 

   var msg = svc.post(null, sb.toString(), "xml"); 
} catch(e) { 
    print(e) 
} 

But code above do not create anything but raises error on Domino console. This is returned by svc.post() command:

[31726:00075-3041917840] 11/19/2012 01:03:59 PM  HTTP JVM: Client service request to: http://vhost1279.site1.compute.ihost.com:81/activities/service/atom2/activities did not return OK status. Status returned: 415, reason: Unsupported Media Type, expected:information, please consult error-l 

[31726:00075-3041917840] 11/19/2012 01:03:59 PM  HTTP JVM: g-0.xml located in /local/opt/ibm/lotus/notesdata/domino/workspace/logs 

[31726:00075-3041917840] 11/19/2012 01:03:59 PM  HTTP JVM: com.ibm.xsp.extlib.sbt.services.client.ClientServicesException: HTTP Status 415, Unsupported Media Type. HTTP error response code received in response to request to url: http://vhost1279.site1.comties/service/atom2/activities 

Can anyone give me a hint how to use it properly or point me to some usefull documentation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:59:29+00:00Added an answer on June 14, 2026 at 5:59 pm

    SOLVED!!! I looked to source and problem was obvious. This is rather a bug or at least misconception but can be easily resolved . According the docs and my testing proves this Connections requires the following header in request: Content-Type = application/atom+xml …. but in source code of Social Enabler I found these two related methods:

    protected void prepareRequest(HttpClient httpClient, HttpRequestBase httpRequestBase, Options options) throws ClientServicesException {
    // TODO: add support for gzip content
    //httpClient.addRequestHeader(“Accept-Encoding”, “gzip”);

            if(options.getHeaders()!=null) {
                addHeaders(httpClient, httpRequestBase, options);
            }
            if (options.content != null) {
                String contentType = null;
                HttpEntity entity = null;
                Object content = options.content;
                try {
                    //If a subclass overrides com.ibm.xsp.extlib.services.client.Service.processRequestContent(HttpRequestBase, Object, Options)
                    //the the subclass must set the content type of the request, and also set the request's entity!
                    if(processRequestContent(httpClient, httpRequestBase, options)){
                        if (content instanceof IValue) {
                            JsonFactory jsFactory = new JsonJavaScriptFactory(DesignerRuntime.getJSContext());
                            entity = new StringEntity(JsonGenerator.toJson(jsFactory, content, true));
                            contentType = "application/json";
                        }
                        else if (content instanceof JsonObject) {
                            JsonFactory jsFactory = JsonJavaFactory.instanceEx;
                            entity = new StringEntity(JsonGenerator.toJson(jsFactory, content, true));
                            contentType = "application/json";
                        }
                        else if (content instanceof Node) {
                            entity = new StringEntity(DOMUtil.getXMLString((Node) content, true));
                            contentType = "application/xml";
                        }
                        else {
                            entity = new StringEntity(content.toString());
                            contentType = findRequestTextContentType(options);
                        }
                    }
                } catch (Exception ex) {
                    if(ex instanceof ClientServicesException) {
                        throw (ClientServicesException)ex;
                    }
                    throw new ClientServicesException(ex, "Error while parsing request content");
                }
                if (entity != null && (httpRequestBase instanceof HttpEntityEnclosingRequestBase)) {
                    httpRequestBase.setHeader("Content-type", contentType);
                    ((HttpEntityEnclosingRequestBase) httpRequestBase).setEntity(entity);
                }
            }
        }
    
    protected String findRequestTextContentType(Options options) {
            return "text/plain";
        }
    

    As you can see there is no such header (application/atom+xml) for any case. But if you provide XML content as string, the code uses the ‘findRequestTextContentType’ method to return a default content type, which is ‘text/plain’ that is not correct for our situation. It is hardcoded so there is no way how to setup the default encoding. But, at least, the ‘findRequestTextContentType’ is type protected so it can be overriden. So I have created my own ConnectionsService class that extends the former one and overrides the findRequestTextContentType method to return correct content type for my case. And this works fine and resolved the problem !!

    import sbt.ConnectionsService;
    
    public class ConnectionsServiceCustom extends ConnectionsService {
    
        public ConnectionsServiceTcl(String serviceUrl) {
            super(serviceUrl);
            // TODO Auto-generated constructor stub
        }
    
         @Override
         protected String findRequestTextContentType(Options options) {
                return "application/atom+xml";
            }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone give me an example of these attributes in action: stroke-dasharray, stroke-linecap, stroke-linejoin
Can anyone give me an example of how I can consume the following web
Does anyone use hashCode() anywhere? Can anyone give me an example of the exact
Can anyone tell or define more what is ancestor and give an example on
I'm new here. Can anyone help me for how create a form like this
Can anyone give me an example or point me to a resource on how
Can anyone give tell me how to search for a particular word in a
Can anyone give me any pointers. I have a text file that contains dates
Can anyone give me a cross-browser supported solution for this problem?
Can anyone give me a hand with a touch of regex? I'm reading in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.