~~ Licensed to the Apache Software Foundation (ASF) under one ~~ or more contributor license agreements. See the NOTICE file ~~ distributed with this work for additional information ~~ regarding copyright ownership. The ASF licenses this file ~~ to you under the Apache License, Version 2.0 (the ~~ "License"); you may not use this file except in compliance ~~ with the License. You may obtain a copy of the License at ~~ ~~ http://www.apache.org/licenses/LICENSE-2.0 ~~ ~~ Unless required by applicable law or agreed to in writing, ~~ software distributed under the License is distributed on an ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~~ KIND, either express or implied. See the License for the ~~ specific language governing permissions and limitations ~~ under the License. UDP Transport * {Content} %{toc|section=1|fromDepth=1} * {Transport listener} ** {Listener configuration} The UDP transport listener is configured in <<>> using the following declaration: +----------------------------+ +----------------------------+ Depending on how the UDP transport is set up, additional parameters may be required inside the <<>> element (see next section). ** {Endpoint configuration} Endpoints can be configured both at the transport level and at the service level. Each endpoint opens a local UDP port for listening. UDP packets received on a port that is configured on a service will be pre-dispatched to that service. Packets received by a port that is configured at the transport level need to be dispatched using WS-Addressing or some other mechanism implemented by a dispatcher configured in Axis2. Endpoints are configured by adding <<>> elements to the <<>> element in <<>> or to a <<>> element in an <<>> file. The set of parameters is the same for both scenarios: [<<>> (required)] Specifies the UDP port to bind to. [<<>> (required)] Specifies the content type of the messages received on the endpoint. This parameter is necessary because in contrast to HTTP, the content type information is not part of the information exchanged on the wire. [<<>> (optional, defaults to 1024)] The maximum UDP packet size. * {Transport sender} The UDP transport sender can be enabled in <<>> using the following declaration: +----------------------------+ +----------------------------+ * {Examples} ** {Enabling SOAP over UDP at the transport level} The following declaration in <<>> enables SOAP over UDP on port 3333 and allows all services (for which UDP is in the list of exposed transports) to receive messages over that port: +----------------------------+ 3333 text/xml 4096 +----------------------------+ For this to work, WS-Addressing must be enabled, and messages sent to port 3333 must have the relevant WS-Addressing headers. +----------------------------+ +----------------------------+ With the configuration shown above, the UDP transport would generate bindings with the following EPR: +----------------------------+ udp://localhost:3333/axis2/services/Version?contentType=text/xml +----------------------------+ The following example shows a message that can be sent to the Version service over UDP: +----------------------------+ 1234 udp://localhost:3333/axis2/services/Version?contentType=text/xml urn:getVersion +----------------------------+ On most Linux/Unix systems (including Mac OS X), the <<>> utility is available to send UDP messages and can be used to test the transport. To do this, save the message into <<>> and execute the following command: +----------------------------+ nc -u 127.0.0.1 3333 < test-message.xml +----------------------------+