在哪里查看生成的XML(KSOAP2) [英] Where to see the generated XML (KSOAP2)

查看:109
本文介绍了在哪里查看生成的XML(KSOAP2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难用SoapRequest来查看生成的XML.这是我的代码:

I'm having a hard time trying to get to see the generated XML with my SoapRequest. This is my code:

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 

        PropertyInfo propInfo=new PropertyInfo();
        propInfo.setName("arg0");
        propInfo.setType(PropertyInfo.STRING_CLASS);
        propInfo.setValue(sessionId);

        request.addProperty(propInfo);

        // Sending the array representing our board:

        Fields fieldsVector = new Fields();

        for (int i=0; i<65; i++) {

            fieldsVector.add(move[i].toString());

        }

        PropertyInfo fieldsPropertyInfo = new PropertyInfo();
        fieldsPropertyInfo.setName("fields");
        fieldsPropertyInfo.setValue(fieldsVector);
        fieldsPropertyInfo.setType(fieldsVector.getClass());

        request.addProperty(fieldsPropertyInfo);

        PropertyInfo sessionPropertyInfo = new PropertyInfo();
        sessionPropertyInfo.setName("arg0");
        sessionPropertyInfo.setType(PropertyInfo.STRING_CLASS);
        sessionPropertyInfo.setValue(sessionId);
        request.addProperty(sessionPropertyInfo);

        envelope.setOutputSoapObject(request);

        envelope.addMapping(NAMESPACE, "fields", new Fields().getClass());

        HttpTransportSE androidHttpTransport = new HttpTransportSE(WSDL_URL);
        // androidHttpTransport.debug = true;


        try {
            androidHttpTransport.call(SOAP_ACTION, envelope);
        } catch (Exception e) {
            throw new RuntimeException("Unexpected exception", e);
        }

        try {
            SoapPrimitive resultsRequestSOAP = (SoapPrimitive) envelope.getResponse();
        } catch (SoapFault e) {
            System.out.println("Error adding move: " + e.faultstring);//można to ładnie jakoś pokazać na ekranie
            throw e;
        }
    }

如您所见,我已经尝试设置调试模式,但是它不起作用.我应该在哪里可以看到输出?

As you can see I have tried setting debugging mode but it doesn't work. Where should I be able to see the output?

推荐答案

您几乎可以找到答案,设置androidHttpTransport.debug = true并按如下所示调用转储xml:

You almost reached the answer, set androidHttpTransport.debug = true and call dump xml like this:

   androidHttpTransport.debug = true;
   androidHttpTransport.call(SOAP_ACTION, envelope);
   Log.d("dump Request: " ,androidHttpTransport.requestDump);
   Log.d("dump response: " ,androidHttpTransport.responseDump);

这篇关于在哪里查看生成的XML(KSOAP2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆