title: Solace Request-Response issues while using across platforms ( C# and JAVA )
body: <p>I am attempting to implement Request-Response in Solace.</p>
  
  <p>However RR-Requestor is written in C# whereas the code for the RR-Responder is  written in JAVA.</p>
  
  <p>I’ve 2 issues:</p>
  
  <ol>
  <li><p>After the message is successfully sent by the Solace C# API, it is received by a JAVA application. I happen to receive the message in BytesXMLMessage structure. 
  How do I convert the message to String? message.dump() gives me the entire details.</p></li>
  <li><p>When I send a reply message, .NET application  receives the message with some additional unwanted characters. </p></li>
  </ol>
  
  <p>Code used in the JAVA side:</p>
  
  <pre><code>    //After session is created
      XMLMessageConsumer consumer = session.getMessageConsumer(new RequestHandler());
      XMLMessageProducer producer = session.getMessageProducer(new PrintingPubCallback());
      consumer.start();
      session.addSubscription(
              JCSMPFactory.onlyInstance().createTopic("Test_Response_Queue"),
              true);
      class RequestHandler implements XMLMessageListener {
  
      private void sendReply(BytesXMLMessage request, BytesXMLMessage reply)
              throws JCSMPException {
  
          producer.sendReply(request, reply);
  
      }
  
      public void onException(JCSMPException arg0) {
          // TODO Auto-generated method stub
  
      }
  
      public void onReceive(BytesXMLMessage message) {
          System.out.println("Received request message, trying to parse it");
  
          System.out.println(message.dump());
  
          try {
  
              TextMessage textMessage = JCSMPFactory.onlyInstance()
                      .createMessage(TextMessage.class);
  
              final String text = "Reply from JAVA, text message!!";
              textMessage.setText(text);
  
              sendReply(message, textMessage);
  
          } catch (JCSMPException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
      }
  </code></pre>
  
  <p>And in the .NET side</p>
  
  <pre><code>            // Create the request message
          IMessage requestMessage = ContextFactory.Instance.CreateMessage();
          requestMessage.Destination = ContextFactory.Instance.CreateTopic("Test_Response_Queue");
          requestMessage.DeliveryMode = MessageDeliveryMode.Direct; /* explicitly set to MessageDeliveryMode.Direct */
          //IStreamContainer stream = SDTUtils.CreateStream(requestMessage, 256);
          //stream.AddString("Hello from Linux!!");
          requestMessage.BinaryAttachment = Encoding.ASCII.GetBytes("Hello from Linux!!");
  
          // Send the request message to the service or RRDirectReplier
          IMessage replyMessage = null;
          int timeout = 2000; /* 2 secs*/
          Console.WriteLine("\nSending  request message, waiting for {0} msecs for a reply (make sure that RRDirectReply is running) ...", timeout);
  
          if (session.SendRequest(requestMessage, out replyMessage, 2000) == ReturnCode.SOLCLIENT_OK)
          {
              // Got a reply, format and print the response message
              Console.WriteLine("\nGot reply message");
              String str = Encoding.ASCII.GetString(replyMessage.BinaryAttachment);
              Console.WriteLine(str);
          }
          else
          {
              Console.WriteLine("Request failed");
          }
          if (requestMessage != null)
          {
              // It is a good practice to dispose of messages once done using them
              requestMessage.Dispose();
          }
  </code></pre>
  
  <p>Reply contains additional characters in the string received.
  See the image below.</p>
  
  <p><a href="https://i.stack.imgur.com/tg9Qk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tg9Qk.png" alt="enter image description here"></a></p>
  
  <p>Any idea?</p>
  
  <p>Thanks.</p>