Get the parameter of webservice xml

来源:互联网 发布:bitcomet端口阻塞问题 编辑:程序博客网 时间:2024/06/06 03:02

{//test1模块处理
            Pattern pattern = Pattern.compile("<test1.*?xmlns=.*?>.*?</test1>");         
            Matcher matcher = pattern.matcher(xmlDataFromServer);
            if(matcher.find()) {
                //System.out.println("matcher="+matcher.group());
                String paraall = matcher.group();
                //test过程,返回参数
                pattern = Pattern.compile("<s>.*?</s>");
                matcher = pattern.matcher(paraall);
                String myval="";
                if(matcher.find()) {
                    System.out.println("s="+matcher.group());
                    myval = matcher.group();
                    int npos1=myval.indexOf(">");
                    int npos2=myval.indexOf("</s>");
                    if(npos1>0&&npos2>0)
                    {
                        myval=myval.substring(npos1+1,npos2);
                        System.out.println("sreal="+myval);
                    }

                    
                }
         String ret = "    <soap:Envelope/r/n"
                +"        xmlns:soap=/"http://schemas.xmlsoap.org/soap/envelope//"/r/n"
                +"        xmlns:xsd=/"http://www.w3.org/2001/XMLSchema/"/r/n"
                +"        xmlns:xsi=/"http://www.w3.org/2001/XMLSchema-instance/">/r/n"
                +"        <soap:Body>/r/n"
                +"            <ns1:orderhadleResponse/r/n"
                +"                xmlns:ns1=/"http://www.118114ok.com//">/r/n"
                +"                <ns1:out>"+myval+"</ns1:out>/r/n"
                +"                </ns1:orderhadleResponse>/r/n"
                +"            </soap:Body>/r/n"
                +"        </soap:Envelope>/r/n";
                out.println(ret);
                return;
            }
}
原创粉丝点击