RapidMiner 9.7 is Now Available

Lots of amazing new improvements including true version control! Learn more about what's new here.

CLICK HERE TO DOWNLOAD

Receiving JSON object with a Web Service

bgracianbgracian Member Posts: 4 Contributor I
edited November 2018 in Help
Hi,

I am have a process that I need to offer as a Web Service with RapidMiner Server (1.3.015). This process has to receive a JSON object that I should transform in a example set. I have been trying to manage this scenario defining a macro to receive the JSON objet to use with Create document Operator and Json to XML Operator but I am obtening an error:

<error>
<service>ParsingJSON</service>
<type>
de.rapidanalytics.ejb.service.ServiceDataSourceException
</type>
<message>
Error executing process /home/admin/Prueba JSON/ParsingJSON for service ParsingJSON: The dummy operator Create Document (replacing text:create_document) cannot be executed.
</message>
</error>


The XML of the process is:


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.015">
  <context>
    <input/>
    <output/>
    <macros>
      <macro>
        <key>text</key>
        <value>{"IMEI":353234028103206,"P":"ID00001","TS":"11/11/12 08:31:44","IO1":1,"IO2":0,"IO3":1,"IO4":1,”IO5”:0,”IO6”:0,”IO7”:1,”IO8”:0,”IO9”:1,”IO10”:0,”AD1”:1250,”AD2”:1700}</value>
      </macro>
    </macros>
  </context>
  <operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
    <parameter key="logverbosity" value="init"/>
    <parameter key="random_seed" value="2001"/>
    <parameter key="send_mail" value="never"/>
    <parameter key="notification_email" value=""/>
    <parameter key="process_duration_for_mail" value="30"/>
    <parameter key="encoding" value="SYSTEM"/>
    <parameter key="parallelize_main_process" value="false"/>
    <process expanded="true">
      <operator activated="true" class="text:create_document" compatibility="5.3.002" expanded="true" height="60" name="Create Document" width="90" x="179" y="75">
        <parameter key="text" value="%{text}"/>
        <parameter key="add label" value="true"/>
        <parameter key="label_type" value="nominal"/>
        <parameter key="label_value" value="json"/>
      </operator>
      <operator activated="true" class="web:json_to_xml" compatibility="5.3.001" expanded="true" height="60" name="Json to XML" width="90" x="313" y="75">
        <parameter key="enclosing_tag_name" value="json"/>
      </operator>
      <operator activated="true" class="read_xml" compatibility="5.3.015" expanded="true" height="60" name="Read XML" width="90" x="514" y="75">
        <parameter key="xpath_for_examples" value="&lt;json&gt;"/>
        <enumeration key="xpaths_for_attributes"/>
        <parameter key="use_namespaces" value="true"/>
        <list key="namespaces"/>
        <parameter key="use_default_namespace" value="true"/>
        <parameter key="parse_numbers" value="true"/>
        <parameter key="decimal_character" value="."/>
        <parameter key="grouped_digits" value="false"/>
        <parameter key="grouping_character" value=","/>
        <parameter key="date_format" value=""/>
        <list key="annotations"/>
        <parameter key="time_zone" value="SYSTEM"/>
        <parameter key="locale" value="English (United States)"/>
        <list key="data_set_meta_data_information"/>
        <parameter key="read_not_matching_values_as_missings" value="true"/>
        <parameter key="datamanagement" value="double_array"/>
      </operator>
      <connect from_op="Create Document" from_port="output" to_op="Json to XML" to_port="document"/>
      <connect from_op="Json to XML" from_port="document" to_op="Read XML" to_port="file"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
    </process>
  </operator>
</process>


Could you help me to understand why it is not working?

Best Regards, Alberto
Tagged:

Answers

  • Marco_BoeckMarco_Boeck Team Lead Software Engineering Administrator, Moderator, Employee, Member, University Professor Posts: 1,936   RM Engineering
    Hi,

    the error says that the text extension could not be found, thus the Create document operator in your process cannot be executed. Make sure to set your extension directory in the settings of RapidAnalytics to the correct folder where your text extension jar can be found.

    Regards,
    Marco
  • bgracianbgracian Member Posts: 4 Contributor I
    Thank you very much Marco. I have installed extensions and now it is working. Thanks again. Best Regards. Alberto


    Marco Boeck wrote:

    Hi,

    the error says that the text extension could not be found, thus the Create document operator in your process cannot be executed. Make sure to set your extension directory in the settings of RapidAnalytics to the correct folder where your text extension jar lies can be found.

    Regards,
    Marco
Sign In or Register to comment.