Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ADF Mobile RestServiceAdapter fails with apple rest json service

biemondOct 27 2012 — edited Oct 30 2012
Hi,

I am using the ADF mobile RestServiceAdapter and this fails in returning results with this JSON rest service
http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/itmsSearch?term=rihanna&media=music&limit=50&output=json

I don't get an exception and no data is returned

when I use this one of google it works perfectly
http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true


RestServiceAdapter restServiceAdapter = Model.createRestServiceAdapter();

// Clear any previously set request properties, if any
restServiceAdapter.clearRequestProperties();

// Set the connection name
restServiceAdapter.setConnectionName("ITunesRest");
// restServiceAdapter.setConnectionName("GoogleGeocodeJSON");

// Specify the type of request
restServiceAdapter.setRequestType(RestServiceAdapter.REQUEST_TYPE_GET);
restServiceAdapter.addRequestProperty("Content-Type", "application/json");
restServiceAdapter.addRequestProperty("Accept", "application/json; charset=UTF-8");
// Specify the number of retries
restServiceAdapter.setRetryLimit(0);

// Set the URI which is defined after the endpoint in the connections.xml.
// The request is the endpoint + the URI being set
restServiceAdapter.setRequestURI("?term=rihanna&media=music&limit=50&output=json");
// restServiceAdapter.setRequestURI("?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true");

// Execute SEND and RECEIVE operation
try {
// For GET request, there is no payload
response = restServiceAdapter.send("");
System.out.println("response is " + response);
this.result = response.toString();

} catch (Exception e) {
e.printStackTrace();
this.result = "error";
}

thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 27 2012
Added on Oct 27 2012
5 comments
469 views