cancel
Showing results for 
Search instead for 
Did you mean: 

How to get plain text content

ribz33
Champ on-the-rise
Champ on-the-rise
hi,

I want to get plain/text content via Web Services.
But i dont know how to do !
Im able to get URL to content but i need to get content to display it in my application.
Is there a method which return a string with content of a node ?

Thx in advance
1 REPLY 1

fchevance
Champ in-the-making
Champ in-the-making
Hello,

yes, there must be some code in the web services samples.

This should work:


String strContent = null;

ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
Reference reference = node.getReference();

Content[] readResult = contentService.read( new Predicate(new Reference[]{reference}, STORE, null), Constants.PROP_CONTENT);

Content content = readResult[0];
try {
   strContent = ContentUtils.getContentAsString(content);
} catch (WebServiceException we) {
   // Document has no content
}

Fred