1 Reply Latest reply on Feb 24, 2012 9:25 AM by tomeicher

    HttpRouter Action from ESB

    sbutt

      Hi All,

               I have supplier to whom I am supposed to send some xml request. In my ESB service, I have created a request xml and then using "org.jboss.soa.esb.actions.routing.http.HttpRouter" action, I am sending request to my supplier/client.

       

      The supplier documentation says that each HTTP request has to specify the protocol version and method of data transfer.

       

      These are the standardised headers that are required.

       

      · accept: application/xml

      · connection: close

      · transfer-encoding: identity

      · content-length: <length of request body in bytes>

      · accept-encoding: gzip, deflate method for data compression; gzip will be preferred if listed

      · authorization base64 encoded authentication data (see section 4.2) in the form of 'Basic base64(username:password)'; for more information see

      RFC26172

       

      These are the headers defined by the Supplier:

       

      · api-version version of Supplier xml

      · accessmode defines the calculation model that will be used; possible values are 'conso', 'agency', 'intranet', 'callcenter', 'affiliate'

      · accessid combination of consolidator name and agent name; both consolidator and agent profile have to be existent; this is the second level of authentication and is used for client specific settings.

      · authmode mode of authentication; possible values are 'pwd' for authentication based on username and password (will be given by Supplier) or 'ip' for IP address based authentication

      · session session id

       

      This is an example for the complete header section of a request (with imaginary credentials):

       

      POST / HTTP/1.1\r

      accept: application/xml\r

      accept-encoding: gzip\r

      transfer-encoding: identity\r

      api-version: 3.2\r

      accessmode: conso\r

      accessid: conso_id agent_id\r

      authmode: pwd\r

      session: \r

      authorization: Basic dGVzdHVzZXI6bXlzZWNyZXQ=\r

      connection: close\r

      content-Length: \r\n\r\n

       

       

      ------------

       

      Now my question is, how can I formulate my action [code] <action name="HttpRouter" class="org.jboss.soa.esb.actions.routing.http.HttpRouter"> [/code] which should fulfill all the stated headers above?

       

      Secondly, in my first request to the Supplier, there won't be any "session" header set, but in the corresponding requests, i would be needing to pass in the request header the "session id", which i firstly need to extract from the previous respnse that i got from the supplier - so any hint in doing this?

       

      So far, I am doing the following:

       

       

       <action name="HttpRouter" class="org.jboss.soa.esb.actions.routing.http.HttpRouter">
                                                        <property name="endpointUrl" value="${middleware.supplier.endpointUrl}">
                                                                  <http-client-property name="file" value="/META-INF/supplier.http.properties"/>
                                                                  <http-client-property name="max-total-connections" value="${middleware.supplier.maxConnections}"/>
                                                        </property>
                                                        <property name="Content-Type" value="text/xml;charset=ISO-8859-1"/>
                                                        <property name="method" value="POST"/>
                                                        <property name="responseType" value="STRING"/>
                                              </action>
      
      
      

       

      And my properties file is:

       

       

      # Configurators
      configurators=HttpProtocol,com.traveltainment.integra.middleware.common.HttpConfigurator
      
      
      # HttpProtocol config...
      #timeout of creation connection
      http.connection.timeout=10000
      #timeout waiting of data
      http.socket.timeout=100000
      http.protocol.content-charset=ISO-8859-1
      http.connection-manager.max-per-host=5
      http.connection-manager.max-total=5
      # no keep alive
      #http.protocol.version=HTTP/1.0
      
      
      
      
      

       

      but it is incomplete, so any help in this direction would be great.

       

      Thanks.