Skip to content
DataMiner Dojo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Updates & Insights
  • Questions
  • Learning
    • E-learning Courses
    • Tutorials
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • YouTube Videos
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Agility
      • Learn more about Agile
        • Agile Webspace
        • Everything Agile
          • The Agile Manifesto
          • Best Practices
          • Retro Recipes
        • Methodologies
          • The Scrum Framework
          • Kanban
          • Extreme Programming
        • Roles
          • The Product Owner
          • The Agile Coach
          • The Quality & UX Coach (QX)
      • Book your Agile Fundamentals training
      • Book you Kanban workshop
    • >> Go to DataMiner Docs
  • DevOps
    • About the DevOps Program
    • Sign up for the DevOps Program
    • DataMiner DevOps Support
    • Feature Suggestions
  • Downloads
  • Swag Shop
  • PARTNERS
    • Business Partners
    • Technology Partners
  • Contact
    • Sales, Training & Certification
    • DataMiner Support
    • Global Feedback Survey
  • >> Go to dataminer.services

To Handle Timeout Exception when response and Status Code is null or empty

41 views11 hours ago
2
divya selvakani42 11 hours ago 0 Comments

Hi All,

I have a QAction to handle the http response through a StatusCode Parameter. I have to check the trigger with the interval of 60 seconds during Success or failure.

The issue is during failure like Timeout error the StatusCode is null and the response content is also null  So it is not calling the QAction(1002) and LastFailedPollingTime parameter is set to a default value of -1 and the logic of 60 seconds interval is failing so the Polling is happening every second. What would be the right approach to handle the exception in this case.

Any suggestion would be helpful.

Thanks in advance.

<QAction id="1002" name="Process Directory Status HTTP Response" encoding="csharp" triggers="1010">
<Condition>
<![CDATA[id:1010 != -1]]>
</Condition>
</QAction>

<Param id="1010" trending="false">
<Name>GetDirectoryStatus_Response_StatusCode</Name>
<Description>Get Directory Status- Response - Status Code</Description>
<Type>read</Type>
<Information>
</Information>
<Interprete>
<RawType>other</RawType>
<Type>string</Type>
<LengthType>next param</LengthType>
</Interprete>
<Alarm>
<Monitored>true</Monitored>
<Normal>200 OK</Normal>
</Alarm>
<Display>
<RTDisplay>true</RTDisplay>
<Positions>
<Position>
<Page>Configuration</Page>
<Column>1</Column>
<Row>2</Row>
</Position>
</Positions>
</Display>
<Measurement>
<Type>string</Type>
</Measurement>
</Param>
<Param id="1011" trending="false">
<Name>GetDirectoryStatus_Response_Content</Name>
<Description>Get Directory Status- Response - Content</Description>
<Type>read</Type>
<Information>
</Information>
<Interprete>
<RawType>other</RawType>
<Type>string</Type>
<LengthType>next param</LengthType>
<DefaultValue>-1</DefaultValue>
<Exceptions>
<Exception id="1" value="-1">
<Display state="disabled">N/A</Display>
<Value>-1</Value>
</Exception>
</Exceptions>
</Interprete>
<Display>
<RTDisplay>false</RTDisplay>
</Display>
<Measurement>
<Type>string</Type>
</Measurement>
</Param>

<HTTP>
<Session id="1001" name="Get Directory Status">
<Connection id="1001" name="Get Directory Status" timeout="10000">
<Request verb="GET" url="/directory/getDirectoryState">
</Request>
<Response statusCode="1010">
<Content pid="1011" />
</Response>
</Connection>
</Session>
</HTTP>

QAction1002

public static class QAction
{
/// <summary>
/// The QAction entry point.
/// </summary>
/// <param name="protocol">Link with SLProtocol process.</param>
public static void Run(SLProtocolExt protocol)
{
var triggerParameter = protocol.GetTriggerParameter();
try
{
protocol.Log("triggerParameter" + triggerParameter);
var sStatusCode = protocol.Getdirectorystatus_response_statuscode_1010.ToStr();
var sResponseContent = protocol.Getdirectorystatus_response_content_1011.ToStr();

protocol.Log("sResponseContent" + sResponseContent);
protocol.Log("Status Code" + sStatusCode);

// FIXED: Always update failed polling time on error conditions
if (sResponseContent.IsNullOrEmpty() || sResponseContent == "-1")
{
protocol.Log("QA" + protocol.QActionID + "|" + triggerParameter + "|Run|Response was Null or Empty!", LogType.Error, LogLevel.NoLogging);
protocol.Getdirectorystatus_response_lastfailedpollingtime = DateTime.Now; // ADDED
return;
}

if (sStatusCode.Contains("200 OK"))
{
var oGetDirectoryStatusResponse = JsonConvert.DeserializeObject<GetDirectoryStatusResponse>(sResponseContent);

if (oGetDirectoryStatusResponse != null && oGetDirectoryStatusResponse.Services != null)
{
oGetDirectoryStatusResponse.SaveBusbyServicesData(protocol);
}

protocol.Getdirectorystatus_response_lastsuccessfulpollingtime = DateTime.Now;
}
else
{
protocol.Getdirectorystatus_response_lastfailedpollingtime = DateTime.Now;
protocol.Log($"QA{protocol.QActionID}|{triggerParameter}|HTTP Error: {sStatusCode}", LogType.Error, LogLevel.NoLogging);
}

protocol.Getdirectorystatus_response_content_1011 = -1;
protocol.Getdirectorystatus_response_content_display_1014 = sResponseContent;
}
catch (Exception ex)
{
// FIXED: Update failed polling time on exception
protocol.Getdirectorystatus_response_lastfailedpollingtime = DateTime.Now; // ADDED
protocol.Log("QA" + protocol.QActionID + "|" + triggerParameter + "|Run|Exception thrown:" + Environment.NewLine + ex, LogType.Error, LogLevel.NoLogging);
}
}
}

Tom Waterbley [SLC] [DevOps Enabler] Answered question 11 hours ago

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
0
Tom Waterbley [SLC] [DevOps Enabler]9.94K Posted 11 hours ago 0 Comments

Hi Divya,

You can solve this by using an “after group” trigger that runs whenever the group containing the HTTP request finishes executing. This trigger fires regardless of whether the HTTP request succeeds or fails.

Inside your QAction, you can then evaluate the response content and status code parameters to determine the outcome and handle it accordingly.

Tom Waterbley [SLC] [DevOps Enabler] Answered question 11 hours ago
Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas
Privacy Policy • Terms & Conditions • Contact

© 2026 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs

[ Placeholder content for popup link ] WordPress Download Manager - Best Download Management Plugin