0 Replies Latest reply on Nov 13, 2006 2:47 PM by NUMB-LOCK

    Sending a ByteArray of rich text to a Java Web Service via WebService component


      I was able to send and receive rich text (HTML formatted txt) intact
      via a Java web service using Weblogic 9.2. Creating a web service in
      Weblogic 8.1 is more difficult so I opted for this route. Regardless
      what back end implementation you are using, in order to keep rich text
      intact is to send it via a ByteArray in flex. And with the web service
      (possibly using Coldfusion), be sure that the input parameter and
      return types that the WSDL creates are "base64Binary."

      Creating a web service in Weblogic 9.2 is pretty easy. If you are
      using this app server then the 9.2 docs on Web Services is how I
      created my back end. My web service simply accepts a byte[] as a
      parameter and returns it.

      public class HelloWorldImpl {

      public byte[] getBytes(byte[] bAry) {
      return bAry;

      In flex:

      private var bAryObj:ByteArray = new ByteArray();
      private var txtResult:String;

      public function sendingBytes(event:Event) {

      // inputTxt is a HTML formatted string a.k.a rich text

      // call webService

      public function webSvcHandler(event:ResultEvent) {

      var b:ByteArray = new ByteArray();
      b.position = 0; // make sure you read the array from the beginning

      // use binding of txtResult in some component as {txtResult}
      txtResult = b.readUTF() as String;

      mxml - be sure mxml parameter names match exactly the web service
      parameter names:

      <mx:WebService id="wsData"

      <mx:operation name="getBytes">
      <mx:request xmlns="">

      I used a Button component to call sendingBytes() via the click event.

      Hope I didn't forget anything...and hope this helps.

      Bob I.