Search the web
Sign In
New User? Sign Up
ydn-auth · Yahoo! Authenticated Web Services
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
unable to determine aouth type   Topic List   < Prev Topic  |  Next Topic >
Reply | Forward < Prev Message  |  Next Message > 
Hi,
i wrote the following class in java for getting contacts. I am using BBauth.
public class GetAllContactsTest extends AbstractTestCase{
final Logger LOGGER = LoggerFactory.getLogger(GetAllContactsTest.class);
String appid ="Wwuo87zIkY2QgCjTbxJIEmmv_SF3pGlJfcw-";
String wssid = "aQ4NwuFa.dN";
//String cookie =
"Y=3hxmZLR_7aO93vNxNcAPYfNPt6W9c5Vk97zSvV2e8H1Rn_uS0IpexYhZKdlA1unz3IU22qJydp9rt\
.Z4iNAvZdUGCFvZuvs3AKI1nydgMwwcb_9g2qeqUkwWZbH_B.aVzpvMDy9sTzZB5kb3CDQV2UILgR9yw\
.OlKxON56EI.p36daf1Yr4UcPlaeMPNjSR3aRKxPTP6P6kp4s4RtgaqxsTApW5lDRpSSGy_Ag4C0nLRd\
dwV2NRmPuaBZPPxLK7FbjJZ0X0bwx7ZsCWJa2ccL2EWYlq6LGgMW.CDVEU0GLjvO7U4iZIUa45.hlEhk\
RQhlVfzgMiabIegN21NBIfpeX6p.B7ReMaY9SRTRpVIaAtrFdSkWQQvNHCpBJ7idHbzKM1Gh_rP.VJX3\
xbW7SKpX7FX01CLjZaxZq65FMlVwyb.8SUrYDCrpzFmMRGyCf8fuBtL1P_e2fgJ8fYBc_P0SAxSutj4E\
w4YuqSfjId8cDV94M1R1Jf4z7MoCAeJFSAF84IgqnNoI5QhK3ZipS5XujSRkIEN9hPutGnG8Y4r7iWpo\
cglduvMDg_aGyHjQD3XiuDftg--";
String cookie =
"Y=3hxmZLR_7aO93vNxNcAPYfNPt6W9c5Vk97zSvV2e8H1Rn_uS0IpexYhZKdlA1unz3IU22qJydp9rt\
.Z4iNAvZdUGCFvZuvs3AKI1nydgMwwcb_9g2qeqUkwWZbH_B.aVzpvMDy9sTzZB5kb3CDQV2UILgR9yw\
.OlKxON56EI.p36daf1Yr4UcPlaeMPNjSR3aRKxPTP6P6kp4s4RtgaqxsTApW5lDRpSSGy_Ag4C0nLRd\
dwV2NRmPuaBZPPxLK7FbjJZ0X0bwx7ZsCWJa2ccL2EWYlq6LGgMW.CDVEU0GLjvO7U4iZIUa45.hlEhk\
RQhlVfzgMiabIegN21NBIfpeX6p.B7ReMaY9SRTRpVIaAtrFdSkWQQvNHCpBJ7idHbzKM1Gh_rP.VJX3\
xbW7SKpX7FX01CLjZaxZq65FMlVwyb.8SUrYDCrpzFmMRGyCf8fuBtL1P_e2fgJ8fYBc_P0SAxSutj4E\
w4YuqSfjId8cDV94M1R1Jf4z7MoCAeJFSAF84IgqnNoI5QhK3ZipS5XujSRkIEN9hPutGnG8Y4r7iWpo\
cglduvMDg_aGyHjQD3XiuDftg--";
String userHash = "uuB9.tNxY.ucl_6ayCGDTZY-";

public GetAllContactsTest(String name) {
super(name);
}

public void setUp() throws Exception{
super.setUp();
}

public void testAllContact() throws Exception{
HttpMethod method=null;
try{

String uri
="http://social.yahooapis.com/v1/user/"+userHash+"/contacts?count=max&appid="+ap\
pid+"&WSSID="+wssid;
HttpClient client = new HttpClient();
method = new GetMethod(uri);
Header hCookie = new Header("Cookie:", cookie);
Header accept = new Header("Accept","*");
Header contentType = new Header("Content-Type", "application/xml;
charset=utf-8");
Header pragma = new Header("Pragma", "No-Cache");
method.addRequestHeader(hCookie);
method.addRequestHeader(accept);
method.addRequestHeader(contentType);
//method.addRequestHeader(pragma);
method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
new DefaultHttpMethodRetryHandler(3, false));
int statusCode = client.executeMethod(method);

if (statusCode != HttpStatus.SC_OK) {
//fail("Can not get the Contacts Stream: "+method.getStatusLine());
}
//byte[] responseBody = method.getResponseBody();
InputStream responseStream = method.getResponseBodyAsStream();
BufferedReader bufReader = new BufferedReader( new
InputStreamReader(responseStream));
String stResponseBody = "",oneLine=null;
while((oneLine=bufReader.readLine())!=null)
stResponseBody = stResponseBody + oneLine +"\n";
LOGGER.debug("==================The response body is=====");
LOGGER.debug(stResponseBody);
LOGGER.debug("==================End of response body=====");


}catch(Exception e){
LOGGER.debug("An exception has occured: "+e.toString());
fail("An exception has occured: "+e.toString());
}finally{
method.releaseConnection();
}
}

}

The response i get is the following:

15:08:52,772 WARN [HttpMethodDirector] Unable to respond to any of these
challenges: {oauth=OAuth oauth_problem="unable_to_determine_oauth_type",
realm="yahooapis.com"}
15:08:52,772 DEBUG [GetAllContactsTest] ==================The response body
is=====
15:08:52,772 DEBUG [GetAllContactsTest] <?xml version='1.0' encoding='UTF-8'?>
<yahoo:error xmlns:yahoo='http://yahooapis.com/v1/base.rng'
xml:lang='en-US'>
<yahoo:description>Please provide valid credentials. OAuth
oauth_problem="unable_to_determine_oauth_type",
realm="yahooapis.com"</yahoo:description>
</yahoo:error>
<!-- ws107.socdir.ch1.yahoo.com uncompressed/chunked Tue Oct 6 06:06:32 PDT
2009 -->

15:08:52,772 DEBUG [GetAllContactsTest] ==================End of response
body=====

Could someone please let me know what might be wrong?

Many thanks in advance
Faisal






Tue Oct 6, 2009 1:09 pm

digipetest
Offline Offline
Send Email Send Email

Forward
< Prev Message  |  Next Message > 
Expand Messages Author Sort by Date

Hi, i wrote the following class in java for getting contacts. I am using BBauth. public class GetAllContactsTest extends AbstractTestCase{ final Logger LOGGER...
DiGI
digipetest
Offline Send Email
Oct 6, 2009
5:15 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help