!--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 e-mail information entered by the user to the Web service and to receive the response, you need a model that provides the necessary auxilliary 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 to which you can bind model nodes and model attributes of a controller context (model binding).
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 ®Web Dynpro Components ®EmailWSComponent.
2. From the context menu, choose Open Data Modeler to start the Data Modeler. Alternatively, you can double-click the node.
3.
In
the Data Modeler toolbar, choose the
Create
a model icon.
4.
Place
the cursor on the
Used
Modelsarea
and left-click.
5. The appropriate wizard appears. Choose the Import Web Service Model option, followed by Next.
6. Enter the name EmailModelas the model name and com.sap.tc.webdynpro.tutorial.emailws.modelas the package name.
7. Under Select WSDL Source, choose the radio button UDDI or URL, followed by Next.

8. Enter the following WSDL description for the email Web service in the Wsdl field: http://www.abysal.com/soap/AbysalEmail.wsdl
9. 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.

Bear in mind that importing a new model takes place in the first instance on project levels and independent from the components contained therein. If a model is to be used in a component, you have to define a corresponding model usage. This usage-relation is automatically defined by the data modeler when carrying out the procedure mentioned above.
If your HTTP connection to the e-mail Web service uses an HTTP proxy, you also need to make the following settings:
...
1. In the Web Dynpro Explorer, open the node Web Dynpro ® Models ® EmailModel ® Logical Ports ® SendEmailPort and choose the entry Open in the context menu.
2. 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.
3.
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 EmailModel node in the Web Dynpro Explorer.

The
nodes contained in the EmailModel represent the Model Classes
(
,
executable 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
(Model-Bindung). This structure description is independent of the
concrete model implementation (RFC, XML, Web service) of the imported data
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 a Component Controller Context and Binding it to the Model