CelsiusToFahrenheit Example

19 Apr '12, 09:10 PM
20,368 Views
No Forum Badges

Hello everyone,

I have been trying to reproduce the CelsiusToFahrenheit example found at this wiki page. I think I made everything as it should be, however I still cannot get the output to work. After giving an input for the Celsius value I get redirected to the home page with no result for the Fahrenheit value.

Could someone please explain how exactly the output parameter is generated and assigned to the output field? Could the reason be an error in the code of the output transformation? (both xmlns:w="http://www.webml.org/webservices" and xmlns:out="http://www.webml.org/webservices/output" links give an error 404)

Thank you very much in advance! Best Regards!

 
x 0
Follow
Answer Answer at this question and get points!
No Forum Badges

On normal conditions, the output value is computed as follows:

  1. the web service returns a result XML message,
  2. the XSLT document extract the Farenheit temperature from the result XML message,
  3. the OK LInk connection the RequestResponse Unit to the Entry Unit couples the XSLT output parameter holding the temperature to the Field that will show it on page.

It is possible that the web service call is somehow failing silently, causing the application to fallback to the starting page. Although not required by the wiki example, try adding the following:

  1. add an Error page with a MultiMessage Unit on it,
  2. connect the RequestResponse Unit to the MultiMessage Unit by using a KO Link,
  3. on the KO Link, couple the output error message to the input Shown Messages of the MultiMessage Unit.

By doing this, should the web service call be failing, you will be redirected to an error page with information about what problem occurred.

EDIT

If you are sure that the OK Link is indeed the one being navigated, the problem is probably in the parameters coupling on the OK Link itself.

The wiki article does not require to specify output parameters because they are automatically extracted from the XSLT file that you have to provide in order to process the web service response and extract parameters from it.

  1. First, ensure that you have an XSLT file like the one described in the wiki article placed under WebContent/WEB-INF/descr path of your Web Project. As you can see, the XSLT code contains a <out:output-param name=""Farenheit""/> node at root level: this is what the RequestResponse Unit uses to know that there will be an output parameter named Farenheit.
  2. Specify the XSLT file as value of the Output Transformation property of the RequestResponse Unit.
  3. Ensure that the Field you are going to use for showing the result has its Preloaded property checked: that means the application will be able to fill in a value automatically.
  4. Finally, edit the coupling of the OK Link: it should be possible to couple the Farenheit source parameter (inferred from the XSLT file) to the Field you have marked as Preloaded.

EDIT

In the end, the RequestResponse Unit configuration should look like this:

If there are still problems, another option is inspecting the application logs. First ensure that the log level of the generated application is set to DEBUG by following this wiki article. Next, execute the web service call and check the Runtime Log file by any of the following means:

  • by directly opening WEB-INF/log/RTX.log with a text editor;
  • in WebRatio, by using the Runtime Log View (found in Window > Show View > Other).

Whatever the option you choose, you may want to take a look at how to read logs.

EDIT

Yet another option is placing a Script Unit after the RequestResponse Unit and use it to print out the XML documents to the web server console.

  1. Add a Script Unit.
  2. Enter the following a Script Text:
    #input Document response
        #input Document output
        println ""Web Service response: "" + response.asXML()
        println ""Transformed Output: "" + output.asXML()
  3. Connect the OK Link exiting the RequestResponse Unit to the Script Unit instead; couple parameters as follows:
    • Output XML Document to output,
    • Response XML Document to response.
  4. Connect the Script Unit to the Page with another OK Link.
  5. Connect the RequestResponse Unit to the Entry Unit with a Transport Link, and use it to couple the Farenheit output value to the relevant field.

After generating the full application and attempting the web service call again, the web server console should display both the XML response received by the server and the XML computing by transforming the response using the XSLT file. On my machine, it looks like this:

Web Service response: <?xml version=""1.0"" encoding=""UTF-8""?>
<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">
  <soap:Body>
    <m:CelciusToFahrenheitResponse xmlns:m=""http://webservices.daehosting.com/temperature"">
      <m:CelciusToFahrenheitResult>33.8</m:CelciusToFahrenheitResult>
    </m:CelciusToFahrenheitResponse>
  </soap:Body>
</soap:Envelope>
Transformed Output: <?xml version=""1.0"" encoding=""UTF-8""?>
<result xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:w=""http://www.webml.org/webservices"" xmlns:out=""http://www.webml.org/webservices/output"" xmlns:m=""http://webservices.daehosting.com/temperature"">
  <out:output-param name=""Fahrenheit"" value=""33.8""/>
</result>

The Transformed Output should be a document with a root result element containing a single out:output element. The latter is what the RequestResponse Unit uses to extract the output value that is then passed along the Transport Link to the page.

   
x 2
Answer at this question and get points!

Related questions

Access wsdl in https Can not get generate and run option for DataService Project Cannot invoke method selectSingleNode() on null object Can't generate and run database or start tomcat server! com.webratio.rtx.RTXException: An error occurred dispatching the SOAP message Could not create service Custom Unit and AJAX / SOAP Description: Unknown tag 'wr:LinkResource' Exception REST Post request Exposing SOAP Web SERVICE on port different from 80 Generation options problem Getting started with Web Services How can I invoke a Rest Web Service having dynamic parameters? How to change smtp port invoke rest web service that returns a pdf invoking a webservice using REST java.lang.NullPointerException No cloud accounts available No database on my cloud account Parameters order in a webservice request Problema generando la logica de un proyecto Problemas al invocar webservice Properties of the XSD Resource (File) Publish a web service publish web service for storing information in PostgreSQL DB following XSD Resource Sync DataService Project with Mobile Project usuarios y grupos WebRatio and MySQL WebRatio Mobile Platform Community edition - Restful request WebService DateTime value is not parsed to Date. Web service provider newline problem web service request using XSD Web service - Synchronize XSD When stars web ratio between dofollow and nofollow backlink has affected? When using web services, what kind authentication is used? which of these three models is closer to webratio/ifml way of creating web applications XML Out Unit and Soap Request Response Unit XML Schema Definition Support XML Schema Definition Support