2016-12-13 9 views
0

を使用して、トラブル解析したSOAP Webサービスを持つことは、私はTxRefNumを取得する必要があり、私のSOAP Webサービスの構造である:ここでは、ライブラリksoap2

<?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:tem="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
<soap:Header/> 
<soap:Body> 
<tem:MakeCreditCardPayment> 
<tem:objCreditCardBookingPaymentRow> 
<tem:ProfessionalUserMappingStudioID>18</tem:ProfessionalUserMappingStudioID> 
<tem:ConsumerUserMappingStudioID>5</tem:ConsumerUserMappingStudioID> 
<tem:Cost>5</tem:Cost> 
<tem:CardNumber>4111111111111111</tem:CardNumber> 
<tem:CardHolderName>Shyam</tem:CardHolderName> 
<tem:ExpirationDate>042020</tem:ExpirationDate> 
<tem:CVV>123</tem:CVV> 
<tem:ProfessionalSessionID>320</tem:ProfessionalSessionID> 
<tem:TxRefNum></tem:TxRefNum> 
</tem:objCreditCardBookingPaymentRow> 
</tem:MakeCreditCardPayment> 
</soap:Body> 
</soap:Envelope> 

私は、次のデータを解析するためにksoap2ライブラリを使用していますが、午前それに対する適切な解決策を見つけることができません。ここで私はやっているものです:

final String NAMESPACE = "http://tempuri.org/"; 
      final String URL = NewURLs.BASE_URL + "api/PaymentService.asmx"; 
      final String SOAP_ACTION = "http://tempuri.org/MakeCreditCardPayment"; 
      final String METHOD_NAME = "MakeCreditCardPayment"; 
      final String INNER_METHOD_NAME = "tem:objCreditCardBookingPaymentRow"; 
      // the above parameter can be taken from the users web service 
      // (?WSDL) 
      // url 

      SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME); 
      SoapObject innerRequest = new SoapObject(NAMESPACE,INNER_METHOD_NAME); 
      innerRequest.addProperty("tem:ProfessionalUserMappingStudioID", bookingDetailsList.get(0).getUserMappingStudioID()); 
      innerRequest.addProperty("tem:ConsumerUserMappingStudioID",loginCredentials.getUserMappingStudioId()); 
      innerRequest.addProperty("tem:Cost",bookingDetailsList.get(0).getCost()); 
      innerRequest.addProperty("tem:CardNumber", creditCardNo); 
      innerRequest.addProperty("tem:CardHolderName", creditCardHolder); 
      innerRequest.addProperty("tem:ExpirationDate", expirationDate); 
      innerRequest.addProperty("tem:CVV", cvv); 
      innerRequest.addProperty("tem:ProfessionalSessionID",bookingDetailsList.get(0).getProfessionalSessionID()); 
      innerRequest.addProperty("tem:TxRefNum", ""); 

      request.addProperty("tem:objCreditCardBookingPaymentRow",innerRequest); 
      utils.sysOut("some text", "" + request); 

      SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
      envelope.dotNet = true; 
      envelope.setOutputSoapObject(request); 
      HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); 

      androidHttpTransport.call(SOAP_ACTION, envelope); 
      SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn; 
      String str = resultsRequestSOAP.toString(); 
      Log.v("TAG_SOAP_ACTION", str); 

答えて

0

は次のように試してみてください:

SoapObject res=(SoapObject)envelope.bodyIn; 
SoapObject t=(SoapObject)res.getProperty("MakeCreditCardPayment"); 

for(int i=0; i<t.getPropertyCount(); i++){ 
    SoapObject carditCard=(SoapObject)t.getProperty(i); 
    String userID = carditCard.getProperty("ProfessionalUserMappingStudioID").toString(); 
} 
+0

何URLについては? –

+0

どのURL? urlは要求を出して応答を得るために使用されます。 –

関連する問題