English 中文(简体)
在 Android 中显示肥皂网络服务响应吗?
原标题:Display Soap Webservices Response in Android?

Hi 想要在Android展示肥皂网络服务, 使用 ksoap2. 我使用以下代码。 当我在肥皂Ui Pro 测试时, 它显示 uput xml 罚款 。

httpTransport.call(SOAP_ACTION, envelope);
Object result = (Object) envelope.getResponse();
System.out.println("The Result"+result);

但我得到的例外 在我的日光滑滑雪滑雪, 如何我能克服这一点 在Android

例外:

05-25 15:13:15.105: WARN/System.err(1160): org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://www.w3.org/2001/12/soap-envelope}Envelope (position:START_TAG <{http://schemas.xmlsoap.org/wsdl/}wsdl:definitions targetNamespace= urn:sap-com:document:sap:soap:functions:mc-style >@1:686 in java.io.InputStreamReader@40546438) 
05-25 15:13:15.115: WARN/System.err(1160):     at org.kxml2.io.KXmlParser.exception(KXmlParser.java:273)

帮帮我吧

问题回答

您实际上正在得到 < enough > InputStream 的响应, 您只需要将其转换为字符串, 然后就可以显示它 。

使用以下代码:-

try {
    httpTransport.call(SOAP_ACTION, envelope);
    sb.append(httpTransport.requestDump);
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (XmlPullParserException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}


InputSource inStream = new InputSource();
inStream.setCharacterStream(new StringReader(sb.toString()));

如果有任何问题比告诉我还重要的话





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签