11package oracleai ;
22
33import org .springframework .beans .factory .annotation .Autowired ;
4+ import org .springframework .http .*;
45import org .springframework .stereotype .Service ;
56import org .springframework .web .client .RestTemplate ;
6- import org .springframework .http .HttpEntity ;
7- import org .springframework .http .HttpHeaders ;
8- import org .springframework .http .MediaType ;
9- import org .springframework .http .ResponseEntity ;
107
118import java .util .HashMap ;
129import java .util .Map ;
@@ -23,24 +20,27 @@ public class DigitalDoubleService {
2320
2421 public void updateDigitalDoubleData (DigitalDoubleDownloadInfo info ) {
2522 String url = AIApplication .ORDS_OMLOPSENDPOINT_URL + "update_digital_double_data/" ;
23+
2624 HttpHeaders headers = new HttpHeaders ();
2725 headers .setContentType (MediaType .APPLICATION_JSON );
28- Map <String , Object > requestBody = new HashMap <>();
26+
27+ Map <String , String > requestBody = new HashMap <>();
2928 requestBody .put ("p_participant_email" , info .getEmail ());
3029 requestBody .put ("p_modelglburl_out" , info .getModelGlbUrl ());
31- requestBody .put ("p_modelfbxurl_out" , info .getModelFbxUrl () );
32- requestBody .put ("p_modelusdzurl_out" , info .getModelUsdzUrl () );
33- requestBody .put ("p_thumbnailurl_out" , info .getThumbnailUrl () );
34- requestBody . put ( "p_videourl_out" , info . getAnimatedVideoLocation ());
35- requestBody . put ( "p_video_out" , "" );
36- requestBody . put ( "p_similar_image_out" , "" );
37- HttpEntity < Map < String , Object >> entity = new HttpEntity <>( requestBody , headers );
38- RestTemplate restTemplate = new RestTemplate ();
39- ResponseEntity < String > response = restTemplate . postForEntity ( url , entity , String . class );
30+ requestBody .put ("p_modelfbxurl_out" , info .modelFbxUrl );
31+ requestBody .put ("p_modelusdzurl_out" , info .modelUsdzUrl );
32+ requestBody .put ("p_thumbnailurl_out" , info .thumbnailUrl );
33+
34+ HttpEntity < Map < String , String >> entity = new HttpEntity <>( requestBody , headers );
35+
36+ ResponseEntity < String > response =
37+ new RestTemplate (). exchange ( url , HttpMethod . POST , entity , String . class );
38+
4039 if (response .getStatusCode ().is2xxSuccessful ()) {
4140 System .out .println ("Request successful: " + response .getBody ());
4241 } else {
4342 System .err .println ("Request failed with status code: " + response .getStatusCode ());
4443 }
44+
4545 }
4646}
0 commit comments