documentbuilderfactory factory = documentbuilderfactory.newinstance(); factory.setnamespaceaware(true);//开启命名空间 documentbuilder builder = factory.newdocumentbuilder(); document doc = builder.parse(new inputsource(new stringreader(result.tostring())));//用xml串构造源system.out.println(getasipreturnstring(doc));private node getsoapbody(document doc) { nodelist bodynodelist = doc.getelementsbytagnamens(soap_ns, "body"); int bodynodelistlength = bodynodelist.getlength(); node body = null; // 找到body if (bodynodelistlength > 0) { body = bodynodelist.item(0); } return body; }private string getasipreturnstring(document doc) { string asipreturnstring = null; nodelist asipresponsenodelist = doc.getelementsbytagnamens(asip_ns, "callresponse"); int asipresponsenodelistlength = asipresponsenodelist.getlength(); node asipresponse = null; if (asipresponsenodelistlength > 0) { // 找到callresponse节点 asipresponse = asipresponsenodelist.item(0); if (asipresponse != null) { // 找到callreturn节点 node asipcallreturn = asipresponse.getfirstchild(); asipreturnstring = asipcallreturn.gettextcontent(); } } return asipreturnstring; }