Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Codigo java a delphi, comparativa de codigos, funciones, metodos,sentencias..etc (https://www.clubdelphi.com/foros/showthread.php?t=38442)

sakuragi 14-12-2006 19:50:56

Codigo java a delphi, comparativa de codigos, funciones, metodos,sentencias..etc
 
HOla que tal.

quisiera probar un codigo hecho en java sobre una cosulta para el AWS de amazon, para probarlo en delphi.

ahora como no se mucho de java, eh estado tratando de hayas las comparativas al codigo.

el codigo java es:
[java]
public classItemSearchSample {

/**
* Main - API demo
* @param args
*/
public static void main ( String [] args ) {
  • try {
    • AWSECommerceService locator = new AWSECommerceServiceLocator();
      AWSECommerceServicePortType service = locator.getAWSECommerceServicePort();

      ItemSearch itemSearch = new ItemSearch();



      ItemSearchRequest request = new ItemSearchRequest();

      itemSearch.setSubscriptionId ( "0525E2PQ81DD7ZTWTK82" );


      request.setSearchIndex ( "Books" );
      request.setTitle ( "IBM+and+the+Holocaust" );


      // Setup request
      itemSearch.setRequest ( new ItemSearchRequest [] { request } );

      // Get the response
      ItemSearchResponse response = service.itemSearch ( itemSearch );
      if ( response == null )
      • throw new Exception ( "Server Error - no response recieved!" );
      Items [] itemsArray = response.getItems();

      // Check for errors, stop at first error
      if ( itemsArray == null )
      • throw new Exception ( "Server Error - empty response!" );
      if ( itemsArray[0].getRequest().getErrors() != null )
      • throw new Exception ( itemsArray [0].getRequest().getErrors().getError()[0].getMessage() );
    } catch ( Exception ex ) {
    • System.out.println( ex.toString() );
    }
} }
[/java]

ahora lo que llevo en delphi es esto:
Código Delphi [-]
var
  service:AWSECommerceServicePorttype;
  request:ItemSearchRequest;
  search:itemsearch;
  response:ItemSearchResponse;
begin
    service:=(httprio1 as AWSECommerceServicePorttype);
    search:=itemsearch.Create;
    request:=ItemSearchRequest.Create;
    search.SubscriptionId:='0525E2PQ81DD7ZTWTK82';
    request.SearchIndex:='Book';
    request.Title:='Ibm and the holocaust';
    Search.Request:=request;

alguien sabe como pasar la ultimas lineas?

saludos
gracias.


La franja horaria es GMT +2. Ahora son las 16:24:53.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi