I am attempting to use the built-in SOAP monitor on an LTM with 10.2.4.
I have made several attempts, but no success yet. Any help or advice would be much appreciated!
One of the biggest issues I have is how to I validate that the customer has given me a legitimate POST request and that I'm getting back the result they say I should? They claim to have verified using SOAP-UI, and tell me that this request should work but so far my pool members all fail this monitor.
Admittedly, I have very little SOAP knowledge and so I'm having trouble deconstructing the SOAP POST request the customer has provided me, with what I need to put in the fields of the monitor. Can someone help me identify what components of this request need to be included in my SOAP monitor fields and what goes where?
Here is the POST, as provided by the customer:
Here is the REPLY, as provided by the customer:
I've never had much luck with the SOAP monitor myself, but it is easy enough to do this with a standard HTTP or HTTPS monitor. A few notes on that though.
1, you have a content-length of 251 but no content. Did they give you anything that should be in the body of the POST(the POST data)? The request as shown above is not valid and will probably throw errors at a minimum because the content-length is off, and may fail because there needs to be data in the body of the post.
2, you have Connection: Keep-Alive but for the purpose of the monitor you probably want Connection: Close
That being said, this is how I do my SOAP monitors
POST http://qaesb.nscorp.com/EAS/CLEDRTest HTTP/1.1\r\nAccept-Encoding: gzip,deflate\r\nContent-Type: text/xml;charset=UTF-8\r\nSOAPAction: \"/CLEDRTest.serviceagent/CLEDRTestSOAP1/CLEDRTest\"\r\nHost: qaesb.nscorp.com\r\nUser-Agent: Apache-HttpClient/4.1.1 (java 1.5)\r\nConnection: Close\r\n\r\nYour 251 bytes of post body needs to go here\r\n
Success (or whatever you want to look for in the response indicating success)
Lastly, as for validation, it depends if it is http or https. for http you can just telnet to the server on the http port and paste in your send string. If it is https, you will need to use openssl s_client -connect : and then paste in the string. When you do it this way, you need to convert all of the \r\n to a new line, and don't forget the double \r\n\r\n is a double new line(1 new line terminate the line, and then 1 blank line between the header and the body)
Just for clarity, with the above 2 corrections
POST /EAS/CLEDRTest HTTP/1.1\r\nAccept-Encoding: gzip,deflate\r\nContent-Type: text/xml;charset=UTF-8\r\nSOAPAction: \"/CLEDRTest.serviceagent/CLEDRTestSOAP1/CLEDRTest\"\r\nContent-Length: 251\r\nHost: qaesb.nscorp.com\r\nUser-Agent: Apache-HttpClient/4.1.1 (java 1.5)\r\nConnection: Close\r\n\r\nYour 251 bytes of post body needs to go here\r\n
Thank you for your reply! I will go back and ask about content-length. So if I'm hearing you right, you recommend doing this in an HTTP monitor instead of the built-in SOAP monitor?
It is HTTP (vs HTTPS), so it sounds like that should make the validation of the reply easier. Can I put it in a cURL request to validate from the CLI?
Ok, now that you have the image up, I see your body. It is portion after the blank line at the bottom.
As one person who doesn't know much SOAP to another, yes I recommend it. Being a static request/response, I don't see a huge value in using programatic SOAP methods to craft the data. A simple HTTP monitor works just fine.
You will need to escape all of your " in the body as \" Also, the content type given to you probably includes the white space. This can get tricky, are those spaces or tabs? As a rule I get rid of all white space and just run the body all together. That will make you have to re-calculate the content-length though. There are a few ways to do this, one being just count all the characters. Remember, \" is a single character(the \ is just used for the monitor to escape the ", it is never transmitted to the client)
I will try the HTTP monitor approach and come back and let you know how it goes. Thanks again!
One more question, do I count the \r\n as characters? \r = 1 character or 2?
the content length is only the body(starting with <soapenv: until the end), not the header. I usually remove all returns and spaces from the body so I don't have to deal with it, just run it all together so you only have a return at the end.
I believe for the purpose of computing content length, \r\n is a single character.
I am still having trouble with this. I've done a tcpdump of my monitor, and I get back a HTTP 500 error. I had the customer also do a tcpdump of him doing the request from SOAP-UI, and he gets 200 OK. I'm not sure where to go next. There are some differences in the request, but I'm not sure how to make the monitor request match the one he is generating? Anyone willing to look at some tcpdumps to help me decipher this?
sure, I'll look at the tcpdump and see what I can figure out
Thank you. I'm probably missing the obvious - but is there a way to attach those tcpdumps files to this thread?
After Connection: Close there should be only 2 \r\n\r\n
Then after that you need your post body, the
Your cotent length should be the number of characters in this last body section only, not any of the characters in the header. If you could post that section as text instead of a picture, I should be able to put it all together for you
put a Tab before your text and it will format it a little better.
Try this. I don't think you can have \r\n in the body, as I believe this signifies the end of the body. I believe you need to use just \n if you really want a newline in the body. I just remove them all for simplicity though, the server won't care about the formatting.
POST /EAS/CLEDRTest HTTP/1.1\r\nAccept-Encoding: gzip,deflate\r\nContent-Type: text/xml;charset=UTF-8\r\nSOAPAction: \"/CLEDRTest.serviceagent/CLEDRTestSOAP1/CLEDRTest\"\r\nContent-Length: 239\r\nHost: qaesb.nscorp.com:40020\r\nUser-Agent: Apache-HttpClient/4.1.1 (java 1.5)\r\nConnection: Close\r\n\r\n?\r\n
Also note that removing all the newlines shortened the content-length
Thank you for your help! Unfortunately I took your string above and pasted into my monitor and I still have the same result....tcpdump shows the reply to the monitor request is a HTTP 500. Do you know how I can share the tcpdumps with you?
HTTP/1.1 505 HTTP Version Not Supported
Date: Tue, 07 Oct 2014 17:44:39 GMT
Connection closed by foreign host.'
does that server not support HTTP/1.1? You can try HTTP/1.0. Get rid of the Connection: Close portion of the header
In the packet capture of the example they gave you that works, is it 1.1 or 1.0?
The working request in the tcpdump I have - specifies 1.1 as well. That one successfully returns a 200 OK.
I did just try the same request in telnet, but changed it to 1.0. Oddly enough, I get the same error - HTTP/1.1 505 HTTP Version Not Supported.
Ok, so lets assume it is erroring on something other than the HTTP version.
I'm not sure how to attach a tcpdump here. In wireshark, you can right click on one of the packets and choose 'follow tcp stream' that will bring up a text representation of the request, hopefully allow you to compare them easily to see what is different. You can paste that in here if you want and I will look.
Thank you for all of your help today, it has been invaluable. It will likely be tomorrow morning before I have an opportunity to dive deeper into the traces. I will be back on here then and let you know what I find.
I have a working monitor! Thanks to the help of my local F5 sales engineer a resident SOAP expert within F5 that he solicited for help (John Alam). He found two errors in my SOAP message - the URI following the POST message was incorrect. He found this by comparing my monitor string to the string in the SOAP request generated by SOAP-UI from my customer. The 2nd error he identified was missing whitespace in the SOAP envelope statement, before 'xmlns:v1'. Once I fixed those 2 errors - my pool members turned green. Thanks so much for all your help, mimlo!
Would be be able to post your working string?