SoapUI insert xml from file in soap request

北城以北 提交于 2019-12-04 11:50:12

You can use the context.

Put a symbol that looks like this you XML:

${myFileStuff}

In a Groovy Step that is executed before this put:

    BufferedReader br = null;

    try {

        String sCurrentLine = "";
        String myFileStuff= "";

        br = new BufferedReader(new FileReader("C:\\testing.txt"));

        while ((sCurrentLine = br.readLine()) != null) {
            myFileStuff += sCurrentLine;
        }

    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        try {
            if (br != null)br.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
    context.setProperty("myFileStuff", myFileStuff)

I slightly modified the code example here for the file read. There are many ways to go:

http://www.mkyong.com/java/how-to-read-file-from-java-bufferedreader-example/

You can get the import statements there.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!