Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Web service call and JMS

  1. #1
    Join Date
    Jan 2013
    Posts
    8

    Default Web service call and JMS

    Hi
    I'm having a bit of trouble setting up what should be a very routine web service call using SI.
    Please see the relevant excerpts of my config below.
    Code:
        <jms:inbound-gateway id="serviceSynchJmsIn"
                            connection-factory="connectionFactory"
                            request-destination="serviceRequestQueue"
                            request-channel="service-request-channel"
                            reply-timeout="30000"
                            concurrent-consumers="80" 
                            max-concurrent-consumers="100"/>
    
        <beans:bean id="testTransformerBean" class="*.TestTransformer" />
    
        <int:chain input-channel="service-request-channel" output-channel="service-response-channel">
    
            <!-- Custom transformer to create the required webservice request. -->
            <int:transformer ref="testTransformerBean" />
            
            <int-ws:header-enricher>
                <int-ws:soap-action value="http://**/ServiceRequest" />
            </int-ws:header-enricher>
    
            <int-ws:outbound-gateway uri="http://**/service" />
    
        </int:chain>
    I am receiving the message correctly (and for the purposes of getting everything wired, then disregarding it) and hardcoding in the webservice request into the transformer.

    Code:
    @Component
    public class TestTransformer {
    
       private static String test = "<tx:ServiceRequest xmlns:tx='*/messaging/schemas/ServiceRequest'>" +
    		   						"	<tx:Transaction>" +
    		   						"		<tx:Serial>14165195</tx:Serial>" +
    		   						"		<tx:Amount>100</tx:Amount>" +
    		   						"	</tx:Transaction>" +
    		   						"</tx:TaxServiceRequest>";
       
       @Transformer
       public String transform(final String message) {
    	   return test;
       }
       
    }
    The problem that I am on the server that hosts the WS that the entire body of the call is somehow being stripped out with the envelope being formatted correctly.
    Code:
    <soapenv:Envelope 
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >   
    <soapenv:Header/>
    <soapenv:Body>
    <tx:ServiceRequest xmlns:tx='*/messaging/schemas/ServiceRequest'>
    </tx:ServiceRequest> 
    </soapenv:Body>
    </soapenv:Envelope>
    I can send a message perfectly fine via SOAP_UI and have managed to use a messaging gateway to autowire a test, it is when I bring in JMS that I find myself in trouble.
    Have you any ideas,
    Thanks,
    Barry
    Last edited by bhiggins; Jan 28th, 2013 at 02:33 PM.

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,147

    Default

    Your XML is not well-formed, the opening tag is <tax:...> and the closing tag is </tx:...>.

    If you still get the problem after fixing that, I suggest you run with DEBUG logging and compare the message flow between your messaging gateway test case and the JMS case.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Jan 2013
    Posts
    8

    Default

    Thanks for getting back to me so quickly. The posting problems were down to me trying to make the code more readable (obviously I didn't succeed )
    I have updated the tags above and will post the logging when I get back to the office.

  4. #4
    Join Date
    Jan 2013
    Posts
    8

    Default

    Hi,
    I have attached the "working" (gateway.txt) and "not working" (ws-gateway.txt) logs and am still seeing the same issue.

    I have enabled tracing on the server and can see that request is coming in again as:

    Code:
    <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
     <env:Header/>
     <env:Body>
      <tx:TxServiceRequest xmlns:tx='http://*/messaging/schemas/TxServiceRequest'/>
     </env:Body>
    </env:Envelope>
    so I know that the SOAP specific tags are being added.

    Could you have a quick look and see if I'm missing something obvious.
    Cheers
    Attached Files Attached Files

  5. #5
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,147

    Default

    These look to be from quite different configurations - I see no SAAJ processing on the JMS version, for example:

    Code:
    2013-01-29 09:45:51,799 DEBUG [org.springframework.ws.soap.saaj.support.SaajUtils] (main) SOAPElement [com.sun.xml.messaging.saaj.soap.ver1_1.Envelope1_1Impl] implements SAAJ 1.3
    Can you provide the actual configuration for these two tests.

    Also, since the JMS test has multiple messages, can you include the thread (%t) in the log - makes it easier to follow.

    Thanks.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  6. #6
    Join Date
    Jan 2013
    Posts
    8

    Default

    Thanks for getting back to me again. Your help is really appreciated.

    I have attached the new logs with the additional info in two file (due to size constraints).

    With regard to the gateway test the config is as above except the jms:inbound-gateway is replaced with:

    Code:
         <int:gateway id="seiTaxService" service-interface="ie.aegon.servicebus.util.Test"
             default-request-channel="tax-service-request-channel"
             default-reply-channel="tax-service-response-channel" />
    The ways in which the two sets of code are called are very different. I am a little constrained and am deploying the jms/ws:gateway version of the code to jboss as we package our SI code in an a separate ear and calling it from my local machine by putting a serialized object on the queue.

    My other test was just to prove that I could call the WS via SI and is based on this example. All I have done is changed the pom to reflect our versions of SI and updated the URI to point at our WS.

    Thanks,
    Barry
    Attached Files Attached Files

  7. #7
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,147

    Default

    Sorry - I posted this on the wrong thread (after my post #5 above)...

    I am a little confused by your logs - the SaajUtils logs I referred to above (and full message trace in the 'sent' log) are only logged under TRACE...


    Code:
               if (logger.isTraceEnabled()) {
                   logger.trace("SOAPElement [" + soapElement.getClass().getName() + "] implements " +
                           getSaajVersionString(saajVersion));
               }
    and


    Code:
           if (sentMessageTracingLogger.isTraceEnabled()) {
               ByteArrayOutputStream os = new ByteArrayOutputStream();
               request.writeTo(os);
               sentMessageTracingLogger.trace("Sent request [" + os.toString("UTF-8") + "]");
           }
           else if (sentMessageTracingLogger.isDebugEnabled()) {
               sentMessageTracingLogger.debug("Sent request [" + request + "]");
           }
    But your "good" log shows them under DEBUG.

    Can you run the JMS case with TRACE level logging?

    Thanks
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  8. #8
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,147

    Default

    I am also a little confused as to why you are seeing double logging in the header mapper...

    Code:
     org.springframework.jms.listener.DefaultMessageListenerContainer#1-78[2013-Jan-29 14:50:02] DEBUG DefaultSoapHeaderMapper: headerName=[ws_soapAction] WILL be mapped, matched pattern=ws_soapAction   
     org.springframework.jms.listener.DefaultMessageListenerContainer#1-78[2013-Jan-29 14:50:02] DEBUG DefaultSoapHeaderMapper: headerName=[ws_soapAction] WILL be mapped, matched pattern=ws_soapAction
    Can you share your logging configuration for both environments?
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  9. #9
    Join Date
    Jan 2013
    Posts
    8

    Default

    That is very strange, I've run the tests again at TRACE level but and am not seeing any trace level logging at all.
    Again all of the messages you would expect to be at that level are appearing with the DEBUG prefix.

    JMS logging
    Code:
    	
    ....
    
            <appender name="SERVICEBUS"
    		class="org.jboss.logging.appender.DailyRollingFileAppender">
    		<param name="File" value="${jboss.server.log.dir}/ServiceBus.log" />
    		<param name="Append" value="true" />
    		<!-- Rollover at midnight each day -->
    		<param name="DatePattern" value="'.'yyyy-MM-dd" />
    		<layout class="org.apache.log4j.PatternLayout">
    			<param name="ConversionPattern" value="[%d{yyyy-MMM-dd HH:mm:ss}] %-5p %c{1}: %m %n %t" />
    		</layout>
    		<filter class="org.apache.log4j.varia.LevelRangeFilter">
    			<param name="LevelMin" value="DEBUG" />
    			<param name="LevelMax" value="FATAL" />
    		</filter>
    	</appender>
    
     ....
    
            <!-- ======================= -->
    	<!-- Setup the Service Bus categories -->
    	<!-- ======================= -->
    	<logger name="ie.aegon.servicebus">
    		<level value="TRACE" />
    		<appender-ref ref="SERVICEBUS" />
    	</logger>
    	<logger name="org.springframework.integration">
    		<level value="TRACE" />
    		<appender-ref ref="SERVICEBUS" />
    	</logger>
    	<logger name="org.springframework.integration.store">
    		<level value="TRACE" />
    		<appender-ref ref="SERVICEBUS" />
    	</logger>
        <logger name="org.springframework.ws">
            <level value="TRACE" />
    		<appender-ref ref="SERVICEBUS" />
        </logger>
        <logger name="org.springframework.integration.xmpp">
            <level value="TRACE" />
    		<appender-ref ref="SERVICEBUS" />
        </logger>
    	<logger name="org.springframework.integration.ws">
    		<level value="TRACE" />
    		<appender-ref ref="SERVICEBUS" />
    	</logger>
    	<logger name="org.springframework.integration.handler">
    		<level value="TRACE" />
    		<appender-ref ref="SERVICEBUS" />
    	</logger>
    	<logger name="org.springframework.integration.jms">
    		<level value="TRACE" />
    		<appender-ref ref="SERVICEBUS" />
    	</logger>
    Other Gateway logging

    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
    <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
    	<appender name="CA" class="org.apache.log4j.ConsoleAppender">
    		<layout class="org.apache.log4j.PatternLayout">
    			<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
    		</layout>
    	</appender>
    	<appender name="FA" class="org.apache.log4j.FileAppender">
    		<param name="File" value="sample.log"/>
    		<param name="Threshold" value="TRACE"/>
    		<layout class="org.apache.log4j.PatternLayout">
    			<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
    		</layout>
    	</appender>
    	
    	
    	<!-- Loggers -->
    	
    	<logger name="org.springframework">
    		<level value="warn" />
    	</logger>
    
        <logger name="org.springframework.ws">
            <level value="TRACE" />
        </logger>
    
    	<logger name="org.springframework.integration">
    		<level value="TRACE" />
    	</logger>
    
        <logger name="org.springframework.integration.xmpp">
            <level value="TRACE" />
        </logger>
    
    	<logger name="org.springframework.integration.ws">
    		<level value="TRACE" />
    	</logger>
    
    	<logger name="org.springframework.integration.handler">
    		<level value="TRACE" />
    	</logger>
    
    	<logger name="org.springframework.integration.jms">
    		<level value="TRACE" />
    	</logger>
    	
    	<root>
    		<level value="TRACE" />
    		<appender-ref ref="CA" />
    		<appender-ref ref="FA" />
    	</root>
    </log4j:configuration>

  10. #10
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,147

    Default

    I don't know what's going on with your logging, but with JMS, you should see messages like this under TRACE...

    Code:
    08:03:59.876 DEBUG [task-scheduler-3][org.springframework.integration.endpoint.SourcePollingChannelAdapter] Received no Message during the poll, returning 'false'
    08:04:00.032 TRACE [org.springframework.jms.listener.DefaultMessageListenerContainer#0-1][org.springframework.jms.listener.DefaultMessageListenerContainer] Consumer [Cached JMS MessageConsumer: ActiveMQMessageConsumer { value=ID:Celeborn.local-49715-1359551032584-3:1:1:1, started=true }] of session [Cached JMS Session: ActiveMQSession {id=ID:Celeborn.local-49715-1359551032584-3:1:1,started=true}] did not receive a message
    If you are not, something must be hijacking your logging; as I mentioned, it is also weird that you are seeing "double" log entries for the header mapper.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Posting Permissions

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