title: how to construct ISO8583 message header for ascii channel and iso93ascii packager in jpos?
body: <p>I am trying to create an ISO8583 message using JPOS in java using the ASCII channel to send the message and iso93ascii packager to pack the ISO message.</p>
  
  <p>But after sending the message I am getting invalid header error from the server.</p>
  
  <p>So my question is what is the header made up of exactly and how do I frame my header for MTI value 1200.</p>
  
  <pre><code>ISOMsg.setHeader("HEADER".getBytes());
  </code></pre>
  
  <p>How should I frame up my HEADER?</p>
  
  <p>New Development :</p>
  
  <p>After taking a look at the server configuration I need to send the header prepended by the length of the ISO8583 message(2 byte length in hex converted to bytes). How can I do this using JPOS? Also am not able to set anything using <code>channel.setHeader("xxx").getBytes())</code>.</p>
  
  <p>How do I see what raw message is being sent from my terminal to the server.</p>
  
  <p>Here are some of the excerpts from the code</p>
  
  <p>Deploy files</p>
  
  <pre><code>filename : 10_clientsimualtor_channel.xml
  
  &lt;?xml version="1.0" ?&gt;
  &lt;channel-adaptor name='jpos-client-adaptor'
      class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2"&gt;
  &lt;channel class="org.jpos.iso.channel.ASCIIChannel" logger="Q2"
            packager="org.jpos.iso.packager.ISO93APackager" header= "ISO026000075"&gt;
  
    &lt;property name="host" value="xxx.xx.xx.xx" /&gt;
    &lt;property name="port" value="xxxxx" /&gt;
  &lt;/channel&gt;
  &lt;in&gt;jpos-client-send&lt;/in&gt;
  &lt;out&gt;jpos-client-receive&lt;/out&gt;
  &lt;reconnect-delay&gt;10000&lt;/reconnect-delay&gt;
  &lt;/channel-adaptor&gt;
  </code></pre>
  
  <p>Code : </p>
  
  <pre><code>packager = new ISO93APackager();
  
              ISOMsg m = new ISOMsg();
              m.setPackager(packager);
              System.out.println(packager);
  
              m.setHeader("ISO026000075".getBytes());
               System.out.println("Head err..........."+newString(m.getHeader()));
  
              Date now = new Date();
  
              m.setMTI("1200");
              m.set(2,"xx");
              m.set(3,"xxxxx");
              m.set(4,"000000010000");
              m.set(11,"214491");
              m.set(12,"160203");
  
              m.set(123, "xxxxxx");
              m.set(125, "xxxx");
  
             byte b[] = m.pack();
             System.out.println("\n\n\n\nPACKAGER =====------"+m.getPackager());
             System.out.printf("\n\n\n\nMessage ===== %s",new String(b));
  
              System.out.println("\n\n\n"+ISOUtil.hexdump(b));return m;
  </code></pre>