Java android将soap xml解析为soapObject或SoapEnvelope

时间:2019-04-08 19:55:53

标签: java android

我尝试将String转换为soap对象,我这样做:

  try{
            String msg = "<SOAP-ENV:Envelope " + "xmlns:SOAP-ENV=\"http://www.w3.org/2001/12/soap- envelope\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"& gt;" +
                    "><SOAP-ENV:Body>" +
                    "<result>" +
                    "<message xsi:type=\"xsd:string\">Hello World</message>" +
                    "</result>" +
                    "</SOAP-ENV:Body>" +
                    "</SOAP-ENV:Envelope>";
            KXmlParser parser=new KXmlParser();
            parser.setInput((Reader)new StringReader(msg));
            SoapEnvelope soapenvelope= new SoapEnvelope(SoapEnvelope.VER12);
            soapenvelope.parseBody(parser);
        }
        catch (IOException e) {
            System.out.println("Error reading URI: " + e.getMessage());
        } catch (XmlPullParserException e) {
            System.out.println("Error in parsing: " + e.getMessage());
        }

但是它不能正确地工作

0 个答案:

没有答案
相关问题