I have a X509 certificate (e.g. C:\Cert\BBcert.pl2) and a password (e.g. "XYZ") with which I should use to authenticate and the DLWS here https://service.bloomberg.com/assets/dl/dlws.wsdl
I can use a SOAP GUI client to connect and do some queries but how do I go about using the certificate, password and link above in powershell so I can send some queries?
If anyone has used the Bloomberg Data License Web Services and can provide a complete example how to fetch some pricing data?
Start with:
curl --cert .\BloombergDLWS.p12:MyP@$$w0rd -H "Content-Type: text/xml;charset=utf-8" -H 'SOAPAction: \"submitGetDataRequest\"' -d "@submitGetDataRequest.xml" --request-target 'https://dlws.bloomberg.com/dlps' --url 'https://dlws.bloomberg.com/dlps'
Three notes about the CURL command:
POST /dlps HTTP/1.1 instead of POST /dlps HTTP/1.1 and results in a 502 BAD GATEWAY error.Failed to convert request to BAS: Failed to find action index for SOAP action 'submitGetDataRequest' when converting SOAP request for service ID 125322ParseError even though I had copied it in carefully as one line.Where submitGetDataRequest.xml contains
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://services.bloomberg.com/datalicense/dlws/ps/20071001">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:submitGetDataRequest>
         <ns:headers>
            <ns:secmaster>true</ns:secmaster>
         </ns:headers>
         <ns:fields>
            <ns:field>NAME</ns:field>
            <ns:field>TICKER</ns:field>
            <ns:field>CPN</ns:field>
            <ns:field>MATURITY</ns:field>
            <ns:field>ID_BB_GLOBAL</ns:field>
         </ns:fields>
         <ns:instruments>
            <ns:instrument>
               <ns:id>912810CY2</ns:id>
               <ns:type>CUSIP</ns:type>
            </ns:instrument>
         </ns:instruments>
      </ns:submitGetDataRequest>
   </soapenv:Body>
</soapenv:Envelope>
This returns a response that doesn't contain the data you want, but it does include a responseId code to use in a second request.
<?xml version="1.0" encoding="UTF-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <dlws:submitGetDataResponse xmlns='http://services.bloomberg.com/datalicense/dlws/ps/20071001'
            xmlns:dlws="http://services.bloomberg.com/datalicense/dlws/ps/20071001"
            xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
            <dlws:statusCode>
                <dlws:code>0</dlws:code>
                <dlws:description>Success</dlws:description>
            </dlws:statusCode>
            <dlws:requestId>01234567-89AB-CDEF-0123-456789ABCDEF</dlws:requestId>
            <dlws:responseId>ABCDEF0123-4567890AB</dlws:responseId>
        </dlws:submitGetDataResponse>
    </soap:Body>
</soap:Envelope>
You must insert the responseId code into another request like so (saved as retrieveGetDataResponse.xml):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://services.bloomberg.com/datalicense/dlws/ps/20071001">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:retrieveGetDataRequest>
         <ns:responseId>ABCDEF0123-4567890AB</ns:responseId>
      </ns:retrieveGetDataRequest>
   </soapenv:Body>
</soapenv:Envelope>
Wait a few minutes, then submit the final request, saving your data as DataResponse.xml:
curl --cert .\BloombergDLWS.p12:MyP@$$w0rd -H "Content-Type: text/xml;charset=utf-8" -H 'SOAPAction: \"retrieveGetDataResponse\"' -d "@retrieveGetDataResponse.xml" --request-target 'https://dlws.bloomberg.com/dlps' --url 'https://dlws.bloomberg.com/dlps' -o DataResponse.xml
Submitting this request too soon will return a result that basically says it's not ready, try again later.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With