Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: MessageConverter

  1. #11
    Join Date
    Sep 2008
    Location
    Mannheim,Germany
    Posts
    125

    Default

    Ah yes this is what Im looking for.Previously I had <ws-handler> in my code which made it much easier.Now i will try ur code.Thank u.

  2. #12
    Join Date
    Sep 2008
    Location
    Mannheim,Germany
    Posts
    125

    Red face

    Hey Mark, I tried ur code but Im getting the same JMSException as mentioned in the beginning of this post which is: I can c the message being deleivered to the queue but when I open to c the message it gives me this JMS exception.Please help.Im really getting frustrated at this exception(please c for the exception at beginning of this post)
    Code:
    <channel id="sendChannel"/>
      <ws:outbound-gateway id="WebServiceGateway"
    				         request-channel="sendChannel" 
    				         reply-channel="WebServiceReceiveChannel"
    				         uri="http://localhost:8080/Trial1/companyservice"/>
    <publish-subscribe-channel id="WebServiceReceiveChannel"/>
    	
    <jms:outbound-gateway  id="jmsGateway" request-channel="WebServiceReceiveChannel" connection-factory="connectionFactory" jms-queue="HelloQueue"/>
        
    <beans:bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
      <beans:property name="brokerURL" value="tcp://localhost:61616" />
    </beans:bean>
    	
    <beans:bean id="HelloQueue" class="org.apache.activemq.command.ActiveMQQueue">
    <beans:constructor-arg value="HelloQueueWorlds" index="0"/>
    </beans:bean>
    Last edited by ashleyvijay; Nov 5th, 2008 at 12:26 PM.

  3. #13
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Did you read Jonas reply above regarding that JMSException? It looks like a serialization issue and it's at the JMS level. I don't think it's related to Spring Integration - probably you need to make sure you have the right classes on both sides of the JMS communication.

  4. #14
    Join Date
    Sep 2008
    Location
    Mannheim,Germany
    Posts
    125

    Unhappy

    Quote Originally Posted by JonasPartner View Post
    Looking at the ActiveMQ code I would say/guess that you are reading this message, which contains the GenericMessage as a payload in a vm without the SI GenericMessage class on the classpath since it is failing to create the GenericMessage from the serialized representation in the payload of the JMS message.
    Well I have the SI GenericMessage class: org.springframework.integration.message.GenericMes sage on the classpath but still what is the problem?? Please help.Im really going crazy with this Exception. If its still a serialization/deserialization please tell me how to solve it please...

  5. #15
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Given the other problem that you were having (http://forum.springframework.org/showthread.php?t=63106), I would highly recommend verifying that you have only one version on the classpath and that it is the same version on both sides of the JMS communication.

    This problem looks like something in your configuration/setup and is very likely not a Spring Integration issue. Based on the stack trace, everything is as-expected until the serialization. So, there's not really any assistance we can provide. You need to verify your setup.

  6. #16
    Join Date
    Oct 2007
    Location
    Toronto, ON
    Posts
    90

    Default

    Hey,

    For once, you should decide what you want to get propagated on the other side (i.e. to the consumer that's listening to your JMS Queue): SI's GenericMessages or payloads only. If the former is true, then include SI's jar on the end that receives the messages (otherwise you won't be able to deserialize them, of course).

    However, if you're expecting to receive from the JMS queue only the payload inject a HeaderMappingMessageConverter that sets extractPayload to true. See the javadoc of said MessageConverter.

    Hopefully this makes things clearer,
    Marius
    Last edited by mbogoevici; Nov 6th, 2008 at 06:16 PM. Reason: formatting, again
    Marius Bogoevici,
    Spring Integration Committer

  7. #17
    Join Date
    Sep 2008
    Location
    Mannheim,Germany
    Posts
    125

    Question What is really missing??

    Thank u so much Marius. I can understand what u r trying to say but Im not able to figure out what my code is doing right now cos I just copied from the samples to try.Dont know whether the below code is trying to sending Generic Messges or Payloads to the consumer/JMS Queue.I have included all the necessary SI RC1 jars alone in the classpath and more M6 version Please help me to figure out what am I missing in the code below:
    SI.java
    Code:
    package rc1;
    import java.util.Properties;
    import org.springframework.context.support.ClassPathXmlApplicationContext;
    import org.springframework.integration.core.MessagingException;
    import org.springframework.integration.message.MessageBuilder;
    import org.springframework.integration.ws.AbstractWebServiceOutboundGateway;
    public class SI {
    	public static void main(String[] args)throws MessagingException {
    	ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("si.xml",SI.class);
    
    // Compose the XML message according to the server's schema
    String requestXml =
    "<hr:CompanyRequest xmlns:hr=\"http://mycompany.com/hr/schemas\">" +
    			"<hr:Company>"+
    	        "<hr:CompanyName>TestRequest</hr:CompanyName>"+
                "</hr:Company>"+
                "</hr:CompanyRequest>";
    I have no clue whts being done after this:sending generic msg or payload to JMSQueue
    // Create the Message object
    // In this case the service expects a SoapAction header
    		org.springframework.integration.core.Message<String> message = MessageBuilder.withPayload(requestXml)
    				.setHeader(AbstractWebServiceOutboundGateway.SOAP_ACTION_PROPERTY_KEY, "http://mycompany.com/hr/schemas")
    				.build();[/COLOR]
    
    		
    // Send the Message to the handler's input channel
    		((org.springframework.integration.core.MessageChannel) context.getBean("sendChannel")).send(message);
    	}
    }
    SI.XML
    Code:
    <message-bus/>
    <channel id="sendChannel"/>
    <ws:outbound-gateway id="gateway" request-channel="sendChannel" 
    reply-channel="receiveChannel"
    uri="http://localhost:8080/Trial1/companyservice"/>
    <jms:outbound-gateway request-channel="receiveChannel" connection-factory="connectionFactory"  jms-queue="HelloQueue"/>
        
    <beans:bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    		<beans:property name="brokerURL" value="tcp://localhost:61616"/>		
    </beans:bean>
    		
    <beans:bean id="HelloQueue" class="org.apache.activemq.command.ActiveMQQueue">
    <beans:constructor-arg value="RC1" />
    </beans:bean>
    Last edited by ashleyvijay; Nov 7th, 2008 at 04:57 AM.

  8. #18
    Join Date
    Oct 2007
    Location
    Toronto, ON
    Posts
    90

    Default

    Well, that's easy.

    1) You're not sending anything to the JMS Queue, you're sending stuff to the web service, and the response from that is sent to the JMS Queue.

    2) Because you're using the defaults, what gets serialized is a GenericMessage. Whether you want that to happen or not, I can't say, it's your application design .

    3) Because wherever you're trying to read from the queue you don't have the SI jar, you can't deserialize the message.

    4) If you don't want to send a GenericMessage to JMS, but only the payload, do the extractPayload trick as mentioned on this thread (by me).

    I think you should be in a good shape now to finish what you're trying to achieve.
    Marius Bogoevici,
    Spring Integration Committer

  9. #19
    Join Date
    Sep 2008
    Location
    Mannheim,Germany
    Posts
    125

    Default

    Ah ok.Thank u so much! Finally u understood my problem.Thanks alot.I solved it!
    Last edited by ashleyvijay; Nov 7th, 2008 at 08:57 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •