Python Websocket API Post Failure

When I use python websocket API to post market price I get an error of DeniedBySrc. The request and response are as followed:

Request:

{

"Ack":true,

"Domain":"MarketPrice",

"ID":2,

"Message":{

"Domain":"MarketPrice",

"Fields":{

"FAIR_VALUE":45.55

},

"ID":0,

"Type":"Update"

},

"PostID":3,

"PostUserInfo":{

"Address":"172.18.112.175",

"UserID":1080

},

"Type":"Post"

}


Response:

[

{

"AckID":3,

"ID":2,

"Key":{

"Name":"6YEAR_COP_SWAP=SBCM",

"Service":"DDS"

},

"NakCode":"DeniedBySrc",

"Text":"[400]: Invalid Request",

"Type":"Ack"

}

]

Please advise

Best Answer

  • wasin.w
    wasin.w admin
    Answer ✓

    Hello @lzhuang1

    Those error messages are generate from TREP/DDS server. The DDS server uses the legacy SSL connection (Source Sink Library) to connect to TREP. Please be informed that the DDS server was already end of life and no longer supported. It has been replaced with the ATS (Advanced Transformation System) server which connects with TREP via a strategic RSSL connection.

    I have tested your example code and post message to post data to my ATS server and it works fine. It can post data to my ATS successfully.

    I suggest you enable the enable the Elektron Java API trace and contribute data. Then we can compare the Elektron Post message and WebSocket Post message as my colleague suggest above.




Answers

  • Hi @lzhuang1

    Please see my existing post on a similar error message and confirm if my answer applies to your situation i.e. are you trying to use On-Stream posting for an item you are not currently consuming and do not have Open stream with ID:2


  • Umer, I have login and send the market price request and then post the market price in the on-stream connection, login and market price request response are below:

    [

    {

    "Domain":"Login",

    "Elements":{

    "MaxMsgSize":61430,

    "PingTimeout":30

    },

    "ID":1,

    "Key":{

    "Elements":{

    "AllowSuspectData":1,

    "ApplicationId":"beacon",

    "ApplicationName":"ADS",

    "Position":"172.18.112.175",

    "ProvidePermissionExpressions":1,

    "ProvidePermissionProfile":0,

    "SingleOpen":1,

    "SupportBatchRequests":7,

    "SupportEnhancedSymbolList":1,

    "SupportOMMPost":1,

    "SupportOptimizedPauseResume":0,

    "SupportPauseResume":0,

    "SupportStandby":0,

    "SupportViewRequests":1

    },

    "Name":"beacon"

    },

    "State":{

    "Data":"Ok",

    "Stream":"Open",

    "Text":"Login accepted by host njads1."

    },

    "Type":"Refresh"

    }

    ]

  • [

    {

    "Fields":{

    "DSPLY_NAME":"6YEAR_COP_SWAP=S",

    "FAIR_VALUE":0.0468957156,

    "RDNDISPLAY":67,

    "RECORDTYPE":209,

    "TIMACT":"12:48:37.133",

    "TRADE_DATE":"2019-09-18"

    },

    "ID":2,

    "Key":{

    "Name":"6YEAR_COP_SWAP=SBCM",

    "Service":"DDS"

    },

    "Qos":{

    "Rate":"TickByTick",

    "Timeliness":"Realtime"

    },

    "State":{

    "Data":"Ok",

    "Stream":"Open",

    "Text":"Item Refresh Completed\u0000"

    },

    "Type":"Refresh"

    }

    ]

  • Umer, any updates? I just upload my code, please check outMarketPricePublishing.txt

  • Hello @lzhuang1

    Based on my research:

    • [400]: Invalid Request: The format is incorrect so the contribution cannot be processed.
    • DeniedBySrc : the source being posted to has denied accepting this post message. The source may not support the post message

    What is the component that you are trying to post data to? Is it DDS or ATS server? How your TREP connect to to it (RSSL or SSL connection)? Can you contribute data to that server with other API?

  • Hi Wasin, I am trying to post the below data for '6YEAR_COP_SWAP=SBCM'. It is DDS server. How can I know how TREP connect to? We can contribute data the the server with ELEKTRON API with Java (the lower-level api which need encode and decode message ourselves)

    {

    "Ack":true,

    "Domain":"MarketPrice",

    "ID":2,

    "Message":{

    "Domain":"MarketPrice",

    "Fields":{

    "FAIR_VALUE":45.55

    },

    "ID":0,

    "Type":"Update"

    },

    "PostID":3,

    "PostUserInfo":{

    "Address":"172.18.112.175",

    "UserID":1080

    },

    "Type":"Post"

    }

  • BTW Wasin, is there any request which is equivalent to directory request in the Elektron API

  • Hi @lzhuang1

    One thing to try is to enable the trace on the Java Elektron API code and contribute data. We can then compare the accepted Elektron Post message with your rejected Websocket Post message.

    In terms of Directory request using Elektron Message API Java - see example example331__Directory__Streaming

    In that example, if you don't specify a name when registering for MMT_DIRECTORY, then you will receive a full Directory response. If you do specify a servicename, you will only receive Directory information for that service(assuming it exists).

  • Hello @lzhuang1

    Do you have a chance to enable the RSSL trace file on the Elektron Java API to compare the OMM Post message?