8 Replies Latest reply on Jul 7, 2009 7:25 AM by sbutt

    ESB HttpRouter for Https Web Service

    sbutt

      Hi Folks,
      I'm trying to use "org.jboss.soa.esb.actions.routing.http.HttpRouter" class in ESB for calling a web service from my adapter, but couldn't succeed.

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


      One important thing to note here is that the remote Webservice's endpoint url is Https, so probably i need to do something special to call such hosts?

      Any help in the form of some snippet would be appreciated.

      Thanks.

        • 1. Re: ESB HttpRouter for Https Web Service
          scottdawson

          Look at the https_2way_ssl quickstart for an example of invoking a web service over HTTPS using the HttpRouter. A couple of things to note -- the method value should probably be POST since that indicates the HTTP method to use (GET and POST are currently supported) and HTTP headers such as Content-Type are specified by a header element inside a "headers" property element. All this is illustrated in the jboss-esb-template.xml in the quickstart.

          Regards,
          Scott

          • 2. Re: ESB HttpRouter for Https Web Service
            scottdawson

            Also, the property specifying the endpoint should have a name value of "endpointUrl", not "urlEndpoint".

            • 3. Re: ESB HttpRouter for Https Web Service
              sbutt

              Thanks Scott,
              I have tried to get some help from that example but still couldn't succeed.

              I'm defining the service like this:

              
              ...
              
              <service category="KuoniService" name="SoapRouter" description="Kuoni Adapter Message Router">
               <listeners>
               <jms-listener name="JMS-Gateway" busidref="KuoniServiceRouter" maxThreads="20"/>
               </listeners>
               <actions mep="OneWay">
               <action name="trace1" class="com.traveltainment.integra.middleware.message_tracing.MessageTracingService">
               <property name="trace-text" value="Kuoni Adapter Message Router"/>
               </action>
               <action name="Transform3" class="com.traveltainment.integra.middleware.transformer.Transformator">
               <property name="service-template-pool-name" value="KuoniService"/>
               <property name="xsl-resources" value="/META-INF/xsl/kuoni/RQ2SOAP.xsl"/>
               <property name="template" value="/META-INF/xsl/kuoni/RQ2SOAP.xsl"/>
               </action>
              
              <!-- ------------------------------------------------------------------- -->
               <!-- here we need SOAP Router for Kuoni.com -->
              
              
              <action name="SoapRouter" class="org.jboss.soa.esb.actions.routing.http.HttpRouter">
               <property name="endpointUrl" value="${integra.middleware.kuoni.url-endpoint}">
               <http-client-property name="file" value="/META-INF/http.properties" />
               </property>
               <property name="method" value="POST" /> <!-- Currently only supports GET or POST - easy to add more! -->
               <property name="responseType" value="STRING" /> <!-- Response should be set back on message as STRING or BYTES - default STRING -->
               <property name="headers"> <!-- Supports setting of arbitrary request headers -->
               <property name="Content-Type" value="text/xml;charset=ISO-8859-1"/>
               </property>
              </action>
              ...
              ..
              <!-- ------------------------------------------------------------------- -->
              
              


              my http.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=60000
              http.protocol.content-charset=ISO-8859-1
              
              # See:
              # - http://wiki.jboss.org/wiki/Wiki.jsp?page=HttpRouter and
              # - http://wiki.jboss.org/wiki/Wiki.jsp?page=HttpClientFactory
              
              
              # HttpProtocol config...
              protocol-socket-factory=org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory
              #protocol-socket-factory=org.jboss.soa.esb.http.protocol.SelfSignedSSLProtocolSocketFactoryBuilder
              #protocol-socket-factory=org.jboss.soa.esb.http.protocol.AuthSSLProtocolSocketFactoryBuilder
              keystore=@keystore@
              keystore-passw=https_2way_ssl_pass
              truststore=@keystore@
              truststore-passw=https_2way_ssl_pass
              
              


              I don't know what to put here in these keystore parameters?

              When i deploy the service, the server gives this error:

              ObjectName: jboss.esb:deployment=integra.middleware.kuoni_adapter.esb
               State: FAILED
               Reason: org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException: Error configuring action processing pipeline
              


              I have no idea how the action processing pipeline is getting wrong:(
              I'm building a soap message (input to httprouter) like the following:

              
              <?xml version="1.0" encoding="windows-1252"?>
              <xsl:stylesheet version="1.0" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
               <xsl:strip-space elements="soap:*"/>
               <xsl:output method="xml" version="1.0" encoding="ISO-8859-1" cdata-section-elements="request"/>
               <xsl:template match="/">
               <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
               <xsl:attribute name="xmlns:SOAP-ENC">http://schemas.xmlsoap.org/soap/encoding/</xsl:attribute>
               <xsl:attribute name="xmlns:xsi">http://www.w3.org/2001/XMLSchema-instance</xsl:attribute>
               <xsl:attribute name="xmlns:xsd">http://www.w3.org/2001/XMLSchema</xsl:attribute>
               <SOAP-ENV:Header>
               <m:AuthHeader xmlns:m="http://webservices.kuoni.ch">
               <m:User>aaaa</m:User>
               <m:Password>xxxx</m:Password>
               </m:AuthHeader>
               </SOAP-ENV:Header>
               <SOAP-ENV:Body>
               <ForwardRequest xmlns="http://webservices.kuoni.ch">
               <request>
               <xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text>
               <xsl:apply-templates select="Request"/>
               <xsl:text disable-output-escaping="yes">]]</xsl:text>
               <xsl:text disable-output-escaping="yes">></xsl:text>
               <!-- CDATA would contain Request element and all its decendents -->
               </request>
               </ForwardRequest>
               <!--xsl:copy-of select="node()"></xsl:copy-of-->
               </SOAP-ENV:Body>
               </SOAP-ENV:Envelope>
               </xsl:template>
               <xsl:template match="Request">
               <xsl:element name="{local-name()}" namespace="http://webservices.kuoni.ch">
               <xsl:copy-of select="@*"/>
               <xsl:copy-of select="*"/>
               </xsl:element>
               </xsl:template>
              </xsl:stylesheet>
              
              


              Can you suggest something by looking at the above description i have provided?

              Thanks.



              "ScottDawson" wrote:
              Look at the https_2way_ssl quickstart for an example of invoking a web service over HTTPS using the HttpRouter. A couple of things to note -- the method value should probably be POST since that indicates the HTTP method to use (GET and POST are currently supported) and HTTP headers such as Content-Type are specified by a header element inside a "headers" property element. All this is illustrated in the jboss-esb-template.xml in the quickstart.

              Regards,
              Scott


              • 4. Re: ESB HttpRouter for Https Web Service
                scottdawson

                The service provider should be able to give you the keystore information.

                You can probably find more information about the configuration error in server.log.

                • 5. Re: ESB HttpRouter for Https Web Service
                  tfennelly

                  Looks as though you copied the keystore settings from the quickstart, vertabim. The keystore values of "@keystore@" etc are token replacements that the ant deployment script update with appropriate local env values. You need to replace these with something like...

                  keystore=/ssl/xxxkeystore
                  keystore-passw=https_2way_ssl_pass
                  truststore=/ssl/xxxtruststore
                  truststore-passw=https_2way_ssl_pass
                  


                  • 6. Re: ESB HttpRouter for Https Web Service
                    sbutt

                    Actually, I didn't get anything out of that quickstart example https_2way_ssl, it explains nothing about what's going on:((

                    My simple soap message looks like the following:

                    
                    <?xml version="1.0" encoding="ISO-8859-1"?>
                    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
                     <SOAP-ENV:Header>
                     <m:AuthHeader xmlns:m="http://webservices.kuoni.ch">
                     <m:User>xxx</m:User>
                     <m:Password>xxx</m:Password>
                     </m:AuthHeader>
                     </SOAP-ENV:Header>
                     <SOAP-ENV:Body>
                     <ForwardRequest xmlns="http://webservices.kuoni.ch">
                     <request><![CDATA[<Request SubType="CHECK" Type="BOOK" Version="2.5" From="EBOOKERS" To="KUEKA0" TermId="EB1369" Window="A" Date="06072009" Time="124351" Confirm="YES" Agent="541406" Lang="DE" UserCode="EBOO" UserType="M" UserName="EBOOKERS" UserFirstName="CH" Mode="Test"><Fab><TOCode>KUON</TOCode><Catalog>010</Catalog><Creator>CTS</Creator><Fat ServiceType="T" SegRef="0"><StartDate>23072009</StartDate><Dep>ZRH</Dep><Arr>AYT</Arr><Carrier/><FlightNr/><Persons>12</Persons></Fat><Fat ServiceType="T" SegRef="1"><StartDate>30072009</StartDate><Dep>AYT</Dep><Arr>ZRH</Arr><Carrier/><FlightNr/><Persons>12</Persons></Fat><Fah ServiceType="H" SegRef="2"><StartDate>23072009</StartDate><Duration>7</Duration><Destination>AYT</Destination><Product>GLOGOL</Product><Room/><Persons>12</Persons></Fah><Fap ID="1"><PersonType>M</PersonType><Name>Nom de famille</Name></Fap><Fap ID="2"><PersonType>F</PersonType><Name>Nom de famille</Name></Fap></Fab></Request>]]></request>
                     </ForwardRequest>
                     </SOAP-ENV:Body>
                    </SOAP-ENV:Envelope>
                    
                    
                    


                    and the WSDL lnk is:

                    https://webservices.kuoni.ch/cetsbridge/test/CETSWebBridge.asmx?WSDL


                    I'm sending the above soap message on the stated wsdl using AltovaXMLSpy's SOAP request sending feature and it requires no keystore or any authentication apart from the one stated inside the soap message for only intenal WS authentication. And there i get a perfect WS response.

                    I'm quite sure that the WS provider wouldn't know about the keystore information otherwise they would have provided us in the beginning.

                    It is still unclear to me which set of configuration settings/files i need for https router?

                    Thanks.


                    "tfennelly" wrote:
                    Looks as though you copied the keystore settings from the quickstart, vertabim. The keystore values of "@keystore@" etc are token replacements that the ant deployment script update with appropriate local env values. You need to replace these with something like...
                    keystore=/ssl/xxxkeystore
                    keystore-passw=https_2way_ssl_pass
                    truststore=/ssl/xxxtruststore
                    truststore-passw=https_2way_ssl_pass
                    


                    • 7. Re: ESB HttpRouter for Https Web Service
                      tfennelly

                       

                      "sbutt" wrote:
                      Actually, I didn't get anything out of that quickstart example https_2way_ssl, it explains nothing about what's going on:((


                      OK, must just be a total cooincidence then that the keystore settings match exactly ;)

                      Anyway.... you said you didn't know what you should set the keystore settings to, right? The above mentioned quickstart illustrates how to generate a keystore (in the build.xml file). It installs that keystore in the local env and generates the quickstart artifacts to point to this keystore (replacing the "@keystore@" tokens).

                      You need to replicate this in some way in your env. If you already have a keystore, just point the config at it. If you don't... then generate one using whatever flavor of the keygen tool you like (e.g. via Ant as shown in this quickstart).

                      • 8. Re: ESB HttpRouter for Https Web Service
                        sbutt

                        Thanks Guys!

                        I replaced in that quickstart example the WS url with mine and build the project with ant, which generated the keystore file. I then placed that keystore file in my actual project and referenced it in my http-properties file, which now works fine and i can see the response from my actual WS.

                        much appreciated:)