この SOAP リクエストを Java (Android) に変換する必要があります。そのためにksoap2ライブラリを使用していますが、認証が必要なエラーが発生し続けます。
私のJavaコード
SoapObject remoteUser = new SoapObject(NAMESPACE, "RemoteUser");
remoteUser.addProperty("UserLogin", "ws_admin");
remoteUser.addProperty("UserPassword", "Password1");
SoapObject userContact = new SoapObject(NAMESPACE, "UserContact");
userContact.addProperty("UserLogin", "sqa101");
userContact.addProperty("UserPassword", "Password1");
request.addSoapObject(remoteUser);
request.addSoapObject(userContact);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
webResponse = response.toString();
これは私が得るエラーです: 08-19 09:58:35.690: W/System.err(737): SoapFault - faultcode: 'SOAP-ENV:Server' faultstring: '3001: 不明なユーザーがメッセージ タイプ UserAuthenticationRequest を実行しようとしています。認証が必要です。faultactor: 'null' 詳細: org.kxml2.kdom.Node@40585a08
どんな助けでも大歓迎です。
更新: 答えが見つかりました。問題は、使用した形式にありました。次のコードは機能しました。
PropertyInfo remoteUser =new PropertyInfo();
remoteUser.setName("RemoteUser");
SoapObject login = new SoapObject();
login.addProperty("UserLogin", "admin");
login.addProperty("UserAuthenticator", "Password");
remoteUser.setValue(login);
remoteUser.setType(String.class);
request.addProperty(remoteUser);
PropertyInfo userContact =new PropertyInfo();
userContact.setName("UserContact");
SoapObject login2 = new SoapObject();
login2.addProperty("UserLogin", "username");
login2.addProperty("UserPassword", "Password");
userContact.setValue(login2);
userContact.setType(String.class);
request.addProperty(userContact);