public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
    // Load the URL
    //
    setUrl( rep.getStepAttributeString( id_step, "wsUrl" ) );

    // Load the operation
    //
    setOperationName( rep.getStepAttributeString( id_step, "wsOperation" ) );
    setOperationRequestName( rep.getStepAttributeString( id_step, "wsOperationRequest" ) );
    setOperationNamespace( rep.getStepAttributeString( id_step, "wsOperationNamespace" ) );
    setInFieldContainerName( rep.getStepAttributeString( id_step, "wsInFieldContainer" ) );
    setInFieldArgumentName( rep.getStepAttributeString( id_step, "wsInFieldArgument" ) );
    setOutFieldContainerName( rep.getStepAttributeString( id_step, "wsOutFieldContainer" ) );
    setOutFieldArgumentName( rep.getStepAttributeString( id_step, "wsOutFieldArgument" ) );
    setProxyHost( rep.getStepAttributeString( id_step, "proxyHost" ) );
    setProxyPort( rep.getStepAttributeString( id_step, "proxyPort" ) );
    setHttpLogin( rep.getStepAttributeString( id_step, "httpLogin" ) );
    setHttpPassword( rep.getStepAttributeString( id_step, "httpPassword" ) );
    setCallStep( (int) rep.getStepAttributeInteger( id_step, "callStep" ) );
    setPassingInputData( rep.getStepAttributeBoolean( id_step, "passingInputData" ) );
    setCompatible( rep.getStepAttributeBoolean( id_step, 0, "compatible", true ) ); // Default to true for backward
                                                                                    // compatibility
    setRepeatingElementName( rep.getStepAttributeString( id_step, "repeating_element" ) );
    setReturningReplyAsString( rep.getStepAttributeBoolean( id_step, 0, "reply_as_string" ) );

    // Load the input fields mapping
    //
    int nb = rep.countNrStepAttributes( id_step, "fieldIn_ws_name" );
    getFieldsIn().clear();
    for ( int i = 0; i < nb; ++i ) {
      WebServiceField field = new WebServiceField();
      field.setName( rep.getStepAttributeString( id_step, i, "fieldIn_name" ) );
      field.setWsName( rep.getStepAttributeString( id_step, i, "fieldIn_ws_name" ) );
      field.setXsdType( rep.getStepAttributeString( id_step, i, "fieldIn_xsd_type" ) );
      getFieldsIn().add( field );
    }

    // Load the output fields mapping
    //
    nb = rep.countNrStepAttributes( id_step, "fieldOut_ws_name" );
    getFieldsOut().clear();
    for ( int i = 0; i < nb; ++i ) {
      WebServiceField field = new WebServiceField();
      field.setName( rep.getStepAttributeString( id_step, i, "fieldOut_name" ) );
      field.setWsName( rep.getStepAttributeString( id_step, i, "fieldOut_ws_name" ) );
      field.setXsdType( rep.getStepAttributeString( id_step, i, "fieldOut_xsd_type" ) );
      getFieldsOut().add( field );
    }

  }
@Test
  public void testReadRep() throws Exception {

    Repository rep = mock( Repository.class );
    IMetaStore metastore = mock( IMetaStore.class );
    DatabaseMeta dbMeta = mock( DatabaseMeta.class );
    StringObjectId id_step = new StringObjectId( "oid" );
    when( rep.getStepAttributeString( id_step, "wsOperation" ) ).thenReturn( "GetCurrentExchangeRate" );
    when( rep.getStepAttributeString( id_step, "wsOperationRequest" ) ).thenReturn( "opRequest" );
    when( rep.getStepAttributeString( id_step, "wsOperationNamespace" ) ).thenReturn( "opNamespace" );
    when( rep.getStepAttributeString( id_step, "wsInFieldContainer" ) ).thenReturn( "ifc" );
    when( rep.getStepAttributeString( id_step, "wsInFieldArgument" ) ).thenReturn( "ifa" );
    when( rep.getStepAttributeString( id_step, "wsOutFieldContainer" ) ).thenReturn( "ofc" );
    when( rep.getStepAttributeString( id_step, "wsOutFieldArgument" ) ).thenReturn( "ofa" );
    when( rep.getStepAttributeString( id_step, "proxyHost" ) ).thenReturn( "phost" );
    when( rep.getStepAttributeString( id_step, "proxyPort" ) ).thenReturn( "1234" );
    when( rep.getStepAttributeString( id_step, "httpLogin" ) ).thenReturn( "user" );
    when( rep.getStepAttributeString( id_step, "httpPassword" ) ).thenReturn( "password" );
    when( rep.getStepAttributeInteger( id_step, "callStep" ) ).thenReturn( 2L );
    when( rep.getStepAttributeBoolean( id_step, "passingInputData" ) ).thenReturn( true );
    when( rep.getStepAttributeBoolean( id_step, 0, "compatible", true ) ).thenReturn( false );
    when( rep.getStepAttributeString( id_step, "repeating_element" ) ).thenReturn( "repeat" );
    when( rep.getStepAttributeBoolean( id_step, 0, "reply_as_string" ) ).thenReturn( true );

    when( rep.countNrStepAttributes( id_step, "fieldIn_ws_name" ) ) .thenReturn( 2 );
    when( rep.getStepAttributeString( id_step, 0, "fieldIn_name" ) ).thenReturn( "bank" );
    when( rep.getStepAttributeString( id_step, 0, "fieldIn_ws_name" ) ).thenReturn( "inBank" );
    when( rep.getStepAttributeString( id_step, 0, "fieldIn_xsd_type" ) ).thenReturn( "string" );
    when( rep.getStepAttributeString( id_step, 1, "fieldIn_name" ) ).thenReturn( "branch" );
    when( rep.getStepAttributeString( id_step, 1, "fieldIn_ws_name" ) ).thenReturn( "inBranch" );
    when( rep.getStepAttributeString( id_step, 1, "fieldIn_xsd_type" ) ).thenReturn( "string" );

    when( rep.countNrStepAttributes( id_step, "fieldOut_ws_name" ) ) .thenReturn( 2 );
    when( rep.getStepAttributeString( id_step, 0, "fieldOut_name" ) ).thenReturn( "balance" );
    when( rep.getStepAttributeString( id_step, 0, "fieldOut_ws_name" ) ).thenReturn( "outBalance" );
    when( rep.getStepAttributeString( id_step, 0, "fieldOut_xsd_type" ) ).thenReturn( "int" );
    when( rep.getStepAttributeString( id_step, 1, "fieldOut_name" ) ).thenReturn( "transactions" );
    when( rep.getStepAttributeString( id_step, 1, "fieldOut_ws_name" ) ).thenReturn( "outTransactions" );
    when( rep.getStepAttributeString( id_step, 1, "fieldOut_xsd_type" ) ).thenReturn( "int" );

    WebServiceMeta webServiceMeta = new WebServiceMeta(  rep, metastore, id_step, Collections.singletonList( dbMeta )  );

    String expectedXml = "    <wsURL/>\n"
      + "    <wsOperation>GetCurrentExchangeRate</wsOperation>\n"
      + "    <wsOperationRequest>opRequest</wsOperationRequest>\n"
      + "    <wsOperationNamespace>opNamespace</wsOperationNamespace>\n"
      + "    <wsInFieldContainer>ifc</wsInFieldContainer>\n"
      + "    <wsInFieldArgument>ifa</wsInFieldArgument>\n"
      + "    <wsOutFieldContainer>ofc</wsOutFieldContainer>\n"
      + "    <wsOutFieldArgument>ofa</wsOutFieldArgument>\n"
      + "    <proxyHost>phost</proxyHost>\n"
      + "    <proxyPort>1234</proxyPort>\n"
      + "    <httpLogin>user</httpLogin>\n"
      + "    <httpPassword>password</httpPassword>\n"
      + "    <callStep>2</callStep>\n"
      + "    <passingInputData>Y</passingInputData>\n"
      + "    <compatible>N</compatible>\n"
      + "    <repeating_element>repeat</repeating_element>\n"
      + "    <reply_as_string>Y</reply_as_string>\n"
      + "    <fieldsIn>\n"
      + "    <field>\n"
      + "        <name>bank</name>\n"
      + "        <wsName>inBank</wsName>\n"
      + "        <xsdType>string</xsdType>\n"
      + "    </field>\n"
      + "    <field>\n"
      + "        <name>branch</name>\n"
      + "        <wsName>inBranch</wsName>\n"
      + "        <xsdType>string</xsdType>\n"
      + "    </field>\n"
      + "      </fieldsIn>\n"
      + "    <fieldsOut>\n"
      + "    <field>\n"
      + "        <name>balance</name>\n"
      + "        <wsName>outBalance</wsName>\n"
      + "        <xsdType>int</xsdType>\n"
      + "    </field>\n"
      + "    <field>\n"
      + "        <name>transactions</name>\n"
      + "        <wsName>outTransactions</wsName>\n"
      + "        <xsdType>int</xsdType>\n"
      + "    </field>\n"
      + "      </fieldsOut>\n";
    String actualXml = TestUtils.toUnixLineSeparators( webServiceMeta.getXML() );
    assertEquals( expectedXml, actualXml );
  }