Venkatesh Voona
Venkatesh Voona

Reputation: 423

How to consume secured API from IBM MobileFirst using http adapters

I'm trying to invoke an API which is having authentication. I'm getting an error like "Http request failed: java.net.SocketTimeoutException:Read timed out".

Generally when I run this url(http://samirkantalenka-test.apigee.net/zsubmitalv-3) on browser, It will ask for username and password. If I enter those credentials then it returns json data.

How can I give these credentials in Mobilefirst Http Adapters? Can any one help me out.

Adapter.xml

 <?xml version="1.0" encoding="UTF-8"?>
 <!--
Licensed Materials - Property of IBM
5725-I43 (C) Copyright IBM Corp. 2011, 2013. All Rights Reserved.
US Government Users Restricted Rights - Use, duplication or
disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 -->
<wl:adapter name="Apigee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:wl="http://www.ibm.com/mfp/integration"
xmlns:http="http://www.ibm.com/mfp/integration/http">

<displayName>Apigee</displayName>
<description>Apigee</description>
<connectivity>
    <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
        <protocol>http</protocol>
        <domain>samirkantalenka-test.apigee.net</domain>
        <authentication>
            <basic/>
            <serverIdentity>
                <username>{myusername}</username>
                <password>{mypassword}</password>
            </serverIdentity>

        </authentication> 
        <loadConstraints maxConcurrentConnectionsPerNode="2" />
    <connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
        <socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds>
       <maxConcurrentConnectionsPerNode>50</maxConcurrentConnectionsPerNode>       
   <!-- Following properties used by adapter's key manager for choosing specific certificate from key store  
        <sslCertificateAlias></sslCertificateAlias> 
        <sslCertificatePassword></sslCertificatePassword>
        -->     

    </connectionPolicy>
</connectivity>

<procedure name="getStories" connectAs="server"/>



    </wl:adapter>

Here I'm getting error like "cvc-complex-type.2.4.a: Invalid content was found starting with element 'loadConstraints'. One of '{proxy, sslCertificateAlias, sslCertificatePassword, maxConcurrentConnectionsPerNode}' is expected."

Upvotes: 2

Views: 235

Answers (1)

Idan Adar
Idan Adar

Reputation: 44516

Looks like that endpoint is SAP Netweaver one?
In this case simply create the dedicated SAP Netweaver Gateway adapter type:

enter image description here

In the adapter XML file you can then specify username and password.
Might work for you.

See the user documentation, here: http://www-01.ibm.com/support/knowledgecenter/SSHS8R_7.0.0/com.ibm.worklight.dev.doc/devref/c_sap_adapters.html

enter image description here

Upvotes: 1

Related Questions