Interoperability between writeString and readUTF? - Websphere

This is a discussion on Interoperability between writeString and readUTF? - Websphere ; We are having a problem with MQ 5.3 on Solaris where writeString will cause a readUTF to throw an EOF exception. As far as we can see the UFT calls insert / expect a 2-byte length prefix. Application involves an ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Interoperability between writeString and readUTF?

  1. Interoperability between writeString and readUTF?

    We are having a problem with MQ 5.3 on Solaris where writeString will cause
    a readUTF to throw an EOF exception. As far as we can see the UFT calls
    insert / expect a 2-byte length prefix. Application involves an unbounded
    set of applications written by seperate parties.

    Are there any structured ways to avoid this incompatibility? I hope we are
    just missing a MQ setting as adopting a uniform standard across the entire
    application network would be a significant problem.

    Thanks,

    Dave




  2. Re: Interoperability between writeString and readUTF?

    IBM wrote:
    > We are having a problem with MQ 5.3 on Solaris where writeString will cause
    > a readUTF to throw an EOF exception. As far as we can see the UFT calls
    > insert / expect a 2-byte length prefix. Application involves an unbounded
    > set of applications written by seperate parties.
    >
    > Are there any structured ways to avoid this incompatibility? I hope we are
    > just missing a MQ setting as adopting a uniform standard across the entire
    > application network would be a significant problem.


    I'm assuming you're using the JMS API, but I'm unsure as to what message
    type you're using here.

    readUTF() is a method found on the javax.jms.BytesMessage interface, but
    writeString() is a method found on the javax.jms.StreamMessage
    interface. Are you somehow writing a stream message, but then receiving
    it as a bytes message?

    Do you have any more information on what's happening here?

    Ian.

    --
    ian.burnett@uk.ibm.com :: IBM, Hursley, UK

  3. Re: Interoperability between writeString and readUTF?

    Good Evenin' Ian,

    We are essentially establishing a Service Architecture where the internals
    are developed in Java. Our goal was to have a single consumer and a set of
    conformant payloads - XML schemas. The message flow would originate from an
    essentially unbounded set of applications and technologies.

    As we started our integration testing with the current application set, we
    discovered the incompatibility described here. We can obviously solve any
    point-wise integration but the challenge is to various solutions are
    incompatible making it difficult to relaive the goal of having a single
    consumer. The problem space is further complicated as several fo the
    producers are commercial packages and wouldn't necessarilly be able to adopt
    a particular interface standard.

    Appreciate any thoughts you (or others) have on ths topic.

    Thanks,

    Dave

    "Ian Burnett" wrote in message
    news:dt2afc$1c02q$1@news.boulder.ibm.com...
    > IBM wrote:
    >> We are having a problem with MQ 5.3 on Solaris where writeString will
    >> cause
    >> a readUTF to throw an EOF exception. As far as we can see the UFT calls
    >> insert / expect a 2-byte length prefix. Application involves an unbounded
    >> set of applications written by seperate parties.
    >>
    >> Are there any structured ways to avoid this incompatibility? I hope we
    >> are
    >> just missing a MQ setting as adopting a uniform standard across the
    >> entire
    >> application network would be a significant problem.

    >
    > I'm assuming you're using the JMS API, but I'm unsure as to what message
    > type you're using here.
    >
    > readUTF() is a method found on the javax.jms.BytesMessage interface, but
    > writeString() is a method found on the javax.jms.StreamMessage interface.
    > Are you somehow writing a stream message, but then receiving it as a bytes
    > message?
    >
    > Do you have any more information on what's happening here?
    >
    > Ian.
    >
    > --
    > ian.burnett@uk.ibm.com :: IBM, Hursley, UK




  4. Re: Interoperability between writeString and readUTF?

    Dave wrote:
    > Appreciate any thoughts you (or others) have on ths topic.


    This is the kind of problem that WebSphere ESB:

    http://www.ibm.com/software/integration/wsesb/

    and WebSphere Message Broker:

    http://www-306.ibm.com/software/inte...messagebroker/

    were created to solve.

    You may find it's cheaper and easier to use one of those than to try and build
    such a system yourself.

    Cheers,

    Phil
    --
    XMS Client Development

  5. Re: Interoperability between writeString and readUTF?

    Dave wrote:
    > Good Evenin' Ian,
    >
    > We are essentially establishing a Service Architecture where the internals
    > are developed in Java. Our goal was to have a single consumer and a set of
    > conformant payloads - XML schemas. The message flow would originate from an
    > essentially unbounded set of applications and technologies.
    >
    > As we started our integration testing with the current application set, we
    > discovered the incompatibility described here. We can obviously solve any
    > point-wise integration but the challenge is to various solutions are
    > incompatible making it difficult to relaive the goal of having a single
    > consumer. The problem space is further complicated as several fo the
    > producers are commercial packages and wouldn't necessarilly be able to adopt
    > a particular interface standard.
    >
    > Appreciate any thoughts you (or others) have on ths topic.
    >


    As there's been very few responses about this, then I'll give it a go.

    You're correct in your summation that the UTF read/write functions use a
    two-byte integer to indicate the length of the string (an unsigned
    short). This is not present in the more simplistic read/write string
    functions. That, though, is not guaranteed by JMS and is
    transport-specific. A stream message lets you send a *sequence* of data
    items. How they're represented on the wire is up to the transport.

    This leads on to the main problem I'm having understanding what's
    happening. You appear to be writing to a StreamMessage object on the
    sending side, but reading from a BytesMessage object on the receiving
    side. That shouldn't happen if you're using JMS throughout. IBM uses a
    system called RFH2 to encode a message originated by a JMS application.
    This, amongst other things, contains a "type" marker to indicate whether
    this is a BytesMessage, StreamMessage, TextMessage, etc.

    If a message is received in JMS from MQ that does not have this RFH2
    encoding, then it is interpreted as being a BytesMessage, where you are
    assumed to know the format of the message up-front. I can only assume
    this what is happening in your case.

    So how to fix this? At present, I'm not sure - once a message has been
    put onto the MQ system, the contents won't be modified (unless of course
    you use one of the Message Broker products Phil pointed out earlier).
    Check that what you're receiving is definitely a BytesMessage. and not a
    StreamMessage that you've casted to be something different.

    Any sample send & receive code available?

    Ian.

    --
    ian.burnett@uk.ibm.com :: IBM, Hursley, UK

+ Reply to Thread