Static WSDL script include example
-
- UpdatedJan 30, 2025
- 2 minutes to read
- Yokohama
- Scripted SOAP web services
This example demonstrates the FakeStockValue script include that implements much of the static WSDL behavior.
initialize function
The initialize function takes the XML request string and converts it to an XML Document object that you can navigate and manipulate using libraries. Alternatively, you can leave the XML request as a string and navigate it using regular expressions.
process function
The process function is called by the scripted web service. This function grabs the first child element in the XML after the body element. The WSDL uses this child element to determine which function to use. In this WSDL there is only one possible function but most WSDLs provide many functions. If more functions were available, there would be more "if" statements that tested the first child element for the various function names.
fakeOutTradePriceRequest function
The fakeOutTradePriceRequest function is the implementation of the only available function in the WSDL. This function looks up the user that the SOAP request authenticated as and retrieves the user_name then returns it to the SOAP client. The fakeOutTradePriceRequest function could be expanded to perform useful activities, such as looking up a stock symbol and returning the last traded price.
generateSoapFault function
The generateSoapFault function returns a SOAP error that can be called if there are problems.