Search code examples
ibm-mobilefirstmobilefirst-adapters

how to invoke adapters hybrid application MobileFirst Platform 6.3


i have some error

Caused by: FWLSE0099E: An error occurred while invoking procedure [project EMoney]InquiryAdapters/HttpRequestFWLSE0100E: parameters: [project EMoney] Http request failed: org.apache.http.conn.HttpHostConnectException: Connect to rss.cnn.com:80 [rss.cnn.com/74.125.200.121] failed: Connection timed out: connect

FWLSE0101E: Caused by: [project EMoney]org.apache.http.conn.HttpHostConnectException: Connect to rss.cnn.com:80 [rss.cnn.com/74.125.200.121] failed: Connection timed out: connectjava.lang.RuntimeException: Http request failed: org.apache.http.conn.HttpHostConnectException: Connect to rss.cnn.com:80 [rss.cnn.com/74.125.200.121] failed: Connection timed out: connect

Caused by: org.apache.http.conn.HttpHostConnectException: Connect to rss.cnn.com:80 [rss.cnn.com/74.125.200.121] failed: Connection timed out: connect

Caused by: java.net.ConnectException: Connection timed out: connect

inquiryAdapters.xml

<wl:adapter name="InquiryAdapters"
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>InquiryAdapters</displayName>
<description>InquiryAdapters</description>
<connectivity>
    <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
        <protocol>http</protocol>
        <domain>rss.cnn.com</domain>
        <port>80</port> 
        <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"/>

<procedure name="getStoriesFiltered"/>

<procedure name="getFeedsFiltered"/>
</wl:adapter>

inquiryAdapters.impl

function getStories(interest) {
path = getPath(interest);

var input = {
    method : 'get',
    returnedContentType : 'xml',
    path : path
};
return WL.Server.invokeHttp(input);}


function getStoriesFiltered(interest) {
path = getPath(interest);

var input = {
    method : 'get',
    returnedContentType : 'xml',
    path : path,
    transformation : {
        type : 'xslFile',
        xslFile : 'filtered.xsl'
    }
};

return WL.Server.invokeHttp(input);}


function getFeedsFiltered() {

var input = {
    method : 'get',
    returnedContentType : 'xml',
    path : "rss.xml",
    transformation : {
        type : 'xslFile',
        xslFile : 'filtered.xsl'
    }
};

return WL.Server.invokeHttp(input);}


function getPath(interest) {
if (interest == undefined || interest == '') {
    interest = '';
}else {
    interest = '_' + interest;
}
return 'rss/edition' + interest + '.rss';}

when i want to invoke the adapters (http adapters).


Solution

  • If you have followed the next steps yet you get a "Connection timed out" error, you likely have a network issue unrelated to MobileFirst Platform 6.3: check for any firewalls that prevent your connection to arrive to CNN.com

    1. Created a new project
    2. Create a new HTTP adapter
    3. Right-click on adapter folder > Deploy MobileFirst Adapter
    4. Right-click on adapter folder > Call MobileFirst Adapter

    Now a browser window with the response should've opened.