SOAP

# > Public Section (English) > Developer's Guide > SOAP

Description

Each PK instance has SOAP access point. E.g. http://www.projectkaiser.com/online/soap?wsdl

By default SOAP access is disabled for all users. To enable it for a particular user administrator should set "SOAP Enabled" option in user profile.

Java Examples

Connect and prepare auth scheme
        PKApiLocator l = new PKApiLocator();
        l.setPKApiSoapEndpointAddress("http://" + HOST + ":8080/pk/soap");
        
        PKApiSoap api = l.getPKApiSoap();
        
        PlainAuthScheme pas = new PlainAuthScheme();
        pas.setPassword("q");
        pas.setUserName("User1");
Create 'My Issues' folder
        /*
         * Create "My Issues" folder inside given project
         */

        //Id of project we will use
        Long projectId = PROJECT_ID;

        ModificationRequest mr = new ModificationRequest();
        mr.setScheme(pas);
        mr.setParentId(projectId);

        //Modification request can have one or more operations
        Operation op = new Operation();
        ClientId id = new ClientId();
        id.setClientId("id1");
        op.setId(id);
        op.setTarget("com.triniforce.server.plugins.kernel.files.FTIssues");
        MapOfObjectByStringValue fName = new MapOfObjectByStringValue();
        fName.setKey("name");
        fName.setValue("Project Issues");
        MapOfObjectByStringValue fDescr = new MapOfObjectByStringValue();
        fDescr.setKey("descr");
        fDescr.setValue("This is a folder for issues");
        op.setProps(new MapOfObjectByStringValue[]{fName, fDescr});
        mr.setOps(new Operation[]{op});
        
        ModificationResponse mres = api.doModification(mr);
        
        //now get resulting id
        MapOfLongByStringValue resId = mres.getIdMap()[0];
        System.out.println("key=" + resId.getKey()+ " value=" + resId.getValue());
Find 'My Issues' folder and insert some issues there
        /*
         * Find "My Issues" folder and insert an issue "First issue" there
         */
        Long issuesId;
        {
            CollectionViewRequest cvr = new CollectionViewRequest();
            cvr.setScheme(pas);
            
            cvr.setTarget("com.triniforce.server.plugins.kernel.files.FTIssues");
            cvr.setParentId(PROJECT_ID);
            cvr.setColumns(new String[]{"name", "id"});

            //where name="Project Issues"
            {
                MapOfObjectByStringValue whereName = new MapOfObjectByStringValue();
                whereName.setKey("name");
                whereName.setValue("Project Issues");
                cvr.setWhere(new MapOfObjectByStringValue[]{whereName});
            }
            LongListResponse llr = api.doCollectionView(cvr);
            
            //only one item must exist
            assertTrue(llr.getValues().length == 2);
            System.out.println(Arrays.toString(llr.getValues()));
            issuesId = (Long) llr.getValues()[1];
        }

        final int SEVERITY_LOW = 150;
        final int SEVERITY_NORMAL = 500;
        final int SEVERITY_HIGH = 800;
        final int SEVERITY_BLOCKER = 950;

        //create Issue1 there
        {
            
            ModificationRequest mr = new ModificationRequest();
            mr.setScheme(pas);
            mr.setParentId(issuesId);

            //Modification request can have one or more operations
            Operation op = new Operation();
            ClientId id = new ClientId();
            id.setClientId("id1");
            op.setId(id);
            op.setTarget("com.triniforce.server.plugins.kernel.files.FTIssue");
            MapOfObjectByStringValue fName = new MapOfObjectByStringValue();
            fName.setKey("name");
            fName.setValue("Issue1");
            MapOfObjectByStringValue fDescr = new MapOfObjectByStringValue();
            fDescr.setKey("descr");
            fDescr.setValue("This is issue1");
            op.setProps(new MapOfObjectByStringValue[]{fName, fDescr});
            mr.setOps(new Operation[]{op});
            
            api.doModification(mr);
        }
        
        //create urgent issue
        {
            
            ModificationRequest mr = new ModificationRequest();
            mr.setScheme(pas);
            mr.setParentId(issuesId);

            //Modification request can have one or more operations
            Operation op = new Operation();
            ClientId id = new ClientId();
            id.setClientId("id1");
            op.setId(id);
            op.setTarget("com.triniforce.server.plugins.kernel.files.FTIssue");
            
            //name
            
            MapOfObjectByStringValue fName = new MapOfObjectByStringValue();
            fName.setKey("name");
            fName.setValue("Urgent Issue!!!");
            
            
            //descr
            
            MapOfObjectByStringValue fDescr = new MapOfObjectByStringValue();
            fDescr.setKey("descr");
            fDescr.setValue("Please do it as fast as possible!");
            
            //severity
            
            MapOfObjectByStringValue fSeverity = new MapOfObjectByStringValue();
            fSeverity.setKey("severity");
            fSeverity.setValue(SEVERITY_HIGH);
            
            op.setProps(new MapOfObjectByStringValue[]{fName, fDescr, fSeverity});
            mr.setOps(new Operation[]{op});
            
            api.doModification(mr);
        }
Copyright(c) Triniforce 2006-2018
Created: maxim.ge 8/21/12 8:22 AM; Modified: maxim.ge 8/22/12 7:26 AM
This is print-friendly version of "SOAP".
Powered by Project Kaiser - Project management and issue tracking software
User:Guest