Ver Mensaje Individual
  #1  
Antiguo 14-12-2006
Avatar de sakuragi
sakuragi sakuragi is offline
Miembro
 
Registrado: feb 2004
Ubicación: root
Posts: 1.435
Reputación: 22
sakuragi Va por buen camino
Question 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.
__________________
OpenSuse OpenOffice.org icomputo
Responder Con Cita