Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bl-jeremy
Contributor II
Contributor II

Check the Session Collaboration button through soap request

Hi all !

 

I'm trying to have the 'Session Collaboration' checkbox active through a soap request.

I've generated java code from the wsdl, and now I'm searching how to check this case.

 

I've already tried the following without success:

QMSClient.DocumentTask().getServer().getAccess().setEnableSessionCollaboration(true)

 

Does someone have a solution?

Thanks in advance

Labels (2)
1 Solution

Accepted Solutions
Damien_Villaret
Support
Support

Ok, now I understand why the other settings were working. I misunderstood that it was a name  for the task.

Collaboration is in the Server section, so you would need: 

<ns5:Scope xmlns:ns5="http://schemas.datacontract.org/2004/07/PIX.QMSAPI.DataObjects">General Reload Reduce Triggering Server</ns5:Scope>

 

If the issue is solved please mark the answer with Accept as Solution.

View solution in original post

33 Replies
Damien_Villaret
Support
Support

Hello,

You would need to use the QMS API endpoint "SaveQVSSettings"

Please see:

https://support.qlik.com/articles/000085901

https://help.qlik.com/en-US/qlikview-developer/April2019/APIs/QMS+API/html/M_PIX_Services_V12_Api2_I...

 

If the issue is solved please mark the answer with Accept as Solution.
bl-jeremy
Contributor II
Contributor II
Author

I've already tried to 'AllowServerCollaboration' through SaveQVSSettings endpoint, no success

Damien_Villaret
Support
Support

It works perfectly fine in my test environment.

Could you post the code you are using to call the API ?

If the issue is solved please mark the answer with Accept as Solution.
bl-jeremy
Contributor II
Contributor II
Author

On my call to setQVSSettings, I do the following:

...
var
documents = new QMSBackendServiceStub.QVSSettingsQVSDocuments();
var server = new QMSBackendServiceStub.QVSSettingsQVSDocumentsQVSDocumentsServer();
server.setAllowSessionCollaboration(true);
documents.setServer(server);
qvsSettings.setDocuments(documents);

qmsClient.saveQVSSettings(qvsSettings);

And when creating my documentTask:

 

...
var
server = new QMSBackendServiceStub.DocumentTaskTaskServer();
var access = new QMSBackendServiceStub.DocumentTaskTaskServerTaskServerAccess();
access.setEnableSessionCollaboration(true);
server.setAccess(access);
documentTask.setServer(server);

//Create task
qmsClient.saveDocumentTask(documentTask);
Brett_Bleess
Former Employee
Former Employee

You are generating a service key at the beginning of things, may be a dumb question, but did not want to assume anything here....  It would likely help if you include all the code, not just the snippet.

https://help.qlik.com/en-US/qlikview-developer/April2019/APIs/QMS+API/html/2be1e405-a7e5-4a43-b1b6-9...

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
bl-jeremy
Contributor II
Contributor II
Author

Here's the code you asked for (I narrowed it for obfuscation reasons)

import generated.qms.*;

import org.apache.axis2.AxisFault;
import org.apache.axis2.databinding.types.UnsignedInt;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.util.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.rmi.RemoteException;
import java.util.*;

@Service
public class Service {

    private final Logger logger = LoggerFactory.getLogger(Service.class);

    public Service() {
    }

    public void executeQlik() {
        createQlikTasks("PRODUCT_NAME", "PASSWORD");
    }

    private void createQlikTasks(String productName, String pwd) throws Exception {

        setQVSSettings(productName);

        String taskDescription = "Creating a task " + productName + " via QMS API";
        String documentNameTemplateLd = "%SourceDocumentName%";
		createDocumentTasksForProduct(productName, taskDescription, documentNameTemplateLd, pwd);
    }
	
    private void setQVSSettings(String productName) throws Exception {
        QMSClient qmsClient = new QMSClient();

		java.lang.String timeLimitedServiceKey = this.getTimeLimitedServiceKey(new QMSBackendServiceStub.GetTimeLimitedServiceKeyE()).getGetTimeLimitedServiceKeyResult();
        List<NamedValue> namedValuePairs = new ArrayList<>();
        namedValuePairs.add(new NamedValue("X-Service-Key", timeLimitedServiceKey));
        qmsClient._serviceClient.getOptions().setProperty(HTTPConstants.HTTP_HEADERS, namedValuePairs);
		

        QMSBackendServiceStub.ServiceInfo[] serviceInfo = qmsClient.getServices(QMSBackendServiceStub.ServiceTypes_type0.QlikViewServer);

        QMSBackendServiceStub.QVSSettings qvsSettings = qmsClient.getQVSSettings(serviceInfo[0].getID(), QMSBackendServiceStub.QVSSettingsScope_type0.Folders);

        QMSBackendServiceStub.QVSMount[] qvsMounts = qvsSettings.getFolders().getUserDocumentMounts().getQVSMount();

        var mountFolderPath = "MOUNTED_PATH";
        
        QMSBackendServiceStub.QVSMount newQvsMount = new QMSClient.QVSMount(true, mountFolderPath, productName);

        qvsSettings.getFolders().getUserDocumentMounts().addQVSMount(newQvsMount);
		ezfz

        var documents = new QMSBackendServiceStub.QVSSettingsQVSDocuments();
        var server = new QMSBackendServiceStub.QVSSettingsQVSDocumentsQVSDocumentsServer();
        server.setAllowSessionCollaboration(true);
        documents.setServer(server);
        qvsSettings.setDocuments(documents);

        qmsClient.saveQVSSettings(qvsSettings);

        logger.debug("New mount folder {} created", mountFolderPath);
    }
	
    private void createDocumentTasksForProduct(String productName, String taskDescription, String documentNameTemplateLd, String password) throws Exception {
        String docName = productName + ".qvw";
        String taskName = productName + ".qvw";

        setDocumentTaskLoad(docName2, taskName, "", taskDescription, productName, "None", documentNameTemplateLd, password);
    }


    private void setDocumentTaskLoad(String docName,
                                     String taskName,
                                     String taskParentName,
                                     String taskDescription,
                                     String productName,
                                     String typeDistribute,
                                     String documentNameTemplate,
                                     String password)
            throws Exception {
        logger.debug("Adding task {}", taskName);
				
		QMSClient qmsClient = new QMSClient();

        java.lang.String timeLimitedServiceKey = this.getTimeLimitedServiceKey(new QMSBackendServiceStub.GetTimeLimitedServiceKeyE()).getGetTimeLimitedServiceKeyResult();
        List<NamedValue> namedValuePairs = new ArrayList<>();
        namedValuePairs.add(new NamedValue("X-Service-Key", timeLimitedServiceKey));
        qmsClient._serviceClient.getOptions().setProperty(HTTPConstants.HTTP_HEADERS, namedValuePairs);

        QMSBackendServiceStub.ServiceInfo[] serviceInfo = qmsClient.getServices(QMSBackendServiceStub.ServiceTypes_type0.QlikViewDistributionService);
        QMSBackendServiceStub.Guid qdsGuid = serviceInfo[0].getID();

        QMSBackendServiceStub.TaskInfo[] taskInfo = qmsClient.getTasks(qdsGuid);

        QMSClient.DocumentTask documentTask = new QMSClient.DocumentTask();
        documentTask.setQDSID(qdsGuid);
        documentTask.setGeneral(new QMSClient.DocumentTaskTaskGeneral(true, taskName, taskDescription));

        QMSBackendServiceStub.DocumentNode[] sourceDocuments = qmsClient.getSourceDocuments(qdsGuid);
        QMSBackendServiceStub.DocumentNode documentNode = Arrays.stream(sourceDocuments).findFirst().orElseThrow();
        documentTask.setDocument(documentNode);

        documentTask.setReload(new QMSBackendServiceStub.DocumentTaskTaskReload());
        documentTask.getReload().setMode(QMSBackendServiceStub.TaskReloadMode.Full);

        if (docName.equals(productName + ".qvw")) {
            documentTask.getReload().setSectionAccessMode(QMSBackendServiceStub.QDSSectionAccessMode.SpecifyCredentials);
            documentTask.getReload().setSectionAccessUserName("");
            documentTask.getReload().setSectionAccessPassword("");
        }

        documentTask.setScope(QMSBackendServiceStub.DocumentTaskScope_type0.General,
                QMSBackendServiceStub.DocumentTaskScope_type0.Reload,
                QMSBackendServiceStub.DocumentTaskScope_type0.Reduce,
                QMSBackendServiceStub.DocumentTaskScope_type0.Triggering);

        var server = new QMSBackendServiceStub.DocumentTaskTaskServer();
        var access = new QMSBackendServiceStub.DocumentTaskTaskServerTaskServerAccess();
        access.setEnableSessionCollaboration(true);
        server.setAccess(access);
        documentTask.setServer(server);

        //Create task
        qmsClient.saveDocumentTask(documentTask);

        logger.debug("Task {} added", taskName);
    }
}
Brett_Bleess
Former Employee
Former Employee

@Damien_Villaret  Any chance you can have another look at this one?  Jeremy, I am not very good with the code side of things, if Damien cannot have a look, I will try to see if I can find someone else to check it out for you, but it may take a few days.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
bl-jeremy
Contributor II
Contributor II
Author

Thank you !

Damien_Villaret
Support
Support

Does it return a specific error when you run the code ? It may guide us to the actual problem.

 

Otherwise, I will need to debug the code in my environment, I will have time to do that on Thursday.

Meanwhile , you could also debug it yourself and compare with the PowerShell example sent. If you use wireshark, you will see exactly how does the soap request sent looks like and that will show if there is anything wrong inside the request.

If the issue is solved please mark the answer with Accept as Solution.