JSON Web サービスを呼び出そうとすると例外が発生します。私はこれに不慣れで、どこで間抜けなのだろうかと思います。
例外
GET com.sun.jersey.api.client.UniformInterfaceException: GET http://www.mcruiseon.com:8081/mCruiseOnCarPool4All/carpool4all/AcceptedSubscriptionList/Request/143683759/-1087322127は、com で 500 内部サーバー エラーの応答ステータスを返しました。 sun.jersey.api.client.WebResource.handle(WebResource.java:686) com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) com.sun.jersey.api.client で.WebResource$Builder.get(WebResource.java:507) at test.carpool4all.SingleProviderTest.testPost(SingleProviderTest.java:70)
Junit クライアント (SingleProviderTest)
// AcceptedSubscriptionList
service = client.resource(UriBuilder.fromUri(
"http://localhost:8081/mCruiseOnCarPool4All/carpool4all/AcceptedSubscriptionList/Request/" + identityHash
+ "/" + journeyList[i].getProviderHash()).build());
//Line # 70 Below
SubscribeJourneyConcrete[] acceptdList = service.type(MediaType.APPLICATION_JSON).get(
SubscribeJourneyConcrete[].class);
assertNotNull(acceptdList);
assertTrue(acceptdList.length > 0);
ジャージー Web サービス
@Path("/AcceptedSubscriptionList")
public class AcceptedSubscriptionListService {
private ClientSession clientSession ;
private static final SessionManager sessionManager = SessionManager.getInstance() ;
@Context
UriInfo uriInfo;
@Context
Request request;
@GET
@Path ("Request/{identityHash}/{providerHash}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response getJourneyList(@PathParam("identityHash") String identityHash,
@PathParam("providerHash") String providerHash) {
AcceptedSubscriptionListRequest request = new AcceptedSubscriptionListRequest(providerHash) ;
AcceptedSubscriptionListResponse response ;
clientSession = sessionManager.getClientSession(identityHash) ;
clientSession.getSendQueue().sendRequest(request) ;
try {
response = (AcceptedSubscriptionListResponse)clientSession.waitAndGetResponse(request) ;
} catch (WaitedLongEnoughException e) {
return Response.serverError().build() ;
} catch (UnableToResolveResponseException e) {
return Response.serverError().build() ;
}
return Response.ok(response.getAcceptedSubscriberList()).build();
}
Web サービスは正常にロードされています
情報: ルート リソース クラスが見つかりました: クラス com.mcruiseon.carpool4all.VehicleListService クラス com.mcruiseon.carpool4all.SubscriberListService クラス com.mcruiseon.carpool4all.JourneyListService クラス com.mcruiseon.carpool4all.RegistrationService クラス com.mcruiseon.carpool4all.SearchService クラス com. mcruiseon.carpool4all.AddJourneyDetailsService クラス com.mcruiseon.carpool4all.AcceptedSubscriptionListService クラス com.mcruiseon.carpool4all.AcceptSubscriptionService クラス com.mcruiseon.carpool4all.AddVehicleDetailsService クラス com.mcruiseon.carpool4all.SubscribeToThisJourneyService クラス com.mcruiseon.carpool4all.AddUserDetailsService