---
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    funktion.fabric8.io/kind: Connector
  name: xmlrpc
data:
  deployment.yml: |
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      labels:
        funktion.fabric8.io/kind: Subscription
        connector: xmlrpc
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            funktion.fabric8.io/kind: Subscription
            connector: xmlrpc
        spec:
          containers:
          - image: funktion/connector-xmlrpc:${project.version}
            name: connector
  schema.yml: |
    ---
    component:
      kind: component
      scheme: xmlrpc
      syntax: xmlrpc:address
      title: XML RPC
      description: The xmlrpc component is used for sending messages to a XML RPC service.
      label: transformation
      deprecated: false
      async: false
      producerOnly: true
      javaType: org.apache.camel.component.xmlrpc.XmlRpcComponent
      groupId: org.apache.camel
      artifactId: camel-xmlrpc
      version: 2.18.3
    componentProperties: {}
    properties:
      address:
        kind: path
        group: producer
        required: true
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The server url
        order: 0
      basicEncoding:
        kind: parameter
        group: producer
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Sets the encoding for basic authentication null means UTF-8 is chosen.
        order: 1
      connectionTimeout:
        kind: parameter
        group: producer
        type: integer
        javaType: int
        deprecated: false
        secret: false
        description: Set the connection timeout in milliseconds 0 is to disable it
        order: 2
      contentLengthOptional:
        kind: parameter
        group: producer
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: Whether a Content-Length header may be omitted. The XML-RPC specification demands that such a header be present.
        order: 3
      defaultMethodName:
        kind: parameter
        group: producer
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The method name which would be used for the xmlrpc requests by default if the Message header CamelXmlRpcMethodName is not set.
        order: 4
      enabledForExceptions:
        kind: parameter
        group: producer
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: 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.
        order: 5
      enabledForExtensions:
        kind: parameter
        group: producer
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: Whether extensions are enabled. By default the client or server is strictly compliant to the XML-RPC specification and extensions are disabled.
        order: 6
      encoding:
        kind: parameter
        group: producer
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Sets the requests encoding null means UTF-8 is chosen.
        order: 7
      gzipCompressing:
        kind: parameter
        group: producer
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: Whether gzip compression is being used for transmitting the request.
        order: 8
      gzipRequesting:
        kind: parameter
        group: producer
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: Whether gzip compression is being used for transmitting the request.
        order: 9
      replyTimeout:
        kind: parameter
        group: producer
        type: integer
        javaType: int
        deprecated: false
        secret: false
        description: Set the reply timeout in milliseconds 0 is to disable it.
        order: 10
      clientConfig:
        kind: parameter
        group: advanced
        label: advanced
        type: object
        javaType: org.apache.xmlrpc.client.XmlRpcClientConfigImpl
        deprecated: false
        secret: false
        description: To use the given XmlRpcClientConfigImpl as configuration for the client.
        order: 11
      clientConfigurer:
        kind: parameter
        group: advanced
        label: advanced
        type: object
        javaType: org.apache.camel.component.xmlrpc.XmlRpcClientConfigurer
        deprecated: false
        secret: false
        description: To use a custom XmlRpcClientConfigurer to configure the client
        order: 12
      synchronous:
        kind: parameter
        group: advanced
        label: advanced
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
        order: 13
      timeZone:
        kind: parameter
        group: advanced
        label: advanced
        type: object
        javaType: java.util.TimeZone
        deprecated: false
        secret: false
        description: The timezone which is used to interpret date/time. Defaults to link TimeZonegetDefault().
        order: 14
      userAgent:
        kind: parameter
        group: advanced
        label: advanced
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The http user agent header to set when doing xmlrpc requests
        order: 15
      xmlRpcServer:
        kind: parameter
        group: advanced
        label: advanced
        type: object
        javaType: org.apache.xmlrpc.common.XmlRpcRequestProcessor
        deprecated: false
        secret: false
        description: To use a custom XmlRpcRequestProcessor as server.
        order: 16
      basicPassword:
        kind: parameter
        group: security
        label: security
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: true
        description: The password for basic authentication.
        order: 17
      basicUserName:
        kind: parameter
        group: security
        label: security
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: true
        description: The user name for basic authentication.
        order: 18
  documentation.adoc: |
    [[XmlRpc-XmlRpcComponent]]
    XmlRpc Component
    ~~~~~~~~~~~~~~~~

    *Available as of Camel 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:

    [source,xml]
    ------------------------------------------------------------
    <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>
    ------------------------------------------------------------

    [[XmlRpc-XmlRpcOverview]]
    XmlRpc Overview
    ^^^^^^^^^^^^^^^

    It's a http://xmlrpc.scripting.com/spec[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:

    [source,java]
    ------------------------------------------------
    <?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:

    [source,java]
    ----------------------------------------------------
    <?xml version="1.0"?>
    <methodResponse>
      <params>
        <param>
            <value><string>South Dakota</string></value>
        </param>
      </params>
    </methodResponse>
    ----------------------------------------------------

    A typical XML-RPC fault would be:

    [source,java]
    --------------------------------------------------------------
    <?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>
    --------------------------------------------------------------

    [[XmlRpc-URIformat]]
    URI format
    ^^^^^^^^^^

    [source,java]
    ----------------------------
    xmlrpc://serverUri[?options]
    ----------------------------

    [[XmlRpc-Options]]
    Options
    ^^^^^^^


    // component options: START
    The XML RPC component has no options.
    // component options: END



    // endpoint options: START
    The XML RPC component supports 19 endpoint options which are listed below:

    {% raw %}
    [width="100%",cols="2,1,1m,1m,5",options="header"]
    |=======================================================================
    | Name | Group | Default | Java Type | Description
    | address | producer |  | String | *Required* The server url
    | basicEncoding | producer |  | String | Sets the encoding for basic authentication null means UTF-8 is chosen.
    | connectionTimeout | producer |  | int | Set the connection timeout in milliseconds 0 is to disable it
    | contentLengthOptional | producer | false | boolean | Whether a Content-Length header may be omitted. The XML-RPC specification demands that such a header be present.
    | defaultMethodName | producer |  | String | The method name which would be used for the xmlrpc requests by default if the Message header CamelXmlRpcMethodName is not set.
    | enabledForExceptions | producer | false | boolean | 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.
    | enabledForExtensions | producer | false | boolean | Whether extensions are enabled. By default the client or server is strictly compliant to the XML-RPC specification and extensions are disabled.
    | encoding | producer |  | String | Sets the requests encoding null means UTF-8 is chosen.
    | gzipCompressing | producer | false | boolean | Whether gzip compression is being used for transmitting the request.
    | gzipRequesting | producer | false | boolean | Whether gzip compression is being used for transmitting the request.
    | replyTimeout | producer |  | int | Set the reply timeout in milliseconds 0 is to disable it.
    | clientConfig | advanced |  | XmlRpcClientConfigImpl | To use the given XmlRpcClientConfigImpl as configuration for the client.
    | clientConfigurer | advanced |  | XmlRpcClientConfigurer | To use a custom XmlRpcClientConfigurer to configure the client
    | synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
    | timeZone | advanced |  | TimeZone | The timezone which is used to interpret date/time. Defaults to link TimeZonegetDefault().
    | userAgent | advanced |  | String | The http user agent header to set when doing xmlrpc requests
    | xmlRpcServer | advanced |  | XmlRpcRequestProcessor | To use a custom XmlRpcRequestProcessor as server.
    | basicPassword | security |  | String | The password for basic authentication.
    | basicUserName | security |  | String | The user name for basic authentication.
    |=======================================================================
    {% endraw %}
    // endpoint options: END


    [[XmlRpc-MessageHeaders]]
    Message Headers
    ^^^^^^^^^^^^^^^

    Camel XmlRpc uses these headers.

    [width="100%",cols="10%,90%",options="header",]
    |=======================================================================
    |Header |Description

    |`CamelXmlRpcMethodName` |The XmlRpc method name which will be use for invoking the XmlRpc server.
    |=======================================================================

    [[XmlRpc-UsingtheXmlRpcdataformat]]
    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.

    [[XmlRpc-InvokeXmlRpcServicefromClient]]
    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.

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

    [[XmlRpc-HowtoconfiguretheXmlRpcClientwithJavacode]]
    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.
