ksoap2のアンドロイドデバイスでデータを取得するために、Webサービスに接続しようとしています。私は、設定が正しく作る持っていると私は戻って、Webサービスから取得する結果がanyTypeの{}である私が使用するコードはksoap withアンドロイド
private static final String NAMESPACE = "http://tempuri.org/" ;
private static final String URL = "http://IP/CardiacPortalWS/VitalInfoWS.asmx";
private static final String HelloWorld_SOAP_ACTION = "http://tempuri.org/getPatient";
private static final String METHOD_NAME1 = "getPatient";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);
request.addProperty("patientID",8);
SoapSerializationEnvelope envelope =new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);
androidHttpTransport.debug=true;
SoapObject receivedString=null;
try
{
androidHttpTransport.call(HelloWorld_SOAP_ACTION, envelope);
receivedString = (SoapObject)envelope.getResponse();
Log.v("Server", "server data1 "+receivedString.getPropertyCount());
Log.i("Server", "server data2 "+receivedString.getProperty(0));
}
catch(Exception e)
{ }
の下SOAPファイルが
のSOAPActionであることを前提とし"http://tempuri.org/getPatient"
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getPatient xmlns="http://tempuri.org/">
<patientID>int</patientID>
<name>string</name>
<SID>string</SID>
<sex>boolean</sex>
<birthday>dateTime</birthday>
<nationality>string</nationality>
<telephone>string</telephone>
<telephone1>string</telephone1>
<email>string</email>
<maritalStatusName>string</maritalStatusName>
<educationName>string</educationName>
<ejectionFraction>int</ejectionFraction>
<profession>string</profession>
<deathDateTime>dateTime</deathDateTime>
<deathReason>string</deathReason>
<isDead>boolean</isDead>
</getPatient>
</soap:Body>
</soap:Envelope>
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getPatientResponse xmlns="http://tempuri.org/">
<getPatientResult>
<message>string</message>
<code>int</code>
</getPatientResult>
<name>string</name>
<SID>string</SID>
<sex>boolean</sex>
<birthday>dateTime</birthday>
<nationality>string</nationality>
<telephone>string</telephone>
<telephone1>string</telephone1>
<email>string</email>
<maritalStatusName>string</maritalStatusName>
<educationName>string</educationName>
<ejectionFraction>int</ejectionFraction>
<profession>string</profession>
<deathDateTime>dateTime</deathDateTime>
<deathReason>string</deathReason>
<isDead>boolean</isDead>
</getPatientResponse>
</soap:Body>
</soap:Envelope>
私はこの問題は、この行にrequest.addProperty( "patientID"、8)であると仮定する。ですが、わかりません。サーバー上のデータは、それらを見ることができるために存在します。 私はいくつかの助け、アイデア、または詳細のチュートリアルをお礼します
申し訳ありません...ウル問題は何ですか? –
私の問題は、results.ifを取得していない、私は間違ったpatientIDを書くか、私は間違ったID番号を書く場合私の結果は:anyType {message =患者IDは存在しません。コード= -1; }私はこの時点まで、私はgetPatient xmlに行き、正しい結果を見つけると思います。フィールドのpathientIDに正しい情報を追加すると、結果は次のようになります。anyType {message = anyType {};コード= 0; } – prokopis
このエラーはwebSeviceによって返され、サーバー側で何らかのエラーが発生していることを意味します。また、どのパラメータがオプション(nullではない)であるかを一度確認してください。 –