Я пытаюсь пройти аутентификацию на сервере SAP с помощью ksoap, и я застрял ... Кажется, он не хочет принимать во внимание мое имя пользователя и пароль. Это мой код:
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
List<HeaderProperty> headers = new ArrayList<HeaderProperty>();
String code = Base64.encode("usernametxt:pass".getBytes());
headers.add(new HeaderProperty("Authorization", "Basic " + code));
System.out.println("req dump: " + androidHttpTransport.requestDump);
MarshalBase64 marshal = new MarshalBase64();
marshal.register(envelope);
androidHttpTransport.call(SOAP_ACTION, envelope, headers);
String res = androidHttpTransport.responseDump;
Я получаю эту ошибку:
expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <html>@1:6 in java.io.InputStreamReader@40537cd0)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <html>@1:6 in java.io.InputStreamReader@40537cd0)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at org.kxml2.io.KXmlParser.exception(KXmlParser.java:273)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at org.kxml2.io.KXmlParser.require(KXmlParser.java:1424)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:127)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at org.ksoap2.transport.Transport.parseResponse(Transport.java:100)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:195)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at com.test.TestWebserviceActivity.onCreate(TestWebserviceActivity.java:78)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at android.os.Handler.dispatchMessage(Handler.java:99)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at android.os.Looper.loop(Looper.java:123)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at android.app.ActivityThread.main(ActivityThread.java:3683)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at java.lang.reflect.Method.invokeNative(Native Method)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at java.lang.reflect.Method.invoke(Method.java:507)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
[2012-01-25 12:25:14 - Emulator] W/System.err( 503): at dalvik.system.NativeStart.main(Native Method)
Ответ - null
, а androidHttpTransport.requestDump
- null
.
Что я делаю не так?
Спасибо