2

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."

Venkatesh Voona
  • 423
  • 8
  • 27

1 Answers1

1

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

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • Yes, the end point is SAP but in the middle The "APIGEE" is their and it is providing some authentication. – Venkatesh Voona Jun 12 '15 at 14:49
  • I still things that's the way to go. See this as well: http://stackoverflow.com/questions/16921978/authorizing-http-adapter-in-ibm-worklight – Idan Adar Jun 12 '15 at 16:02
  • I edited my question that I added my xml file. and I'm getting error – Venkatesh Voona Jun 12 '15 at 17:03
  • Because you've misplaced connectionTimeoutInMilliseconds and socketTimeoutInMilliseconds. Put both of these elements below the domain element. BTW, why did you remove the port element? Don't change the XML structure. – Idan Adar Jun 12 '15 at 17:09
  • Ok I kept these elements below the domain element. There is no port number for my API So I removed that and now no error is showing in my xml but I'm getting the response like ""Content is not allowed in prolog.", "Failed to parse the payload from backend (procedure: HttpRequest)"" – Venkatesh Voona Jun 12 '15 at 17:21