3 Replies Latest reply: Jul 9, 2013 4:47 AM by Bharath Umesh RSS

    UCM 11G Web services - GenericSoapService : problem in check in file using

    916668
      Hi All,

      I am using oracle UCM 11g to store PDF Files and need to write web Sercie client to retrieve and check in files in to the UCM.

      In oracle UCM 10g , There is a WSDL Generator approach which is still backward compatible in 11g . using checkin.wsdl, Search.wsdl and Dockinfo.wsdl , I am able to to checkin and search files in UCM sucessfully.

      But as you know WSDL Generator is officially not supported in oracle UCM 11g , we should go to GenericSoapService of 11g .

      Using GenericSoapService of 11g , I am able run GET_FILE, GET_SEARCH_RESULTS and DOC_INFO IdcService But CHECKIN_UNIVERSAL is not working .

      I dont know how to set parameters correctly and no where specified in Oracle 11g UCM Documentaion.

      Not able to checkin File : using GenericSoapService of Oracle UCM

      1)     Using Soap Client Request and Response Message

      A) Soap Message:

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ucm="http://www.oracle.com/UCM">
      <soapenv:Header/>
      <soapenv:Body>
      <ucm:GenericRequest webKey="cs">
      <ucm:Service IdcService="CHECKIN_UNIVERSAL">
      <ucm:Document>
      <ucm:Field name="dDocName">asdfa</ucm:Field>
      <ucm:Field name="dUser">anonymous</ucm:Field>
      <ucm:Field name="dDocTitle">sumitdocTitle</ucm:Field>
      <ucm:Field name="dDocType">Document</ucm:Field>
      <ucm:Field name="dDocAuthor">weblogic</ucm:Field>
      <ucm:Field name="dSecurityGroup">Public</ucm:Field>
      <ucm:Field name="dDocAccount"/>
      <ucm:File name="pro33.pdf" href="c://temp/test8.pdf">
      <ucm:Contents>cid:787913155499</ucm:Contents>
      </ucm:File>
      </ucm:Document>
      </ucm:Service>
      </ucm:GenericRequest>
      </soapenv:Body>

      B)Soap Response :

      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
      <S:Body>
      <GenericResponse xmlns="http://www.oracle.com/UCM">
      <Service IdcService="CHECKIN_UNIVERSAL">
      <Document>
      <Field name="StatusCode">-20</Field>
      <Field name="IdcService">CHECKIN_UNIVERSAL</Field>
      <Field name="dSecurityGroup">Public</Field>
      <Field name="pro33.pdf">c://temp/test8.pdf</Field>
      <Field name="dDocType">Document</Field>
      <Field name="dDocTitle">sumitdocTitle</Field>
      <Field name="dUser">anonymous</Field>
      <Field name="blDateFormat">M/d{yy}{ h:mm[:ss]{ a}}!mAM,PM!tAsia/Calcutta</Field>
      <Field name="response">&lt;?hda version="11gR1-11.1.1.5.0-idcprod1-110413T184243" jcharset=UTF8 encoding=utf-8?>
      @Properties LocalData
      StatusCode=-20
      IdcService=CHECKIN_UNIVERSAL
      dSecurityGroup=Public
      pro33.pdf=c://temp/test8.pdf
      dDocType=Document
      dDocTitle=sumitdocTitle
      dUser=anonymous
      blDateFormat=M/d{yy}{ h:mm[:ss]{ a}}!mAM,PM!tAsia/Calcutta
      refreshMonikers=
      refreshSubMonikers=
      blFieldTypes=xForceFolderSecurity text,xPartitionId text,dInDate date,xReadOnly text,xInstitute_name text,dSubscriptionNotifyDate date,dMessage message,xInhibitUpdate text,dCreateDate date,xWebFlag text,dSubscriptionCreateDate date,xHidden text,dReleaseDate date,StatusMessage message,dSubscriptionUsedDate date,xCollectionID int,xStorageRule text,dOutDate date,xExternalDataSet bigtext,xComments memo,xIdcProfile text
      changedMonikers=
      dDocAccount=
      dDocAuthor=weblogic
      dDocName=asdfa
      idcToken=
      StatusMessage=_Content item 'asdfa' was not successfully checked in. System needs login authentication credentials._
      localizedForResponse=1
      pro33.pdf:path=D:/ORACLE~1/USER_P~1/domains/BIFOUN~1/ucm/cs/vault/~temp/1879558782.pdf
      @end
      @ResultSet UserAttribInfo
      2
      dUserName
      AttributeInfo
      anonymous
      account,#none,15,role,guest,15
      @end</Field>
      <Field name="refreshMonikers"/>
      <Field name="refreshSubMonikers"/>
      <Field name="blFieldTypes">xForceFolderSecurity text,xPartitionId text,dInDate date,xReadOnly text,xInstitute_name text,dSubscriptionNotifyDate date,dMessage message,xInhibitUpdate text,dCreateDate date,xWebFlag text,dSubscriptionCreateDate date,xHidden text,dReleaseDate date,StatusMessage message,dSubscriptionUsedDate date,xCollectionID int,xStorageRule text,dOutDate date,xExternalDataSet bigtext,xComments memo,xIdcProfile text</Field>
      <Field name="dDocAuthor">weblogic</Field>
      <Field name="dDocAccount"/>
      <Field name="changedMonikers"/>
      <Field name="StatusMessage">Content item 'asdfa' was not successfully checked in. System needs login authentication credentials.</Field>
      <Field name="idcToken"/>
      <Field name="dDocName">asdfa</Field>
      <Field name="localizedForResponse">1</Field>
      <Field name="pro33.pdf:path">D:/ORACLE~1/USER_P~1/domains/BIFOUN~1/ucm/cs/vault/~temp/1879558782.pdf</Field>
      <ResultSet name="UserAttribInfo">
      <Row>
      <Field name="dUserName">anonymous</Field>
      <Field name="AttributeInfo">account,#none,15,role,guest,15</Field>
      </Row>
      </ResultSet>
      </Document>
      </Service>
      </GenericResponse>
      </S:Body>
      </S:Envelope>

      2)     Using Code :

      A) I have created the JAX-WS annotation based web service client stub classes in Jdeveloper using bellow WSDL http://192.168.109.68:16200/idcws/GenericSoapPort?wsdl

      B)     Bellow stub classes generated

      C)     GenericSoapPortType.java ,GenericSoapService.java, GenericSoapPortClient.java,
      Service.java,Row.java,ResultSet.java,OptionList.java,ObjectFactory.java,Generic.java,File.java,Field.java,Container

      D)     Code of GenericSoapPortClient.java
      public static void main(String[] args) {
      try {
      genericSoapService = new GenericSoapService();
      GenericSoapPortType genericSoapPortType =
      genericSoapService.getGenericSoapPort();

      Map<String, Object> requestContext =
      ((BindingProvider)genericSoapPortType).getRequestContext();

      //Service.Document document = new Service.Document(field,resultSet1,optionList,file);
      String idcService = "CHECKIN_UNIVERSAL";

      //Service service = new Service(user, document, idcService);
      Service service = new Service();
      service.setIdcService(idcService);


      Field field1 = new Field();
      field1.setName("dDocName");
      field1.setValue("asdfa");

      Field field2 = new Field();
      field2.setName("dDocTitle");
      field2.setValue("sumitdocTitle");

      Field field3 = new Field();
      field3.setName("dDocType");
      field3.setValue("Document");

      Field field4 = new Field();
      field4.setName("dDocAuthor");
      field4.setValue("weblogic");

      Field field5 = new Field();
      field5.setName("dSecurityGroup");
      field5.setValue("Public");

      Field field6 = new Field();
      field6.setName("dDocAccount");
      field6.setValue("");

      Field field7 = new Field();
      field7.setName("primaryFile");
      field7.setValue("C:\temp\test8.pdf");

      Service.Document document = new Service.Document();
      service.setDocument(document);
      service.getDocument().getField().add(field1);
      service.getDocument().getField().add(field2);
      service.getDocument().getField().add(field3);
      service.getDocument().getField().add(field4);
      service.getDocument().getField().add(field5);
      service.getDocument().getField().add(field6);


      // //For file

      // Reading from temp file: this is java io classes file
      java.io.File f1 = new java.io.File("C:\\temp\\test8.pdf");
      java.io.InputStream in = new java.io.FileInputStream(f1);

      byte[] bytes = new byte[100000];
      in.read(bytes);

      // creating datahandler
      DataSource dataSource =
      new ByteArrayDataSource(bytes, "application/pdf");
      DataHandler dataHandler = new DataHandler(dataSource);

      // testing if datahandler is correctly created : using datahandler able to create bellow file
      FileOutputStream fio = new FileOutputStream("C:\\temp\\asdfa.pdf");
      dataHandler.writeTo(fio);
      fio.close();

      File file = new File();
      file.setName("file1.pdf");
      file.setContents(dataHandler);
      file.setHref("C:\\temp\\test100.pdf");

      // now setting the file to be checked in
      service.getDocument().getFile().add(file);
      // for file
      //
      Generic genericRequest = new Generic();
      genericRequest.setWebKey("cs");

      genericRequest.setService(service);

      Generic gen1 =
      genericSoapPortType.genericSoapOperation(genericRequest);
      System.out.println("hi");

      List<Field> filedIterator =
      gen1.getService().getDocument().getField();
      for (Field f : filedIterator) {
      if (f.getName().equalsIgnoreCase("StatusMessage"))
      System.out.println("status message" + f.getValue());

      }
      System.out.println("hi");
      gen1.getService().getDocument().getField();


      // setPortCredentialProviderList(requestContext);

      // Add your code to call the desired methods.

      } catch (Exception ex) {
      ex.printStackTrace();
      }
      }

      E)     Output of above code :

      hi
      status messageContent item 'asdfa' was not successfully checked in. System needs login authentication credentials._
      hi
      Process exited with exit code 0.

      My Queires :
      Please help me in setting the genericRequest for CHECKIN_UNIVERSAL.
      How to set file and fields in the Document.
      How to set User in service.

      For your help see bellow :

      public class Service {

      @XmlElement(name = "User")
      protected Container user;
      @XmlElement(name = "Document")
      protected Service.Document document;
      @XmlAttribute(name = "IdcService")
      @XmlSchemaType(name = "anySimpleType")
      protected String idcService;
      }

      a)     I have set IdcService , “Document” in the Generic Request but I don’t know how to set “User”.
      b)     Is it necessary for to set user for CHECKIN_UNIVERSAL ?
      c)     I am able to run sevices : - DOC_INFO,GET_SEARCH_RESUILTS AND GET_FILE without setting the “User” in the service. Bellow you can see the soap client request for DOC_INFO which is working fine.

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ucm="http://www.oracle.com/UCM">
      <soapenv:Header/>
      <soapenv:Body>
      <ucm:GenericRequest webKey="cs">
      <ucm:Service IdcService="DOC_INFO">
      <!--Optional:-->
      <!--Optional:-->
      <ucm:Document>
      <ucm:Field name="dID">1</ucm:Field>
      <!--Zero or more repetitions:-->
      </ucm:Document>
      </ucm:Service>
      </ucm:GenericRequest>
      </soapenv:Body>
      </soapenv:Envelope>

      Please help me in setting the genericRequest for CHECKIN_UNIVERSAL.
      How to set file and fields in the Document.
      How to set User in service.