Options

ServiceDataSourceException error when testing web service

RionArisuRionArisu Member Posts: 13 Contributor I
I'm following the step by step tutorial available at Rapidminer documentation site on using "Predictive Maintenance" data set to build web services at server.
I have successfully created a web service at server, however when i test the web service using a macro value "M_0221", it returns an error:
{"error":{"type":"de.rapidanalytics.ejb.service.ServiceDataSourceException","message":"Error executing process /home/myusername/Predictive Maintenance/Predictive_Maintenance_web_service_with_parameters for service Predictive_Maintenance_web_service_with_parameters: null"}} 

When i access the web service URL directly, it shows:
{
"code": 401,"message": "Unauthorized"}

Is there any settings which I have missed?

Many thanks!


P/S: Here are my xml for the "Predictive_Maintenance_web_service_with_parameters" example:
<?xml version="1.0" encoding="UTF-8"?><process version="9.8.000">
  <context>
    <input/>
    <output/>
    <macros>
      <macro>
        <key>machineID</key>
        <value/>
      </macro>
    </macros>
  </context>
  <operator activated="true" class="process" compatibility="9.8.000" 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"/>
    <process expanded="true">
      <operator activated="true" class="retrieve" compatibility="9.8.000" expanded="true" height="68" name="Retrieve Model" width="90" x="45" y="34">
        <parameter key="repository_entry" value="Predictive_Maintenance_Model"/>
      </operator>
      <operator activated="true" class="retrieve" compatibility="9.8.000" expanded="true" height="68" name="Retrieve New Data" width="90" x="45" y="136">
        <parameter key="repository_entry" value="New Data"/>
      </operator>
      <operator activated="true" class="filter_examples" compatibility="9.8.000" expanded="true" height="103" name="Filter Examples" width="90" x="179" y="136">
        <parameter key="parameter_expression" value=""/>
        <parameter key="condition_class" value="custom_filters"/>
        <parameter key="invert_filter" value="false"/>
        <list key="filters_list">
          <parameter key="filters_entry_key" value="Machine_ID.equals.%{machineID}"/>
        </list>
        <parameter key="filters_logic_and" value="true"/>
        <parameter key="filters_check_metadata" value="true"/>
      </operator>
      <operator activated="true" class="apply_model" compatibility="9.8.000" expanded="true" height="82" name="Apply Model" width="90" x="380" y="85">
        <list key="application_parameters"/>
        <parameter key="create_view" value="false"/>
      </operator>
      <connect from_op="Retrieve Model" from_port="output" to_op="Apply Model" to_port="model"/>
      <connect from_op="Retrieve New Data" from_port="output" to_op="Filter Examples" to_port="example set input"/>
      <connect from_op="Filter Examples" from_port="example set output" to_op="Apply Model" to_port="unlabelled data"/>
      <connect from_op="Apply Model" from_port="labelled data" to_port="result 1"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
    </process>
  </operator>
</process>

Answers

  • Options
    aschaferdiekaschaferdiek Employee, Member Posts: 76 RM Engineering
    Hi. A little late to the party, maybe you've already solved it but I rebuild a similar process with the help of the Samples process RapidMiner Studio provides using the Golf dataset and the web service works.
    <?xml version="1.0" encoding="UTF-8"?><process version="9.8.001">
      <context>
        <input/>
        <output/>
        <macros>
          <macro>
            <key>myMacro</key>
            <value/>
          </macro>
        </macros>
      </context>
      <operator activated="true" class="process" compatibility="9.4.000" expanded="true" name="Root" origin="GENERATED_SAMPLE">
        <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"/>
        <process expanded="true">
          <operator activated="true" class="retrieve" compatibility="9.8.001" expanded="true" height="68" name="Retrieve" origin="GENERATED_SAMPLE" width="90" x="112" y="34">
            <parameter key="repository_entry" value="data/Golf"/>
          </operator>
          <operator activated="true" class="concurrency:parallel_decision_tree" compatibility="9.4.000" expanded="true" height="103" name="DecisionTree" origin="GENERATED_SAMPLE" width="90" x="313" y="34">
            <parameter key="criterion" value="gain_ratio"/>
            <parameter key="maximal_depth" value="20"/>
            <parameter key="apply_pruning" value="true"/>
            <parameter key="confidence" value="0.25"/>
            <parameter key="apply_prepruning" value="true"/>
            <parameter key="minimal_gain" value="0.1"/>
            <parameter key="minimal_leaf_size" value="2"/>
            <parameter key="minimal_size_for_split" value="4"/>
            <parameter key="number_of_prepruning_alternatives" value="3"/>
          </operator>
          <operator activated="true" class="retrieve" compatibility="9.8.001" expanded="true" height="68" name="Retrieve (2)" origin="GENERATED_SAMPLE" width="90" x="112" y="187">
            <parameter key="repository_entry" value="data/Golf-Testset"/>
          </operator>
          <operator activated="true" class="filter_examples" compatibility="9.8.001" expanded="true" height="103" name="Filter Examples" width="90" x="313" y="187">
            <parameter key="parameter_expression" value=""/>
            <parameter key="condition_class" value="custom_filters"/>
            <parameter key="invert_filter" value="false"/>
            <list key="filters_list">
              <parameter key="filters_entry_key" value="Outlook.equals.%{myMacro}"/>
            </list>
            <parameter key="filters_logic_and" value="true"/>
            <parameter key="filters_check_metadata" value="true"/>
          </operator>
          <operator activated="true" class="apply_model" compatibility="7.1.001" expanded="true" height="82" name="Apply Model" origin="GENERATED_SAMPLE" width="90" x="648" y="34">
            <list key="application_parameters"/>
            <parameter key="create_view" value="false"/>
          </operator>
          <connect from_op="Retrieve" from_port="output" to_op="DecisionTree" to_port="training set"/>
          <connect from_op="DecisionTree" from_port="model" to_op="Apply Model" to_port="model"/>
          <connect from_op="Retrieve (2)" from_port="output" to_op="Filter Examples" to_port="example set input"/>
          <connect from_op="Filter Examples" from_port="example set output" to_op="Apply Model" to_port="unlabelled data"/>
          <connect from_op="Apply Model" from_port="labelled data" to_port="result 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
        </process>
      </operator>
    </process>


    I saved the process as ws_2 in the repository and configured the WS in the following way. I recommend that you make the query parameter mandatory if you rely on it to deliver an output.


    The following is the output of the test button then:


    If you open the web service link in another browser when you're not logged in, then you retrieve the 401. If you like to enable anonymous access to the web service, please take a look at our documentation (https://docs.rapidminer.com/latest/legacy/configure/settings/table.html#com.rapidanalytics.web.anonymous_resources).

    I hope this helped.
Sign In or Register to comment.