So i have been trying to work with what you recommended me today. And I think 
I can connect to the fedora server now. Not exactly sure..

Nonetheless, I am getting the following error when I try to ingest a file

"nested exception is:   java.net.ConnectException: Connection refused: connect"

here is the code that I am using.
/////////////////////////////////////////////////////
                String baseURL = "http://127.0.0.1:8080/"; + 
Constants.FEDORA_DEFAULT_APP_CONTEXT;
               
                FedoraClient fc = new FedoraClient(baseURL, "fedoraAdmin", 
"fedoraAdmin");
                FedoraAPIM apim  = fc.getAPIM();

                //apim.
                FileInputStream inStream=null;
                String ingestPID=null;

                File ingestFile=new 
File("c:/fedora/client/demo/soapclient/TestIngestFiles/sdef_test_27.xml");
                try {
                    inStream=new FileInputStream(ingestFile);
                } catch (IOException ioe) {
                        out.println("Error on ingest file inputstream: " + 
ioe.getMessage());
                        ioe.printStackTrace();
                }
                
                byte[] b3=getBytesFromFile(ingestFile);
                
                ingestPID = apim.ingest(b3, 
"info:fedora/fedora-system:def/foxml#", "ingest of test sdef");
                out.println("Finished test ingest of sdef object: " + 
ingestPID);
//////////////////////////////////////////////////////


 
Thanks for all your help so far, truly appreciate it!


 Nilesh

-----Original Message-----
From: Steve Bayliss <[email protected]>
To: [email protected]; [email protected]
Sent: Fri, Apr 23, 2010 11:53 am
Subject: RE: [Fedora-commons-developers] Cant access API-M


Hi Nilesh
 
You need to use the fedora client admin jar (you will find this under the 
client directory in your Fedora installation), and use the class 
fedora.client.FedoraClient (now org.fcrepo.client.FedoraClient in the trunk) to 
get the APIM.
 
You might take a look at the client/demo/soapclient/DemoSOAPClient.java for 
some examples (though there are some known issues with this demo, the code will 
still provide you with some guidance).
 
You may find it easier to use the REST API - see 
http://www.fedora-commons.org/confluence/display/FCR30/REST+API
 
Regards
Steve
 
  
  
-----Original Message-----
From:   [email protected] [mailto:[email protected]] 
Sent: 23 April 2010   16:37
To: [email protected];   
[email protected]
Subject: Re:   [Fedora-commons-developers] Cant access API-M


  
So here are the   exact details I have.

The actual error I get is the following   "The server sent HTTP status code 
302: Moved Temporarily"

The following is the   source code I am using to try to connect to API-M. I am 
still new to JSP   programming so the following approach to accessing the web 
service maybe wrong   and I would love your input on the proper way of 
accessing the   service.
/////////////////////////////////////////////////////////////////////////////////////////////
try   { // Call Web Service   Operation
                  info.fedora.definitions._1._0.api.FedoraAPIMService service = 
new   info.fedora.definitions._1._0.api.FedoraAPIMService();
                  String test =   service.getWSDLDocumentLocation().toString();
                  info.fedora.definitions._1._0.api.FedoraAPIM port =   
service.getFedoraAPIMServiceHTTPPort();
                  //out.write(port.);
                  
                  info.fedora.definitions._1._0.types.Export exprt = new   
info.fedora.definitions._1._0.types.Export();


                  // TODO initialize WS operation arguments   here
                  java.lang.String pid =   "fedora-system:ContentModel-3.0";
                  java.lang.String dsid =   "DC";
                  Date asOf = new   Date();
                  asOf.setDate(13);
                  asOf.setMonth(3);
                  asOf.setYear(2010);


                  // TODO process result   here

                  info.fedora.definitions._1._0.types.Datastream result =   
port.getDatastream(pid, dsid,   asOf.toGMTString());
                  out.println("Result =   "+result.toString());
              } catch (Exception ex)   {
                  // TODO handle custom exceptions   here
                  out.println(ex.getMessage());
              }

  
//////////////////////////////////////////////////////////////////////////////////////////////////////////

  
  


  
Nothing in fedora   log that shows any error. 

Nilesh

  
-----Original   Message-----
From: Steve Bayliss   <[email protected]>
To: [email protected];   [email protected]
Sent: Fri, Apr 23, 2010   5:36 am
Subject: RE: [Fedora-commons-developers] Cant access API-M

  
  
Hi   Nilesh
  
 
  
Is   there anything in the Tomcat or Fedora logs that gives more information on 
  this?
  
 
  
How   are you trying to connect to API-M?  What software/libraries etc are you  
 using?
  
 
  
Regards
  
Steve
  
    
    
-----Original Message-----
From: [email protected]     [mailto:[email protected]]     
Sent: 23 April 2010 01:35
To: [email protected]
Subject:     [Fedora-commons-developers] Cant access API-M


    


    
So currently I am trying to connect     to API-M on my local fedora server 
through JSP. But I cannot figure out how     to get it to work. The API-M is 
loaded, the port is provided, but when I     actually try to obtain anything 
from the API-M service I get the error "The     server sent HTTP status code 
302: Moved Temporarily" which doesn't really     help me at all.

I initially thought that maybe this was a problem     with SSL, and it still 
maybe, but I tried to change settings around in     tomcat added keystores and 
truststore. But no luck so far. Any ideas on what     I need to do.

BTW, to access API-M shouldn't I have to provide     username and password or 
something to connect to the service, or no.     

Sincerely,
Nilesh Tailor
IPL     Developer
    



 
------------------------------------------------------------------------------
_______________________________________________
Fedora-commons-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fedora-commons-developers

Reply via email to