FileNet P8 CE API (4.5.1) Data type com.filenet.api.core.Document is not a conforming value

Hey Gang!

I am trying to write a web service with a Generic FileNet P8 (CE 4.5.1) sample code, getting below error when I attempt to save the WebService from Domino 8.5.2 Environment, code is added after the error:

ERROR:

Data type com.filenet.api.core.Document is not a conforming value type or enumeration and has no registered XSD type mapping; it cannot be successfully handled at runtime

+++++++++++++++++++++++++++++++++++>>

I am still new to FileNet and Domino, not sure what it means or how to remove that error.

CODE:

import com.filenet.api.core.Connection;

import java.io.*;

import java.util.Iterator;

import javax.security.auth.Subject;

import com.filenet.api.core.*;

import com.filenet.api.util.UserContext;

import com.filenet.api.collection.*;

import com.filenet.api.query.*;

public class CESampleSearch {

  public static void main(String[] args) {



        try {



              CESampleSearch p8 = new CESampleSearch();



              // Log on to the P8 Content Engine



              ObjectStore store = p8.getP8Connection();



              // Search for documents



              DocumentSet documents = p8.searchDocuments(store);



              // Iterate through results set (documents) to retrieve each document



              Iterator it = documents.iterator();



              while (it.hasNext()) {



                    // Get the document item



                    Document document = (Document) it.next();



                    // Get document metadata attributes







                    // Retrieve the document



                    String fileName = p8.getDocumentContent(document);



                    // View the document using Explorer



                    p8.viewDocument(fileName);



              }



        } catch (Exception e) {



              e.printStackTrace();



        }



  }







  public ObjectStore getP8Connection() {



        // The connection URI includes the transport protocol (connection type),



        // host name, and port number that are used for server communication



        // Note these are the default P8 configuration parameters



        //DIME has been deprecated, must use TOM



        //2011.11.12.05.2.05.PM



        //String uri = "http://MyServer:MyPortNum/wsi/FNCEWS40DIME/";



        String uri = "http://MyServer:MyPortNum/wsi/FNCEWS40MTOM/";



        // Set the user id and password for authentication



        String username = "ADMIN";



        String password = "ADMIN";



        // Get the connection



        Connection conn = Factory.Connection.getConnection(uri);



        // The next 3 lines authenticate with the application server using the



        // JAAS API



        Subject subject = UserContext.createSubject(conn, username, password,



                    null);



        UserContext uc = UserContext.get();



        uc.pushSubject(subject);



        // Retrieve the specific Domain Object DevDomain



        Domain domain = Factory.Domain.fetchInstance(conn, "DevDomain",



                    null);



        System.out.println("Domain Name is: " + domain.get_Name());



        // Get the specific object store MyPilotFolder



        ObjectStore store = Factory.ObjectStore.fetchInstance(domain,



                    "MyPilotFolder", null);



        System.out.println("Objectstore is: " + store.get_Name());



        // Return the Object Store



        return store;



  }







  public DocumentSet searchDocuments(ObjectStore os) {



        // Instantiate a search scope to search our object store



        SearchScope search = new SearchScope(os);



        // Instantiate an SQL object to hold our search criteria



        SearchSQL sql = new SearchSQL();



        // When searching, retrieve certain document



        sql



                    .setSelectList("DOC_TYP, DocNumber, NUMDR,ContentElements");



        // Search for all documents



        sql.setFromClauseInitialValue("Document", "d", true);



        // Search where customer number is equal to 12345



        // sql.setWhereClause("CustomerNumber='BR00777'");



        // Adding BoxNum instead



        sql.setWhereClause("SOCSEC='007007007'");



        // Perform search and create results set



        DocumentSet documents = (DocumentSet) search.fetchObjects(sql,



                    new Integer(50), null, Boolean.valueOf(true));



        // Return results set object



        return documents;



  }







  public void getDocumentMetaData(Document document) {



        // Get document metadata attributes



        System.out.println("Document type = "



                    + document.getProperties().getStringValue("DOC_TYP"));



        System.out.println("DocNumber = "



                    + document.getProperties().getStringValue("DocNumber"));



        System.out.println("NUMDR = "



                    + document.getProperties().getStringValue("NUMDR"));



  }







  public String getDocumentContent(Document document) throws Exception {



        // Initialize the output file name with the path where to store the



        // document



        String fileName = System.getProperty("user.dir") + File.separator;



        // Get the content elements



        ContentElementList contents = document.get_ContentElements();



        ContentElement content;



        Iterator<?> itContent = contents.iterator();



        // iterate on the elements to retrieve the document



        while (itContent.hasNext()) {



              content = (ContentElement) itContent.next();



              // Get the document file name



              fileName = fileName



                          + ((ContentTransfer) content).get_RetrievalName();



              System.out.println("fileName = " + fileName);



              // Get an input stream for reading document data



              InputStream inputStream = ((ContentTransfer) content)



                          .accessContentStream();



              // Get an output stream for writing document data



              OutputStream outputStream = new FileOutputStream(fileName);



              // Retrieve document content to the new file



              byte[] nextBytes = new byte[64000];



              int nBytesRead;



              while ((nBytesRead = inputStream.read(nextBytes)) != -1) {



                    outputStream.write(nextBytes, 0, nBytesRead);



                    outputStream.flush();



              }



        }



        // Return the newly created document file



        return fileName;



  }







  public void viewDocument(String fileName) throws Exception {



        // Use Explorer.exe to view the documents



        String VIEWER = "Explorer.exe ";



        Runtime rt = Runtime.getRuntime();



        // Launch the document with explorer



        String cmd = VIEWER + fileName;



        rt.exec(cmd);



  }

} // end main

Subject: Has this problem now been solved?

We are starting a similar project and I wanted to know if you’ve been able to solve your problem.Thanks in advance for your response.