UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21. Read more.
UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21.Read more.
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class
1826 views

SiS Support Tip: Custom Web Service monitor

If for some reason regular Web Service monitor is having issues interacting with a WSDL a possible workaround would be to simply POST the SOAP request via (XML) to make the Web Service call. Due to URL monitor limitation of plain text POST only it is not feasible to accomplish Web Service monitoring in that way. Best chance to implement monitoring is via a custom monitor. One may build a complex AXIS Java Web Service client in code, but Java security issues may arise when trying to set the custom monitor to use it.

An easier implementation is afore mentioned one, XML request via POST. Find attached the Data Processing Script for a custom Web Service monitor using this method.  In this example I’m making a SOAP request to SiS public API “getHostMap” method. The result of the call is a list of remote machines that are defined on SiteScope.

The monitor also gets HTTP status from server, gets the SOAP response and performs a content match as regular Web Service monitor. In the example I'm matching "Server.*WMI" regex from response.

 

Notice to get same status as in WS monitor you need to define following thresholds for script's counters:

 

 

By storing the whole SOAP response in a counter you also get a way to send it in an alert, which currently is only possible to do with a content match that matches everything in a regular Web Service monitor. To find out the correct tag for this counter to use it in alert templates open the .dyn file that contains the monitor in SiteScope/groups and find the counter index that holds the SOAP. In my case is the third counter:

 

counterValue3=<?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><ns1:getHostsMapResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://configuration.api.sitescope.mercury.com"><getHostsMapReturn href="#id0"/></ns1:getHostsMapResponse><multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Map" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://xml.apache.org/xml-soap"><item><key xsi:type="soapenc:string">Server localhost WMI</key><value href="#id1"/></item></multiRef><multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:Map" xmlns:ns3="http://xml.apache.org/xml-soap" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><item><key xsi:type="soapenc:string">TotalMonitorReferences</key><value xsi:type="soapenc:string">0</value></item></multiRef></soapenv:Body></soapenv:Envelope>

 

 

Then use following syntax in the alert template:  <counterValue3>

Kenneth Gonzalez
HP Support

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.

If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums
Labels (2)
25 Replies
Lieutenant
Lieutenant

what is the correct syntax to also post data in the header

0 Likes
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Hi Mike,

Not sure what do you mean by "also post data in the header". The request header is built on this block:

connection.setRequestMethod("POST");
connection.setRequestProperty("Host", url.getHost()+":"+url.getPort());
connection.setRequestProperty("SOAPAction", "");
connection.setRequestProperty("Connection","keep-alive");
connection.setRequestProperty("User-Agent", "Apache-HttpClient/4.1.1 (java 1.5)");
connection.setRequestProperty("Content-Type", "text/xml;charset=UTF-8");

You can use other keywords, refer to URL Connection Java doc: http://docs.oracle.com/javase/7/docs/api/java/net/URLConnection.html

Then I POST the data in here:

var writer = new DataOutputStream(connection.getOutputStream());
writer.writeBytes(xml);
writer.flush();
writer.close();

Kenneth Gonzalez
HP Support

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.

If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums
Lieutenant
Lieutenant

in a regular URL monitor type in sitescope this is data i would put in the Request Headers field as opposed to the Post Data filed (the xml goes in the post data field).  I don't know what method to use to set the string so that is it passed in the header.  I have the monitor working except for that - and i know it is not getting that in the header because of the error it is giving me - bacsically the site won't let you have access unless you pass this "key" in the header.  It looks like this

 

XAPPCERT: a,b,c - where those are 3 values that have to be passed - an app id, a date, and one other piece of data.

 

0 Likes
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Mike,

I have tested posting xml content type in regular URL monitor even in 11.23 and it will not allow to overwrite that part in header, it always post as text, are you sure it is not failing because of that?
Kenneth Gonzalez
HP Support

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.

If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums
0 Likes
Vice Admiral
Vice Admiral

Hi Kenneth

 

I am new to this concept. I just pasted the script which you attached in this conversation and I am trying to check the output. But I am getting the error. Please find the attached snapshot for error details.

 

Kindly guide me.

 

Thanks

Selvaganesh E

0 Likes
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Hi,

 

Make sure you enabled permissions to allow custom monitors to connect to network:

 

 

Kenneth Gonzalez
HP Support

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.

If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums
0 Likes
Vice Admiral
Vice Admiral

Hello Kenneth

 

Thanks for your assistance. I have tried with the WSDL URL to get the SOAP response but what I noticed in Countervalue3 is the entire XML information.  When I am executing the tool for webservice monitor, I am getting the below information for SOAP response:

 

(RESPONSE)

 

HTTP/1.1 200 OK Set-Cookie: LBSESSION=R2377015641; path=/ Content-Type: text/xml; charset=UTF-8 Content-Language: en-US Transfer-Encoding: chunked Date: Tue, 25 Mar 2014 21:09:45 GMT Server: WebSphere Application Server/6.1

 

<?xml version='1.0' encoding='UTF-8'?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><monitorResponse xmlns="myMappingServices" /></soap:Body></soap:Envelope>

 

What I want to see is the response XML output in a variable that we can put into the event details. Is it possible to do this through the script? Please share your thoughts.

 

Thanks

Selvaganesh E

 

 

0 Likes
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Hi,

Script is only capturing the actual SOAP response (the actual xml), do you mean you want to capture the HTTP headers too like in the tool? Header is this part:

HTTP/1.1 200 OK Set-Cookie: LBSESSION=R2377015641; path=/ Content-Type: text/xml; charset=UTF-8 Content-Language: en-US Transfer-Encoding: chunked Date: Tue, 25 Mar 2014 21:09:45 GMT Server: WebSphere Application Server/6.1

Kenneth Gonzalez
HP Support

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.

If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums
0 Likes
Vice Admiral
Vice Admiral

Hello Kenneth

 

Thanks for your quick reply. I am using the URL: http://192.xxx.xxx.xxx:19082/mappingservice/services/MappingService?wsdl in the data processing script and below are the result I am getting in the countervalue3:

 

<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://common.mapping.eacs.harland.com" xmlns:ns2="http://exceptions.collective.harland.com" xmlns:ns3="http://monitor.collective.harland.com" xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding" xmlns:tns="myMappingServices" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="myMappingServices">  <wsdl:types>    <xsd:schema targetNamespace="http://common.mapping.eacs.harland.com" elementFormDefault="qualified" attributeFormDefault="qualified">      <xsd:complexType name="ArrayOfDataProperties">        <xsd:sequence>          <xsd:element name="DataProperties" type="ns1:DataProperties" nillable="true" minOccurs="0" maxOccurs="unbounded" />        </xsd:sequence>      </xsd:complexType>      <xsd:complexType name="DataProperties">        <xsd:sequence>          <xsd:element name="name" type="xsd:string" minOccurs="0" nillable="true" />          <xsd:element name="value" type="xsd:string" minOccurs="0" nillable="true" />        </xsd:sequence>      </xsd:complexType>    </xsd:schema>    <xsd:schema targetNamespace="myMappingServices" elementFormDefault="qualified" attributeFormDefault="qualified">      <xsd:element name="performAllMappingOperations">        <xsd:complexType>          <xsd:sequence>            <xsd:element name="customerNumber" type="xsd:string" nillable="true" minOccurs="1" maxOccurs="1" />            <xsd:element name="channelType" type="xsd:string" nillable="true" minOccurs="1" maxOccurs="1" />            <xsd:element name="props" type="ns1:ArrayOfDataProperties" nillable="true" minOccurs="1" maxOccurs="1" />          </xsd:sequence>        </xsd:complexType>      </xsd:element>      <xsd:element name="performAllMappingOperationsResponse">        <xsd:complexType>          <xsd:sequence>            <xsd:element name="out" type="ns1:ArrayOfDataProperties" nillable="true" minOccurs="1" maxOccurs="1" />          </xsd:sequence>        </xsd:complexType>      </xsd:element>      <xsd:element name="CORBAApplicationException" type="ns2:CORBAApplicationException" />      <xsd:element name="monitor">        <xsd:complexType />      </xsd:element>      <xsd:element name="monitorResponse">        <xsd:complexType />      </xsd:element>      <xsd:element name="MonitorException" type="ns3:MonitorException" />      <xsd:element name="flush">        <xsd:complexType />      </xsd:element>      <xsd:element name="flushResponse">        <xsd:complexType />      </xsd:element>    </xsd:schema>    <xsd:schema targetNamespace="http://exceptions.collective.harland.com" elementFormDefault="qualified" attributeFormDefault="qualified">      <xsd:complexType name="CORBAApplicationException">        <xsd:sequence>          <xsd:element name="origination" type="xsd:string" minOccurs="0" nillable="true" />          <xsd:element name="type" type="xsd:string" minOccurs="0" nillable="true" />          <xsd:element name="code" type="xsd:long" minOccurs="0" />          <xsd:element name="severity" type="xsd:string" minOccurs="0" nillable="true" />          <xsd:element name="message" type="xsd:string" minOccurs="0" nillable="true" />        </xsd:sequence>      </xsd:complexType>    </xsd:schema>    <xsd:schema targetNamespace="http://monitor.collective.harland.com" elementFormDefault="qualified" attributeFormDefault="qualified">      <xsd:complexType name="MonitorException">        <xsd:sequence>          <xsd:element name="origination" type="xsd:string" minOccurs="0" nillable="true" />          <xsd:element name="message" type="xsd:string" minOccurs="0" nillable="true" />          <xsd:element name="type" type="xsd:string" minOccurs="0" nillable="true" />        </xsd:sequence>      </xsd:complexType>    </xsd:schema>  </wsdl:types>  <wsdl:message name="MonitorException">    <wsdl:part element="tns:MonitorException" name="MonitorException" />  </wsdl:message>  <wsdl:message name="CORBAApplicationException">    <wsdl:part element="tns:CORBAApplicationException" name="CORBAApplicationException" />  </wsdl:message>  <wsdl:message name="monitorResponse">    <wsdl:part element="tns:monitorResponse" name="parameters" />  </wsdl:message>  <wsdl:message name="performAllMappingOperationsRequest">    <wsdl:part element="tns:performAllMappingOperations" name="parameters" />  </wsdl:message>  <wsdl:message name="flushRequest">    <wsdl:part element="tns:flush" name="parameters" />  </wsdl:message>  <wsdl:message name="monitorRequest">    <wsdl:part element="tns:monitor" name="parameters" />  </wsdl:message>  <wsdl:message name="flushResponse">    <wsdl:part element="tns:flushResponse" name="parameters" />  </wsdl:message>  <wsdl:message name="performAllMappingOperationsResponse">    <wsdl:part element="tns:performAllMappingOperationsResponse" name="parameters" />  </wsdl:message>  <wsdl:portType name="MappingServicePortType">    <wsdl:operation name="performAllMappingOperations">      <wsdl:input message="tns:performAllMappingOperationsRequest" name="performAllMappingOperationsRequest" />      <wsdl:output message="tns:performAllMappingOperationsResponse" name="performAllMappingOperationsResponse" />      <wsdl:fault message="tns:CORBAApplicationException" name="CORBAApplicationException" />    </wsdl:operation>    <wsdl:operation name="monitor">      <wsdl:input message="tns:monitorRequest" name="monitorRequest" />      <wsdl:output message="tns:monitorResponse" name="monitorResponse" />      <wsdl:fault message="tns:MonitorException" name="MonitorException" />    </wsdl:operation>    <wsdl:operation name="flush">      <wsdl:input message="tns:flushRequest" name="flushRequest" />      <wsdl:output message="tns:flushResponse" name="flushResponse" />    </wsdl:operation>  </wsdl:portType>  <wsdl:binding name="MappingServiceHttpBinding" type="tns:MappingServicePortType">    <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />    <wsdl:operation name="performAllMappingOperations">      <wsdlsoap:operation soapAction="" />      <wsdl:input name="performAllMappingOperationsRequest">        <wsdlsoap:body use="literal" />      </wsdl:input>      <wsdl:output name="performAllMappingOperationsResponse">        <wsdlsoap:body use="literal" />      </wsdl:output>      <wsdl:fault name="CORBAApplicationException">        <wsdlsoap:fault name="CORBAApplicationException" use="literal" />      </wsdl:fault>    </wsdl:operation>    <wsdl:operation name="monitor">      <wsdlsoap:operation soapAction="" />      <wsdl:input name="monitorRequest">        <wsdlsoap:body use="literal" />      </wsdl:input>      <wsdl:output name="monitorResponse">        <wsdlsoap:body use="literal" />      </wsdl:output>      <wsdl:fault name="MonitorException">        <wsdlsoap:fault name="MonitorException" use="literal" />      </wsdl:fault>    </wsdl:operation>    <wsdl:operation name="flush">      <wsdlsoap:operation soapAction="" />      <wsdl:input name="flushRequest">        <wsdlsoap:body use="literal" />      </wsdl:input>      <wsdl:output name="flushResponse">        <wsdlsoap:body use="literal" />      </wsdl:output>    </wsdl:operation>  </wsdl:binding>  <wsdl:service name="MappingService">    <wsdl:port binding="tns:MappingServiceHttpBinding" name="MappingServiceHttpPort">      <wsdlsoap:address location="http://192.xx.xx.xx:19082/mappingservice/services/MappingService" />    </wsdl:port>  </wsdl:service></wsdl:definitions>

 

 

 

But I am expecting to get the SOAP response as below:

 

<?xml version='1.0' encoding='UTF-8'?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><monitorResponse xmlns="myMappingServices" /></soap:Body></soap:Envelope>

 

 

Thanks

Selvaganesh E

0 Likes
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Hi,

You're Posting to the WSDL URL not to the Web Service URL. Notice this monitor doesn't need the WSDL in any way as it POST a predefined SOAP request to the WS URL. Use this URL to make the correct SOAP response:

http://192.xxx.xxx.xxx:19082/mappingservice/services/MappingService

Kenneth Gonzalez
HP Support

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.

If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums
0 Likes
Vice Admiral
Vice Admiral

Thanks Kenneth.

 

I tried the URL but I noticed that its showinh "Invalid SOAP request" when I checked it in IE browser. I am checking with the corresponding team.

 

Meantimw, is it possible to use the countervalue3 value in the OMi event?

 

Thanks

Selvaganesh E

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.