このコンテンツは選択した言語では利用できません。

Chapter 337. XML RPC Component


Available as of Camel version 2.11

This component provides a dataformat for xml, which allows serialization and deserialization of request messages and response message using Apache XmlRpc’s binary dataformat. You can also invoke the XMLRPC Service through the camel-xmlrpc producer.

Maven users will need to add the following dependency to their pom.xml for this component:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-xmlrpc</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

337.1. XmlRpc Overview

It’s a spec and a set of implementations that allow software running on disparate operating systems, running in different environments to make procedure calls over the Internet.

It’s remote procedure calling using HTTP as the transport and XML as the encoding. XML-RPC is designed to be as simple as possible, while allowing complex data structures to be transmitted, processed and returned.

An example of a typical XML-RPC request would be:

<?xml version="1.0"?>
<methodCall>
  <methodName>examples.getStateName</methodName>
  <params>
    <param>
        <value><i4>40</i4></value>
    </param>
  </params>
</methodCall>

An example of a typical XML-RPC response would be:

<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
        <value><string>South Dakota</string></value>
    </param>
  </params>
</methodResponse>

A typical XML-RPC fault would be:

<?xml version="1.0"?>
<methodResponse>
  <fault>
    <value>
      <struct>
        <member>
          <name>faultCode</name>
          <value><int>4</int></value>
        </member>
        <member>
          <name>faultString</name>
          <value><string>Too many parameters.</string></value>
        </member>
      </struct>
    </value>
  </fault>
</methodResponse>

337.2. URI format

xmlrpc://serverUri[?options]

337.3. Options

The XML RPC component has no options.

The XML RPC endpoint is configured using URI syntax:

xmlrpc:address

with the following path and query parameters:

337.3.1. Path Parameters (1 parameters):

Expand
NameDescriptionDefaultType

address

Required The server url

 

String

337.3.2. Query Parameters (18 parameters):

Expand
NameDescriptionDefaultType

basicEncoding (producer)

Sets the encoding for basic authentication, null means UTF-8 is chosen.

 

String

connectionTimeout (producer)

Set the connection timeout in milliseconds, 0 is to disable it

 

int

contentLengthOptional (producer)

Whether a Content-Length header may be omitted. The XML-RPC specification demands, that such a header be present.

false

boolean

defaultMethodName (producer)

The method name which would be used for the xmlrpc requests by default, if the Message header CamelXmlRpcMethodName is not set.

 

String

enabledForExceptions (producer)

Whether the response should contain a faultCause element in case of errors. The faultCause is an exception, which the server has trapped and written into a byte stream as a serializable object.

false

boolean

enabledForExtensions (producer)

Whether extensions are enabled. By default, the client or server is strictly compliant to the XML-RPC specification and extensions are disabled.

false

boolean

encoding (producer)

Sets the requests encoding, null means UTF-8 is chosen.

 

String

gzipCompressing (producer)

Whether gzip compression is being used for transmitting the request.

false

boolean

gzipRequesting (producer)

Whether gzip compression is being used for transmitting the request.

false

boolean

replyTimeout (producer)

Set the reply timeout in milliseconds, 0 is to disable it.

 

int

clientConfig (advanced)

To use the given XmlRpcClientConfigImpl as configuration for the client.

 

XmlRpcClientConfig Impl

clientConfigurer (advanced)

To use a custom XmlRpcClientConfigurer to configure the client

 

XmlRpcClientConfigurer

synchronous (advanced)

Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).

false

boolean

timeZone (advanced)

The timezone, which is used to interpret date/time. Defaults to link TimeZonegetDefault().

 

TimeZone

userAgent (advanced)

The http user agent header to set when doing xmlrpc requests

 

String

xmlRpcServer (advanced)

To use a custom XmlRpcRequestProcessor as server.

 

XmlRpcRequestProcessor

basicPassword (security)

The password for basic authentication.

 

String

basicUserName (security)

The user name for basic authentication.

 

String

337.4. Message Headers

Camel XmlRpc uses these headers.

Expand
HeaderDescription

CamelXmlRpcMethodName

The XmlRpc method name which will be use for invoking the XmlRpc server.

337.5. Using the XmlRpc data format

As the XmlRpc message could be request or response, when you use the XmlRpcDataFormat, you need to specify the dataformat is for request or not.

337.6. Invoke XmlRpc Service from Client

To invoke the XmlRpc service, you need to specify the methodName on the message header and put the parameters into the message body like below code, then you can get the result message as you want. If the fault message is return, you should get an exception which cause if XmlRpcException.

   String response = template.requestBodyAndHeader(xmlRpcServiceAddress, new Object[]{"me"}, XmlRpcConstants.METHOD_NAME, "hello", String.class);

337.7. How to configure the XmlRpcClient with Java code

camel-xmlrpc provides a pluggable strategy for configuring the XmlRpcClient used by the component, user just to implement the XmlRpcClientConfigurer interface and can configure the XmlRpcClient as he wants. The clientConfigure instance reference can be set through the uri option clientConfigure.

Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2026 Red Hat
トップに戻る