1 Reply Latest reply on Jun 23, 2006 1:29 PM by 518638

    Creating reply in Custom adapter

    518638
      Hi there,<br>
      <br>
      I'm currently working on a custom Java adapter for Oracle interconnect and<br>
      having problems creating a correct reply message.<br>
      <br>
      I've made my own MessageReceiver implementation with a message received method like (simplified) :<br>
      <br>
      <br>
      public void messageReceived(MessageObject mo, AttributeObject outAO) throws MessageReceiverException {<br>
        XMLData myXmlData = mAgent.convertMessageObjectToXML(mo);<br>
      <br>
        // Handle the XML request and create an XML reply like :<br>
        String xmlReply = "&lt;test&gt;&lt;a&gt;B&lt;/a&gt;&lt;b&gt;A&lt;/b&gt;&lt;/test&gt;";<br>
      <br>
        MessageObject reply = mAgent.createMessageObject(xmlReply);<br>
        outAO.set("test", reply);<br>
      }<br>
      <br>
      <br><br>
      I've configured iStudio to let my adapter receive and reply messages like:<br>
      <br>
        &lt;test&gt;<br>
          &lt;a&gt;A&lt;/a&gt;<br>
          &lt;b&gt;B&lt;/b&gt; <br>
        &lt;/test&gt;<br>
      <br>
      Now when I send this message to my adapter the logging shows me it received the message like:<br>
      <br>
        test<br>
          a: A<br>
          b: B<br>
      <br>
      But when the messageReceiver tries to reply (like in my code above) it ends in an error.<br>
      The logging now also shows me that my receiver tries to reply:<br>
      <br>
      There was a problem transforming the message.<br>
      hummingbird.test:OAI_GLB/V1,OAI_GLB/V1,true,2<br>
        test<br>
          <b>test</b><br>
            a: B<br>
            b: A<br>
      <br>
      Can anyone tell me how I can generate the reply message in XML and put it in the outAO AttributeObject without it adding an extra test tag.<br>
      <br>
      Thanx,<br>
      Ibo
        • 1. Re: Creating reply in Custom adapter
          518638
          Ok, I've soleved my own problem..<br>
          <br>
          Apparently the following works:<br>
          <br>
          <br>
          <br>
          public void messageReceived(MessageObject mo, AttributeObject outAO) throws MessageReceiverException {<br>
            XMLData myXmlData = mAgent.convertMessageObjectToXML(mo);<br>
          <br>
            // Handle the XML request and create an XML reply like :<br>
            String xmlReply = "&lt;test&gt;&lt;a&gt;B&lt;/a&gt;&lt;b&gt;A&lt;/b&gt;&lt;/test&gt;";<br>

          <br>
            Object reply = mAgent.createMessageObject(xmlReply)<b>.get("test")</b>;<br>
            outAO.set("test", reply);<br>
          }<br>
          <br>
          <br>
          <br>
          Cheers,<br>
          Ibo<br>