Forum Discussion

Adriano_Bezerr1's avatar
Feb 15, 2020
Solved

HTTP Post SOAP XML monitor with data

I need to set up an HTTP POST monitor that makes a call via SOAP XML, sends some data and I will handle the result, doing the test with CURL works 100%, however, when I configure the HTTP monitor or test using "echo -ne", the header with the data is not forwarded at all.

 

I'm using version 14.1.2.3

1) Below the test via CURL successfully:

 

curl -X POST "http://10..10.10.10:9080/aaa/services/ARService?server=mlt3ho0700&webService=MonitorarServico" -H 'Content-Type: text/xml; charset=UTF-8' -H 'SOAPAction: urn:MonitorarServico/monitorarServico' -d '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:MonitorarServico"><soapenv:Body><urn:monitorarServico><urn:tipoOperacao>monitorarServico</urn:tipoOperacao><urn:nomeServidor>mlt3ho0740</urn:nomeServidor><urn:portaAplicacao>9080</urn:portaAplicacao><urn:nomeUsuario>TEST</urn:nomeUsuario></urn:monitorarServico></soapenv:Body></soapenv:Envelope>'

 

Answer OK

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns0:monitorarServicoResponse xmlns:ns0="urn:MonitorarServico" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <ns0:codRetorno>0</ns0:codRetorno>

  <ns0:msgRetorno>UP</ns0:msgRetorno>

</ns0:monitorarServicoResponse></soapenv:Body></soapenv:Envelope>

 

2) Test when configuring the HTTP monitor or using echo -ne

(echo -ne "POST http://10.10.10.10:9080/arsys/services/ARService?server=mlt3ho0700&webService=MonitorarService \r\n HTTP/1.1\r\nContent-Type: text/xml;charset=utf-8\r\nSOAPAction: urn:MonitorarServico/monitorarServico\r\n\r\n<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"xmlns:urn=\"urn:MonitorarServico\"><soapenv:Body><urn:monitorarServico><urn:tipoOperacao>monitorarServico</urn:tipoOperacao><urn:nomeServidor>mlt3ho0740</urn:nomeServidor><urn:portaAplicacao>9080</urn:portaAplicacao><urn:nomeUsuario>TEST</urn:nomeUsuario></urn:monitorarServico></soapenv:Body></soapenv:Envelope>\r\n"; cat) | nc 10.80.41.92 9080

 

Answer NOT OK

 

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server.userException</faultcode><faultstring>org.xml.sax.SAXParseException; Premature end of file.</faultstring><detail><ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">mlt3ho0740</ns1:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>

 

Ncat: Broken pipe.

 

Has anyone ever needed to do something in this direction that can help me?

 

I tried to do a test using JSON and faced the same problem, in this case, example I used the BIG-IP itself.

  • Try using HTTP monitor with these parameters:

    SendString:

    POST /aaa/services/ARService?server=mlt3ho0700&webService=MonitorarServico" HTTP/1.1\r\nHost: BIGIP\r\nConnection: close\r\nContent-Length: 386\r\nContent-Type: text/xml; charset=UTF-8\n\rSOAPAction: urn:MonitorarServico/monitorarServico\r\n\r\n\<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:MonitorarServico\"><soapenv:Body><urn:monitorarServico><urn:tipoOperacao>monitorarServico</urn:tipoOperacao><urn:nomeServidor>mlt3ho0740</urn:nomeServidor><urn:portaAplicacao>9080</urn:portaAplicacao><urn:nomeUsuario>TEST</urn:nomeUsuario></urn:monitorarServico></soapenv:Body></soapenv:Envelope>

    Receive String:

    <ns0:msgRetorno>UP</ns0:msgRetorno>

    AngeloV

2 Replies

  • Try using HTTP monitor with these parameters:

    SendString:

    POST /aaa/services/ARService?server=mlt3ho0700&webService=MonitorarServico" HTTP/1.1\r\nHost: BIGIP\r\nConnection: close\r\nContent-Length: 386\r\nContent-Type: text/xml; charset=UTF-8\n\rSOAPAction: urn:MonitorarServico/monitorarServico\r\n\r\n\<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:MonitorarServico\"><soapenv:Body><urn:monitorarServico><urn:tipoOperacao>monitorarServico</urn:tipoOperacao><urn:nomeServidor>mlt3ho0740</urn:nomeServidor><urn:portaAplicacao>9080</urn:portaAplicacao><urn:nomeUsuario>TEST</urn:nomeUsuario></urn:monitorarServico></soapenv:Body></soapenv:Envelope>

    Receive String:

    <ns0:msgRetorno>UP</ns0:msgRetorno>

    AngeloV

    • Adriano_Bezerr1's avatar
      Adriano_Bezerr1
      Icon for Cirrus rankCirrus

      Hi Angelo, after your suggestion I managed to adjust the monitor configuration, I still needed to make some adjustments.

       

      I´d a tcpdump after running CURL and got the whole header and set up the POST in the same sequence and it worked.

       

      See how it looks:

      POST /aaa/services/ARService?server=mlt3ho0700&webService=MonitorarServico HTTP/1.1\r\nHost: 10.10.10.10:9080\r\nUser-Agent: curl/7.47.1\r\nAccept: */*\r\nContent-Type: text/xml; charset=UTF-8\r\nSOAPAction: urn:MonitorarServico/monitorarServico\r\nContent-Length: 386\r\n\r\n<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:MonitorarServico\"><soapenv:Body><urn:monitorarServico><urn:tipoOperacao>monitorarServico</urn:tipoOperacao><urn:nomeServidor>mlt3ho0740</urn:nomeServidor><urn:portaAplicacao>9080</urn:portaAplicacao><urn:nomeUsuario>TEST</urn:nomeUsuario></urn:monitorarServico></soapenv:Body></soapenv:Envelope>

       

      Thanks for your help