Once you create the REST BC WSDL document, you can add and update the WSDL attributes that are specific to the REST configuration. The REST BC includes both service-level WSDL elements and binding-level WSDL elements, but some of these elements are placeholders only.
In the NetBeans IDE, double-click the WSDL document you want to configure.
The document appears in the WSDL Editor in WSDL view.
Click Source.
The view changes to display the source code.
Operation properties cannot be configured in WSDL view.
Scroll to the binding element, and modify any of the operation attributes described in REST Operation Element.
When you are finished, save and close the file.
The service-level REST element is rest:address. This is a placeholder element only, and does not need to be configured. When you create a WSDL file in the NetBeans IDE, the New WSDL Wizard generates the empty rest:address element.
The following example illustrates the REST WSDL service element:
<service name="RestOutboundService"> <port name="RestOutboundWSDL_OutboundPort" binding="tns:RestOutboundBinding"> <rest:address/> </port> </service> |
Binding level WSDL elements allow you to define and configure the REST operation performed against the external resource along with information about the resource. The REST Binding Component binding level WSDL elements include the rest:binding and rest:operation extensibility elements, but the rest:binding element is a placeholder.
The REST binding extensibility element specifies that the WSDL document is configured for the REST protocol. This is a placeholder element only, and does not need to be configured. When you create a WSDL file in the NetBeans IDE, the New WSDL Wizard generates a binding element, which includes a name you specify and a type that is generated by the wizard, and also includes the empty rest:bindingelement.
The following example illustrates the REST binding element:
<binding name="RestOutboundBinding" type="tns:RestOutboundPortType"> <rest:binding/> ... |
The REST operation element includes attributes that define the supported operations, along with payload types, URL information, and HTTP authorization. The REST Binding Component supports the GET, PUT, POST, DELETE, and HEAD operations. These attributes correspond to the properties you can configure from the Edit Operation Properties on the New WSDL Wizard.
When you create a WSDL file in the NetBeans IDE, the New WSDL Wizard generates a rest:operation element in the binding element, and includes any attribute configurations you entered for the operation properties on the wizard.
Table 3 REST BC Inbound WSDL Attributes
Attribute |
Description |
---|---|
http-listener-name |
The name of the HTTP listener to bind to. The default value is Default HTTP Listener. This property is optional. |
path |
The path to the operation resource. This property is required. |
method |
The HTTP operation to access the resource specified above. This attribute default to GET. Enter any of the following operations:
For more information, see Supported HTTP Methods. |
consume-types |
The acceptable MIME types for the request payload, specified in JSON format. Enter the types in square brackets with each type contained in double-quotes. Separate multiple values by a comma. For example: [ "text/plain", "application/xml" ] This property is optional. |
produce-types |
The acceptable MIME types for the response payload, specified in JSON format as above. This property is optional. |
forward-as-attachment |
An indicator of whether to forward the payload as an attachment. Select the check box to have the payload forwarded. This property is optional. |
user_defined |
A list of user-defined properties in java.util.Properties format (key and value pairs). For example: serverName=test This property is optional. |
Table 4 REST BC Outbound WSDL Attributes
Attribute |
Description |
---|---|
url |
The URL to the external resource. This property is required. |
method |
The HTTP operation to access the resource specified above. This attribute default to GET. Enter any of the following operations:
For more information, see Supported HTTP Methods. |
accept-types |
The acceptable media types for the response, specified in JSON format. Enter the types in square brackets with each type contained in double-quotes. Separate multiple values by a comma. For example: [ "application/json", "text/plain" ] This property is optional. |
accept-languages |
The preferred natural languages for the response, specified in JSON format. This property is optional. |
content-type |
The content type of the outbound payload. If no value is specified, this defaults to any type. This property is optional. |
headers |
Custom HTTP headers for the outbound payload. Enter the headers in curly brackets as name value pairs with the name and value each in double-quotes and separated by a space, a colon, and another space. Separate multiple name value pairs by a comma. For example: { "host" : "MyServer.com", "Content-Subtype" : "application/json/customers"} Custom headers are optional. |
param-style |
A style for the URI parameters. Select one of the following options:
|
params |
Custom HTTP parameters for the URI. Enter the parameters in curly brackets as name value pairs with the name and value each in double-quotes and separated by a space, a colon, and another space. Separate multiple name value pairs by a comma. For example: { "status" : "Active", "billing" : "Current"} Custom parameters are optional. |
basic-auth-username |
The login ID of the user for authentication. If the property is populated, a basic authentication header is added to the HTTP request. |
basic-auth-password |
The login password corresponding with the above user name. |
user_defined |
A list of user-defined properties in java.util.Properties format (key and value pairs). For example: serverName=test This property is optional. |
The following example illustrates the REST operation element:
<binding name="RestOutboundBinding" type="tns:RestOutboundPortType"> <rest:binding/> <operation> <rest:operation> <![CDATA[ url=http://{bucket}.s3.amazonaws.com/{resource} method=GET accept-types=[ "text/plain" ] accept-languages=[ ] content-type= headers={ } param-style=Query params={ "status" : "Active", "billing" : "Current" } basic-auth-username=gsmythe basic-auth-password=1qazMKO) ]]> </rest:operation> ... </operation> </binding> |