Include your SOAP request within a general instance document: This intermediate level article by Nicholas Chase explains how an XForms form is handy as a Web service client because it enables you to easily send and receive an XML document, but what if you don't necessarily want to send the entire data instance? This tip explains how you can build an instance that includes a SOAP message along with other data, and then send only the SOAP message on submission. (This article originally appeared on IBM developerWorks, 13 Aug 2004, at http://www.ibm.com/developerWorks.)
Send Part of an XForms Instance to a Web Service - Structuring the form (Page 2 of 4 )
The goal of this project is to create a form that submits a SOAP message and then retrieves the SOAP response and displays the result. To do that, you need to add a submission trigger button and the ability to read the returned data, as shown in Listing 3:
<xforms:output ref="instance('weatherInstance')//return"> <xforms:label>Employee local temperature:</xforms:label> </xforms:output>
</xforms:case> </xforms:switch>
</body> </html>
Here you separate the form into two cases because the instance that provides data for the controls will be different before and after submission. You start with the first case, which includes the employee data control and a trigger button. When the user clicks the trigger, the browser sends the getweather submission (which you'll create next) and changes to the responseGUI case, which will look for data in the new structure. Once in the responseGUI case, the browser displays the temperature, which is in the return element.
Now you just have to create the actual submission.
Visit developerWorks for thousands of developer articles, tutorials, and resources related to open standard technologies, IBM products, and more. See developerWorks.