IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only
  • 1.  socket adapter

    Posted 02/19/07 10:11 AM

    Originally posted by: SystemAdmin


    I need to send data thru the socket adapter to a java server. The java server is looking for the first 2 bytes to be created by a writeshort function followed by the stream of data. My questions is how do you create the first two bytes using a type tree or a map function that will produce the same results as a java writeshort function or the writeutf function if sending xml data.

    For example if I send a string of 16 characters, the first 2 bytes of the data sent over the socket should be hex is "00 16" then the string on 16 chars.

    Any help or ideas would be appreciated.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 2.  Re: socket adapter

    Posted 02/19/07 02:00 PM

    Originally posted by: Margo


    I wish I could remove my signature in case this is a truely stupid answer, but -- perhaps create a two byte field in front of your 16 byte header and map =SYMBOL<00> + SYMBOL<16>

    ... ...
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 3.  Re: socket adapter

    Posted 02/19/07 03:51 PM
      |   view attached

    Originally posted by: Margo


    Definitely should have removed my signature -- if you are trying to send the size of the string, you can follow this example --

    Output card 1: build string
    Output card 2: in an args1 field pull in the results of card 1 and SIZE it (=SIZE(card 1)
    Output card 2: in an args2 field build your two byte header (=SYMBOL(00) + PACKAGE(args1)
    Output card 2: in an args3 field build your output to queue (=PUT (queue arguments) args2 + card 1

    I attached a doc w/ screenprints and the output, you can modify if you need any kind of delimiters, etc. ...
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender

    Attachment(s)



  • 4.  Re: socket adapter

    Posted 02/19/07 09:29 PM

    Originally posted by: SystemAdmin


    I will follow up with what may be a very stupid question of my own. How is decimal 16, 00 16 in Hex? Shouldn't it be 0F? Since you only have two bytes then can you only represent FF characters in the string/stream to come? If so make sure you make the tree not allow more than 255 characters in that field and/or truncate it (with maybe the LEFT() function) before you try to place it in that field.

    If what I am saying makes any sense then you need to find the length of the string you are sending and convert it to hex. You can do the conversion with the FROMBASETEN() function and the length with the SIZE() function.

    Not sure if this helps because I'm not sure what the two Java functions you mentioned are used for in the real world. The Sun Java API docs do not describe them much.

    Yvonne
    Resistance is NOT futile.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 5.  Re: socket adapter

    Posted 02/21/07 11:06 AM

    Originally posted by: SystemAdmin


    > I need to send data thru the socket adapter to a java
    > server. The java server is looking for the first 2
    > bytes to be created by a writeshort function followed
    > by the stream of data. My questions is how do you
    > create the first two bytes using a type tree or a map
    > function that will produce the same results as a java
    > writeshort function or the writeutf function if
    > sending xml data.
    >
    > For example if I send a string of 16 characters, the
    > first 2 bytes of the data sent over the socket should
    > be hex is "00 16" then the string on 16 chars.
    >
    > Any help or ideas would be appreciated.

    The issue I discovered was that the Java server is expecting the low level protocol to be sent. For example two byte length, not the 4 byte length the socket adapter sends. Next to send xml data, protocol needs to send two bytes for length and the two additional bytes in utf-8 format for length followed by the string. Hence the java writeutf function.

    Anyone have any further ideas how to overcome this issue?

    Thanks

    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange