Forum Discussion

Joe_Pawlicki_70's avatar
Joe_Pawlicki_70
Icon for Nimbostratus rankNimbostratus
Sep 19, 2008

XML SOAP response

I got a couple of nibbles by searching this forum, but not the whole fish...

 

 

Desired functionality: An iRule that detects when servers are down, and immediately responds to SOAP requests with an "unavailable" response, so the client doesn't spin-n-wait.

 

 

The current solution: A really ugly, lengthy irule that does some basic pattern matching and has a pretty hard-coded response format.

 

 

The problem: The client may want this response to include fields such as the requested service path, which can be in various locations within the original request. Or the requests themselves can be in multiple schema versions.

 

 

The question: Is there some general-purpose XML parser tool that can be used on the F5, to handle different format requests and compose valid format responses?

 

 

The P.S.: I am so not an XML developer.

 

 

  • There were a couple of questions in there so I'll try to address them all (let me know if I miss any).

     

     

    1 Determining availability

     

    First, to determine if no servers are available, you could code an iRule to check the value of "active_members" and if that's 0 you can custom build a response and send it with the HTTP::respond command.

     

     

    2 Extracting info from the submitted request.

     

    This can be done in a couple of ways and since I don't know the data you are extracting or it's location in the request it's hard to suggest whether regular expressions or string searches would be your best options.

     

     

    3 Is there a general purpose XML-Parser?

     

    Yes, there is the XML profile that allows for parsing of XML requests in a stream fashion. Check out the XML_* iRule events. Keep in mind that this is a request-only filter at this point and there is no way from within an iRule to craft an XML reponse with this XML parser. You'll have to custom build the string yourself and send it back with a HTTP::respond.

     

     

    -Joe
  • I can detect available members and have created the response format, so no problem there. It's the parser I was after, since I need to handle many different potential request formats. You've pointed me in the right direction, and I'm reading now. Many thanks.