0

Mail Returning 999 or Timeouts

I'm getting 999 errors locally (even though I've only tried 2 to 3 times). I guess my IP could still be banned (or is in a range of banned IPs).

When I deploy remotely (to Google App Engine), I get Timeout errors.

First of all, when creating an App Key, using BBAuth, I don't see mail in the list.

Scope: Yahoo! Taiwan Lifestyle with Read/Write access
Scope: Yahoo! Music
Scope: Yahoo! Taiwan Knowledge Plus
Scope: BOSS Search Service

Here's the link that is generated: (spaces are intentional)
java.io.IOException: Timeout while fetching: http://mail.yahooapis.com/ws/mail/v1.1/soa.....&WSSID=...

Here's the code
CODEBOX
public void sendEmail(YahooAuthentication yAuth) throws Exception {

String cookie = yAuth.cookie;
String wssid = yAuth.wssid;

appId = enc(appId); // url encode
wssid = enc(wssid); // url encode

String url = "http://mail.yahooapis.com/ws/mail/v1.1/soap?";
url += "appid=" + appId;
url += "&WSSID=" + wssid;

String POSTDATA = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><SOAP-ENV:Body><m:SendMessage xmlns:m=\"urn:yahoo:ymws\"><message><to><email>...</email></to><from><email>...</email></from><simplebody><text>this is a test</text></simplebody><subject>test</subject></message></m:SendMessage></SOAP-ENV:Body></SOAP-ENV:Envelope>";

HTTPRequest request = new HTTPRequest(new URL(url),HTTPMethod.POST);
request.addHeader(new HTTPHeader("Cookie", cookie));
request.addHeader(new HTTPHeader("Content-Type", "application/x-www-form-urlencoded"));

request.addHeader(new HTTPHeader("User-Agent", appId));
request.setPayload( POSTDATA.getBytes() );

HTTPResponse response = URLFetchServiceFactory.getURLFetchService().fetch(request);

String content = new String(response.getContent());
System.out.println(content);

}

by
6 Replies
  • A 999 error means your ip is being denied due to abuse -- so switching to a different host (ie: app engine) should resolve the issue. What is the timeout you have set for the request?

    QUOTE (Derrick @ Mar 24 2010, 08:56 AM) <{POST_SNAPBACK}>
    I'm getting 999 errors locally (even though I've only tried 2 to 3 times). I guess my IP could still be banned (or is in a range of banned IPs).

    When I deploy remotely (to Google App Engine), I get Timeout errors.

    First of all, when creating an App Key, using BBAuth, I don't see mail in the list.

    Scope: Yahoo! Taiwan Lifestyle with Read/Write access
    Scope: Yahoo! Music
    Scope: Yahoo! Taiwan Knowledge Plus
    Scope: BOSS Search Service

    Here's the link that is generated: (spaces are intentional)
    java.io.IOException: Timeout while fetching: http://mail.yahooapis.com/ws/mail/v1.1/soa.....&WSSID=...

    Here's the code
    CODE
    public void sendEmail(YahooAuthentication yAuth) throws Exception {

    String cookie = yAuth.cookie;
    String wssid = yAuth.wssid;

    appId = enc(appId); // url encode
    wssid = enc(wssid); // url encode

    String url = "http://mail.yahooapis.com/ws/mail/v1.1/soap?";
    url += "appid=" + appId;
    url += "&WSSID=" + wssid;

    String POSTDATA = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><SOAP-ENV:Body><m:SendMessage xmlns:m=\"urn:yahoo:ymws\"><message><to><email>...</email></to><from><email>...</email></from><simplebody><text>this is a test</text></simplebody><subject>test</subject></message></m:SendMessage></SOAP-ENV:Body></SOAP-ENV:Envelope>";

    HTTPRequest request = new HTTPRequest(new URL(url),HTTPMethod.POST);
    request.addHeader(new HTTPHeader("Cookie", cookie));
    request.addHeader(new HTTPHeader("Content-Type", "application/x-www-form-urlencoded"));

    request.addHeader(new HTTPHeader("User-Agent", appId));
    request.setPayload( POSTDATA.getBytes() );

    HTTPResponse response = URLFetchServiceFactory.getURLFetchService().fetch(request);

    String content = new String(response.getContent());
    System.out.println(content);

    }
    0
  • I am using the API's default timeout, which should be thirty seconds...

    Just to be sure, I set it to 30, tried again, but I am still getting the same problem. While it takes longer to come back, it's still not 30 seconds.

    Does Yahoo block requests from Google App Engine?
    0
  • QUOTE (Derrick @ Mar 25 2010, 05:28 AM) <{POST_SNAPBACK}>
    I am using the API's default timeout, which should be thirty seconds...

    Just to be sure, I set it to 30, tried again, but I am still getting the same problem. While it takes longer to come back, it's still not 30 seconds.

    Does Yahoo block requests from Google App Engine?



    I'm still not having any luck whatsoever. I have contact Google App Engine tech support, and have verified that they are not blocking outbound requests to Yahoo, etc.

    I am puzzled, to say the least. Still getting the 999 error locally too. This is not cool
    0
  • I have verified that if I hit this same URL, only without setting the cookie, that I get an immediate return, with:

    SOAP-ENV:Client.MissingCredentialsMissing credentials.

    I am not sure why requesting the exact same URL with my valid cookie causes the time out.

    This leaves me to believe that it's something on the Yahoo! side.
    0
  • Hi,

    There are few suggestions here which I have.
    1. Using OAuth instead of BBAuth - We have recently made few changes and BBAuth will be deprecated soon. I would recommend usage of OAuth and you can get your keys from the YDN Mail page. (https://developer.apps.yahoo.com/dashboard/createKey.html)
    2. Usage of JSON instead of SOAP

    For more details please check the document here in YDN

    Getting back to your issue, can you please paste the entire response here? Also I would like to understand if you are getting the same issue using JSON.
    Please find a snippet below which will help you to quickly try it out. Also please download the org.json library from json.org and add it to your classpath.

    CODE
        // JSON Endpoint
    public static String JSONURL = "http://mail.yahooapis.com/ws/mail/v1.1/jsonrpc";
    //JSON Object
    JSONObject jsonObjSend = new JSONObject();
    //URL
    String URL = JSONURL + "?appid=" + appPr.getProperty("APP_ID") + "&WSSID=" + wssid;
    //API Method
    String key= "ListFolders";
    String value = "[{}]";
    // Parameter of the api
    JSONArray param = new JSONArray(value);

    jsonObjSend.put("params", param);
    jsonObjSend.put("method", key);

    URL = appPr.getProperty("JSON_ENDPOINT") + "?appid=" +APP_ID+ "&WSSID=" + wssid;
    // JSON object to hold the information, which is sent to the server
    JSONObject jsonObjRecv = HttpClient.SendHttpPost(URL, jsonObjSend, cookie);



    CODE
    public static JSONObject SendHttpPost(String URL, JSONObject jsonObjSend, String cookieVal) {

    try {
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpPost httpPostRequest = new HttpPost(URL);
    StringEntity se= new StringEntity(jsonObjSend.toString());

    // Set HTTP parameters
    httpPostRequest.setHeader("Cookie", cookieVal);
    httpPostRequest.setHeader("Accept", "application/json");
    httpPostRequest.setHeader("Content-type", "application/json");

    httpPostRequest.setEntity(se);

    long t = System.currentTimeMillis();
    HttpResponse response = (HttpResponse) httpclient.execute(httpPostRequest);

    // Get hold of the response entity (-> the data):
    HttpEntity entity = response.getEntity();

    if (entity != null) {

    // Read the content stream
    InputStream instream = entity.getContent();
    Header contentEncoding = response.getFirstHeader("Content-Encoding");

    // convert content stream to a String
    String resultString = convertStreamToString(instream);

    instream.close();
    // Transform the String into a JSONObject
    JSONObject jsonObjRecv = new JSONObject(resultString);

    return jsonObjRecv;
    }
    } catch (Exception e) {
    e.printStackTrace();
    }
    return null;
    }


    Also I am assuming that your APP_ID has a necessary access to the API's you are using. Thanks

    --
    Ram

    QUOTE (Derrick @ Mar 31 2010, 07:36 AM) <{POST_SNAPBACK}>
    I have verified that if I hit this same URL, only without setting the cookie, that I get an immediate return, with:

    SOAP-ENV:Client.MissingCredentialsMissing credentials.

    I am not sure why requesting the exact same URL with my valid cookie causes the time out.

    This leaves me to believe that it's something on the Yahoo! side.
    0
  • I got the 999 problem earlier.
    But then i updated my project with READ/WRITE access to YAHOO MAIL Service. Then the api key was changed by Yahoo. Then i updated my API Key everywhere.
    Then generated all the parameters ie. auth token, secret etc again with the new callback authentication.
    This solved the problem
    0

Recent Posts

in Yahoo! Mail Web Services API