重複の可能性:
Android の KSOAP で問題をシリアル化できません
私のアプリケーションでは、SOAP サービスを使用しています。SOAP リクエストの構造は
<authentication>
<LoginID>string</LoginID>
<Password>string</Password>
</authentication>
<ID>int</ID>
<ID>int</ID>
<dojStr>string</dojStr>
<Data>
<Keys>
<POfStringString>
<V>string</V>
<K>string</K>
</POfStringString>
<POfStringString>
<V>string</V>
<K>string</K>
</POfStringString>
</Keys>
<CriteriaKeys>
<POfStringString>
<V>string</V>
<K>string</K>
</POfStringString>
<POfStringString>
<V>string</V>
<K>string</K>
</POfStringString>
</CriteriaKeys>
<No>int</No>
<Size>int</Size>
</Data>
</soap:Body>
</soap:Envelope>
私のコードは次のとおりです。
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapObject authentication = new SoapObject(NAMESPACE,"authentication");
SoapObject pagination = new SoapObject(NAMESPACE,"pagination");
authentication.addProperty(usrid);
authentication.addProperty(pass);
request.addSoapObject(authentication);
request.addProperty(Id);
request.addProperty(Id);
request.addProperty(dte);
PropertyInfo page =new PropertyInfo();
page.setName("V");
// page.setName("K");
page.setValue("10");
page.setType(String.class);
pagination.addProperty(page);
request.addSoapObject(pagination);
request.addProperty(no);
request.addProperty(size);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
// envelope.addMapping(NAMESPACE, "authentication", new Array().getClass());
envelope.dotNet=true;
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try
{
androidHttpTransport.call(SOAP_ACTION,envelope);
// SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
Object result=(Object)envelope.getResponse(); ----->Getting error here.
私が得ているエラーは次のとおりです。
java.lang.NullPointerException
at java.io.Writer.write(Writer.java:152)
at org.kxml2.io.KXmlSerializer.startTag(KXmlSerializer.java:407)
at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:660)
at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:645)
at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:642)
at org.ksoap2.serialization.SoapSerializationEnvelope.writeElement(SoapSerializationEnvelope.java:702)
at org.ksoap2.serialization.SoapSerializationEnvelope.writeBody(SoapSerializationEnvelope.java:618)
at org.ksoap2.SoapEnvelope.write(SoapEnvelope.java:198)
at org.ksoap2.transport.Transport.createRequestData(Transport.java:111)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:119)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95)
at com.redbus.SearchRoute.onCreate(SearchRoute.java:151)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.access$2200(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
入力を正しく設定しているか、間違っていたかに関係なく、事前に感謝します。