Erik Hoffmann
posted this on November 03, 2009 21:15
Here is some information on the use of webservices I have attached two webservice source files which can be put in your \webservice directory, e.g c:\program files\mirror42\webservice Create the directory webservice if it does not exist. Test its presence with http://localhost/m42/webservice/StockQuote.asmx Automatic metrics which get their values from webservices can be defined in the metric data source area like Webservice: http://localhost/m42/webservice/StockQuote.asmx Webservice Params: IBM Webservice XPath: /value/StockQuotes/Stock/Last XPath is a language for finding information in an XML document. XPath is used to navigate through elements and attributes in an XML document. For XPath examples refer to http://www.w3schools.com/xpath/xpath_syntax.asp Or search Google for "xpath" Example output of this webservice: ORCL 11.71 6/10/2004 4:00pm 0.00 N/A N/A N/A 0 60.833B 11.71 0.00% 10.85 - 15.51 0.48 24.40 ORACLE CORP Examples web service http://www.random.org/cgi-bin/Random.cgi parameters XPath /value // Gets the latest stock quote, e.g. from IBM web service http://localhost/m42/webservice/StockQuote.asmx parameters IBM XPath /value/StockQuotes/Stock/Last // Says "hello" in several languages, e.g. in French web service http://lepago.homeip.net:80/HelloLangJB4EAR/HelloLangJB4EJB/HelloLa... parameters french XPath /value // Get a random quote web service http://www.boyzoid.com/comp/randomQuote.cfc parameters false XPath /value // Get random number web service: http://localhost/m42/webservice/RandomValues.asmx parameters 10100 XPath /value Development information: Building a webservice in .NET Add the following line before the definition of the web service class: [SoapDocumentService(RoutingStyle=SoapServiceRoutingStyle.RequestElement)] This means that the SOAPAction HTTP header can be "" or even "BilboBaggins" and the server will locate the correct method by looking at the HTTP Request-URI (based on the first child element following the XML element of the SOAP message), rather than the SoapAction HTTP header to route the request to the correct method.