For a deeper look into our DataScope Select REST API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
1 0 0 1

How to call dss soap api in java with credentials header in soap header?

Hi, here's some context before I start to ask my question

Java version: 17

Gradle version: 8.0

Plugin used to generate stub: https://github.com/yupzip/wsdl2java

WSDL file I am referring to: https://selectapi.datascope.refinitiv.com/DataScopeApi/v1/ExtractionService.asmx?WSDL


Currently I am trying to call ValidateInstruments soap api, and I believe I have to provide the credential in the soap header but I don't know where can I set the credential header, below are the ValidateInstruments web method generated by the wsdl2java plugin

1687247149391.png


The InstrumentValidationRequest object:

1687247205124.png


Please help me with this, thanks in advance.

#technology#productjavacredentialsdss-soap-api
1687247149391.png (66.7 KiB)
1687247205124.png (38.4 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
82.7k 279 53 77

@kks102613

I can use Apache CFX 2.X to generate classes for DSS SOAPI API.

1687313466835.png

It uses WSDL2Java to generate Java classes. I need to check "Enable processing of implicit SOAP headers" (-exsh true).

1687313505221.png

However, I need to modify the OperationInfoHeader.Duration property in OperationInfoHeader.java to String.

public class OperationInfoHeader {


    @XmlElement(name = "Host")
    protected String host;
    @XmlElement(name = "EjvServer")
    protected String ejvServer;
    @XmlElement(name = "ProcessingTime", required = true)
    protected String processingTime;
    @XmlAnyAttribute
    private Map<QName, String> otherAttributes = new HashMap<QName, String>();
...
...
    public String getProcessingTime() {
        return processingTime;
    }


    /**
     * Sets the value of the processingTime property.
     * 
     * @param value
     *     allowed object is
     *     {@link Duration }
     *     
     */
    public void setProcessingTime(Duration value) {
        this.processingTime = "";
    }
..
}

The example code is in the ExtractionService_ExtractionService_Client.java file. It looks like this:

        ExtractionService_Service ss = new ExtractionService_Service(wsdlURL, SERVICE_NAME);
        ExtractionService port = ss.getExtractionService();


        {
        System.out.println("Invoking getGovCorpCurrencyTypes...");
        com.datascope.select.extractionservice.v1.CredentialsHeader _getGovCorpCurrencyTypes_credentialsHeaderVal = new com.datascope.select.extractionservice.v1.CredentialsHeader();
        _getGovCorpCurrencyTypes_credentialsHeaderVal.setUsername("DSS User");
        _getGovCorpCurrencyTypes_credentialsHeaderVal.setPassword("DSS Password");
        _getGovCorpCurrencyTypes_credentialsHeaderVal.setAuthenticationToken("");
        jakarta.xml.ws.Holder<com.datascope.select.extractionservice.v1.CredentialsHeader> _getGovCorpCurrencyTypes_credentialsHeader = new jakarta.xml.ws.Holder<com.datascope.select.extractionservice.v1.CredentialsHeader>(_getGovCorpCurrencyTypes_credentialsHeaderVal);
        com.datascope.select.extractionservice.v1.EjvServerHeader _getGovCorpCurrencyTypes_ejvServerHeader = new com.datascope.select.extractionservice.v1.EjvServerHeader();
        _getGovCorpCurrencyTypes_ejvServerHeader.setServer("Server-33758018");
        jakarta.xml.ws.Holder<com.datascope.select.extractionservice.v1.OperationInfoHeader> _getGovCorpCurrencyTypes_operationInfoHeader = new jakarta.xml.ws.Holder<com.datascope.select.extractionservice.v1.OperationInfoHeader>();
        com.datascope.select.extractionservice.v1.ArrayOfValueInfo _getGovCorpCurrencyTypes__return = port.getGovCorpCurrencyTypes(_getGovCorpCurrencyTypes_credentialsHeader, _getGovCorpCurrencyTypes_ejvServerHeader, _getGovCorpCurrencyTypes_operationInfoHeader);
        System.out.println("getGovCorpCurrencyTypes.result=" + _getGovCorpCurrencyTypes__return);


        System.out.println("getGovCorpCurrencyTypes._getGovCorpCurrencyTypes_credentialsHeader=" + _getGovCorpCurrencyTypes_credentialsHeader.value);
        System.out.println("getGovCorpCurrencyTypes._getGovCorpCurrencyTypes_operationInfoHeader=" + _getGovCorpCurrencyTypes_operationInfoHeader.value);


        }



1687313466835.png (58.9 KiB)
1687313505221.png (60.7 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
82.7k 279 53 77

@kks102613

Thanks for reaching out to us.

DataScope Select - SOAP API is deprecated. We recommend using the Refinitiv DataScope Select - REST API instead.

You can refer to the DSS REST API tutorials and Java Code Examples.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi @Jirapongse, thanks for your response, I know it is deprecated, but I have to use soap api due to some reason, could you provide an example on calling dss soap api using java? Your help is much appreciated.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.