getEnvelopeStream throwing exception in wm6.1


I’m trying to create a encrypted mime data using the below set of services,

I tried creating a Mime Data object, converted the html text string to bytes and then a stream, invoked the addBodyPart, invoke getEnvelopeStream.

But the below exception is being thrown when executing getEnvelopeStream, “text/plain” DataContentHandler requires String object, was given object of type class"

These same set of services are working fine when executed on a different wm server (6.1). Is this a bug onmy server. How can i fix it??
Please drop in ur ideas.