Exemplo n.º 1
0
  @Test
  public void testXMLToBean() throws Exception {
    String content =
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
            + "<esb>"
            + "<call>"
            + "<!-- 调度中心需要的数据开始 -->"
            + "<property name=\"soamethodcall\" "
            + "class=\"org.frameworkset.soa.SOAMethodCall\" "
            + "f:requestor=\"requestor\" "
            + "f:requestid=\"1000000\" "
            + "f:password=\"requestpassword\" "
            + "f:encypt=\"encrypt\" "
            + "f:encyptalgorithem=\"algorithm\" "
            + "f:serviceid=\"hilaryserviceid\" "
            + "f:issynchronized=\"true\" >"
            + "<!-- 调度中心需要的数据结束 -->"
            + "<!-- 调度中心提交给服务提供方的服务方法信息 -->"
            + "<property name=\"soamethodinfo\" class=\"org.frameworkset.soa.SOAMethodInfo\" "
            + "f:methodName=\"methodname\">"
            + "<property name=\"paramTypes\">"
            + "<array componentType=\"Class\">"
            + "<property >String</property>"
            + "<property >String</property>"
            + "<property >String[]</property>"
            + "</array>"
            + "</property>"
            + "<property name=\"params\">"
            + "<array componentType=\"object\">"
            + "<property name=\"condition\">1=1</property>"
            + "<property name=\"orderby\">order by ${A}</property>"
            + "<property>"
            + "	<array componentType=\"String\">"
            + "<property>A</property>"
            + "<property>B</property>"
            + "</array>"
            + "</property>"
            + "</array>"
            + "</property>"
            + "</property>"
            + "</property>"
            + "</call>"
            + "</esb>";
    SOAApplicationContext context = new SOAApplicationContext(content);

    SOAMethodCall object = context.getTBeanObject("soamethodcall", SOAMethodCall.class);
    System.out.println(object);
    String xmlcontent =
        ObjectSerializable.convertSOAMethodCallToXMLMethod(
            object, ObjectSerializable.CHARSET_UTF_8);
    System.out.println(xmlcontent);

    context = new SOAApplicationContext(xmlcontent);
    object = context.getTBeanObject("soamethodcall", SOAMethodCall.class);
  }