B2B Integration

Sterling B2B Integration

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  Download file from https server using HttpClientAdapter

    Posted Tue October 27, 2020 05:36 PM
    Team,

    Need some help to figure out running HttpClientAdaptor and to down load files from am HTTPS ( port 443) site. I am using HTTPClientAdapter and related services per documentation in https://www.ibm.com/support/knowledgecenter/SS3JSW_6.0.0/integrating/integrating/integrator/HTTP_Client_adapter.html . Since i have to connect to https url   which is https://download.cms.gov , I am using
                 <assign to="SSL">Must</assign>
            <assign to="CipherStrength">Strong</assign>
            <assign to="CACertificateId">??????</assign>
            <assign to="SystemCertificateId">????</assign>

    I am looking for help on how to get CACertificateId & SystemCertificateId for the site I am trying to download.
    Thank you.


    ------------------------------
    Srini Parise
    ------------------------------

    #SupplyChain
    #B2BIntegration


  • 2.  RE: Download file from https server using HttpClientAdapter

    Posted Wed October 28, 2020 02:26 AM

    Hi Srini,

    You will need to download the Intermediate and Root CA certificates that was used to sign the certificate presented by the site you are trying to access, and import them into your B2Bi system.

    I believe they will have Common Name of "GeoTrust RSA CA 2018" (Intermediate CA) and "DigiCert Global Root CA" (Root CA).

    If you have access to the Internet, and you have the openssl tool available, you can run the command:

    openssl s_client -servername download.cms.gov -connect download.cms.gov:443

    This will show you some text from the certificate, and also provide a base64 encoded certificate in the PEM format (between and including the "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----" lines. You can copy & save this file with a .cer extension and use it to open on a windows system and you can use the Windows certificate manager can obtain and save the intermediate and root CA certificates from the certification path section. 

    Otherwise you could possibly also obtain the certificates by visiting the site with your browser and viewing/saving the certificate where you have the padlock or other icon to indicate the site is using a certificate.


    After you have imported it to B2Bi, you can view the Intermediate CA certificate in your system and you should see a "System Certificate ID" section. The ID value should be a string comprised of your B2Bi hostname, node id and some further identifiers.

    You can then include this ID in the "CACertificateId" assignment in your BPML, like so:

    <assign to="CACertificateId">myhostmachine:node1:1451e4d35f0:21048726</assign>

    Note the values in my sample above are example only, and you will need the actual values from your system.

    You would only use the <assign to="SystemCertificateId"> if the server requires a client certificate to be presented for authentication.

    Perhaps refer to: https://www.ibm.com/support/knowledgecenter/SS3JSW_6.0.0/integrating/integrating/integrator/HTTP_Client_Begin_Session_svc.html


    Then you should be able to make the connection to the server (and download the required files - providing you are following the HTTP Client Begin Session Service with a HTTP Client GET service or HTTP Client Method service).

    Another way to make the connection is to create a trading partner profile and select the appropriate CA certificate when creating the profile and supply the ProfileId to the HTTP Client Begin Session service instead of explicitly providing the CA certificate ID.

    Hope this helps.

    Regards,
    Andrew



    ------------------------------
    Andrew Plumb
    ------------------------------



  • 3.  RE: Download file from https server using HttpClientAdapter

    Posted Wed October 28, 2020 11:10 AM
    Andrew,

    Thank you very much.  Good news is it worked !!!

    -Regards

    ------------------------------
    Srini Parise
    ------------------------------



  • 4.  RE: Download file from https server using HttpClientAdapter

    Posted Wed November 04, 2020 10:58 AM
    Andrew,

    One more question, continue on same topic.   BP is working fine and completed success when the desired document is available to download. In case if document not found, the HTTP Client GET Service is giving back 404 and entering in to onFault sequence and BP is halted with ERROR. I need to handle 404 scenario also as success.

    So I put a rule for 404 status code and code as bellow in onfault. , but still getting that step as ERROR and SFG route is still failed.  Any thoughts??

    <onFault>
          <sequence name="OnFault">
            <operation name="HTTP Client End Session Service">
              <participant name="HTTPClientEndSession"/>
              <output message="HTTPClientEndSessionServiceTypeInputMessage">
                <assign to="." from="*"></assign>
                <assign to="SessionToken" from="/ProcessData/SessionToken/text()"></assign>
              </output>
              <input message="inmsg">
                <assign to="." from="*"></assign>
              </input>
            </operation>
            <choice name="Choice Start">
    	   <select>
    	      <case ref="FileNotFound" negative="true" activity="generateException_serverError"/>
    	      <case ref="FileNotFound" activity="FileNotFound_Okay"/>
               </select>
             <sequence name="generateException_serverError">
                    <assign to="ErrorMessage">Resp code is neither 200 nor 404 </assign>
    		<operation name="generateException">
    		  <participant name="BPExceptionService"/>
    		  <output message="Xout">
    		    <assign to="exceptionCode">Error, Document download Failed via HHTPS.</assign>
    		    <assign to="." from="*"></assign>
    		  </output>
    		  <input message="Xin">
    		    <assign to="." from="*"></assign>
    		  </input>
    		</operation>
    	 </sequence>
    	 <sequence name="FileNotFound_Okay">
    	        <assign to="ErrorMessage">Resp code is 404.This isOkay  </assign>	 	
    	 </sequence>
    	</choice>
          </sequence>
        </onFault>


    ------------------------------
    Srini Parise
    ------------------------------



  • 5.  RE: Download file from https server using HttpClientAdapter

    Posted Wed November 04, 2020 05:22 PM
    Hi Srini,

    I'm not aware if there is a way to override/reset the error being returned from the HTTP Client, such that your BP will finish in a 'success' state... i.e. I think the HTTP 400 or 500 level return codes will mean that your BP will finish in 'error' status.

    (https://www.ibm.com/support/knowledgecenter/en/SS3JSW_6.0.1/integrating/integrating/integrator/HTTP_Client_adapter.html)

    All I could suggest is that you detect this particular error code (ResponseStatusCode value) and cater accordingly in your BP to bypass your error handling routine if this is an acceptable outcome.

    ------------------------------
    Andrew Plumb
    ------------------------------



  • 6.  RE: Download file from https server using HttpClientAdapter

    Posted Mon November 09, 2020 01:34 PM
    Your OnFault code is missing the <repeat name="Reason" ref="SequenceName"/>.  In this case the sequence name should be where your your get failed or the next sequence past the get.
    If you want to consider your OnFault code fixed the issue and you want the business process to continue like normal and end successfully. Then the calling system will get a completion and continue.
    You may also have to rework all your logic since the first step in your OnFault closes the session and going back to that sequence you can't refer to the session again after removing it. Might have to set a variable there if no file to get, then check before you do the get again and just move the process forward in the correct logic you need for the BP to finish all the remaining steps.
    Note the BP will still be flagged with a status of "Error" but it will finish just like no error happened.

    ------------------------------
    Mark Murnighan
    Solution Architect
    ------------------------------