!--a11y-->
Creating a Web Service Model 
Before you can use the e-mail Web service provided by an external provider within this Web Dynpro example application, you need to create the appropriate model. You will do this in the next step. At runtime, this model performs the data exchange between a Web Dynpro component and the Web service end point.
Within a Web Dynpro component, business data is stored in separate context structures (consisting of context nodes, context node elements, and context attributes). In this example, Subject, E-mail Text, Sender Address, and Recipient Address are the context attributes for the context node WebServiceEmail. To transfer the email information entered by the user to the Web service and to receive the response, you need a model that provides the necessary auxiliary classes and communication classes.
You can use the Web Dynpro tools to generate such a model for a particular Web service description. The model mainly consists of Java proxies (client stubs for communication with the Web service), as well as special model classes that you can use to link context structures to the model.
The following is a description of how to generate a Web Dynpro model from the WSDL description of the e-mail Web service. (WSDL is an XML format used to describe network services.) This WSDL description is made available by the service provider. If your HTTP connection is linked using a proxy host, you need to make some additional settings.

SAP AG does not accept any responsibility regarding the availability and quality of the external e-mail service used in this tutorial.
|
|
The service provider can load the WSDL description of the e-mail Web service. The Web service described functions correctly. |
|
|
The structure of your project WebDynpro_EmailWS is currently displayed in the Web Dynpro Explorer. |
To create a model that is based on a certain Web service, you first require the URL address through which the corresponding WSDL description can be accessed. If the address is known, you can then easily create an appropriate Web Dynpro model easily.
...
1. In the project structure, expand the node Web Dynpro ® Models.
2. From the context menu, choose Create Model. The appropriate wizard appears.
3. Choose the Import Web Service Model option, followed by Next.
4. Enter the name EmailModel as the model name and com.sap.tc.webdynpro.tutorial.emailws.model as the package name.
5. Under Select WSDL Source, choose the radio button UDDI or URL, followed by Next.

6. Enter the following WSDL description for the Web service in the Wsdl field: http://webservices.matlus.com/scripts/emailwebservice.dll/wsdl/IemailService
7. You do not need to make any entries in the next step, Proxy Definition / URI Package Mappings. Close the input dialog by choosing Finish.
The corresponding Java proxies are then generated as client stubs, and the model classes are generated for the subsequent binding of context elements.
If your HTTP connection to the e-mail Web service uses an HTTP proxy, you also need to make the following settings:
...
1. Go from the Web Dynpro Explorer to the Package Explorer.
2. Open the node src/packages – com.sap.tc.webdynpro.tutorials.emailws.model.proxies
3. Choose the file lport1_1.lp.
4. After selecting the checkbox Use HTTP Proxy, make the appropriate entries in the fields Proxy Host and Proxy Port:

The field Proxy Host represents the host name or the IP address of the proxy server, and Proxy Port is the port to which the proxy server listens.
5.
Save your settings
by choosing
(Save Editor
Contents) in the toolbar
underneath the menu bar.
After the Web service model has been imported, the corresponding entries are inserted under the Model node in the Web Dynpro Explorer.

The nodes contained
in the EmailModel represent the Model Classes (
) and their relations (
) – that are visible to you as the
application developer. You can subsequently bind the appropriate context
elements to these classes and relations. This structure description is
independent of the specific model implementation (RFC, XML, Web service) of
the imported model. Within a Web Dynpro component, Web Dynpro contexts serve
as storage locations for structured data (for example, table data, form
entries). Using the Data Binding function between UI elements and
context elements, this data can easily be displayed in the Web Browser.
Creating the Binding: Component Controller Context and Model
