WSDL <ports> Element is used as an individual endpoint for web services by specifying a single address for a binding. More than one address MUST NOT be specified in a port. Other than address information, a `<port>` CANNOT specify any binding information.
Syntax:
<wsdl:port name = "..." binding = "..."> *
</wsdl:port>
The bellow examples will illustrate the WSDL <ports> Element:
Example 1: Here is this example we will be showing a request service.
<service name = "Request_Service">
<port binding = "tns:Request_Binding" name = "Request_Port">
<soap:address location = "http://www.geeksoforgeeks.com/AskRequest/"></soap:address>
</port>
</service>
In this example, we define a service named "Request_Service" with a port named "Request_Port." This port is bound to the "Request_Binding," and its address is specified as "http://www.geeksoforgeeks.com/AskRequest/."
Example 2: Here is this example we will be showing a greeting service.
<service name = "Hello_Service">
<documentation>WSDL File for HelloService</documentation>
<port binding = "tns:Hello_Binding" name = "Hello_Port">
<soap:address location = "http://www.geeksforgeeks.com/greetings/"></soap:address>
</port>
</service>
In this second example, we has defined a service named "Hello_Service" with a port named "Hello_port". The binding is set to "Hello_Binding" and the address specified as "http://www.geeksforgeeks.com/greetings/".
In conclusion, the WSDL `<port>` element plays a crucial role in defining endpoints for web services, allowing you to specify addresses and bindings.