SOAPリクエストボディで複数のタグを処理する方法
-
12-12-2019 - |
質問
私のアプリでSOAP WebServiceを使用しています。私が直面している問題は、SOAPリクエストボディに1つの追加タグがあります。そのため、SOAPフォルトエラーが表示されます。 "SOAPFault - FaultCode: 'SOAP:Server'のFieltString: 'サーバーは要求を処理できませんでした。--->オブジェクト参照はオブジェクトのインスタンスに設定されていません。FaultActor: 'NULL'詳細:org.kxml2.kdom.node@40516CE8 "。
これはSOAPリクエスト....
POST /appws.asmx HTTP/1.1
Host: www.xxxxxx.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://xxxxxxx.com/saveCustomerProfile"
<?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>
<saveCustomerProfile xmlns="http://xxxxxx.com/">
<customerProfile>
<id>long</id>
<name>string</name>
<lastName>string</lastName>
<phoneNumber>string</phoneNumber>
<zipCode>string</zipCode>
<email>string</email>
<birthday>string</birthday>
<gender>string</gender>
<emailExclusiveSavings>boolean</emailExclusiveSavings>
<textExclusiveSavings>boolean</textExclusiveSavings>
</customerProfile>
</saveCustomerProfile>
</soap:Body>
</soap:Envelope>
.
これは私がこのWebサービスを呼び出すために使用しているコードです
SoapObject request = new SoapObject(NAMESPACE, "saveCustomerProfile");
request.addProperty("id", 0);
request.addProperty("name","aaaaa");
request.addProperty("lastName","bbbbbb");
request.addProperty("phoneNumber", "1234567890");
request.addProperty("zipCode", "1234");
request.addProperty("email", "123@gmail.com");
request.addProperty("birthday", "02/02/2011");
request.addProperty("gender", "male");
request.addProperty("emailExclusiveSavings","true");
request.addProperty("textExclusiveSavings", "false");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(URL);
httpTransport.call(SOAP_ACTION, envelope);
System.out.println("response "+envelope.getResponse());
.
問題が起こっているところが見つかりました。
<saveCustomerProfile xmlns="http://xxxxxx.com/">
<customerProfile>
.
通常1つのメインタグのみが石鹸本体の内側にあります。ここでは2つあります。私はそれを処理する方法がわかりません。私は他のSOAP Webサービスが同じコードに取り組んでいます。私を助けてください。
解決
この チュートリアル ..Mightあなたを助ける:
所属していません StackOverflow