[英]Calling a Java Web Service from a .Net Project - Handling arrays
我正在嘗試從我的 asp.net 代碼中調用一些用 Java 編寫的 web 服務。 我不知道 Java。
有幾種方法,每種方法都有多個屬性。 然后將這些方法傳遞給一種控制方法。 如何處理 arrays 會出現問題。 我似乎無法完全正確地使用語法。
例如,可以有 1 到 n 個位置。 每個位置都有多個屬性。 我可以建立一個位置。 但是如何構建一系列位置? 我嘗試了幾種方法。 這是我得到的最接近的。 它符合但在下面的第三行到最后一行崩潰。 我刪除了與解釋問題無關的代碼。
錯誤提示:Object 引用未設置為 object 的實例。
WebReferenceMERegistration.getMERegistration _myMERegistration =
new WebReferenceMERegistration.getMERegistration();
WebReferenceMERegistration.Locations _myLocation =
new WebReferenceMERegistration.Locations();
WebReferenceMERegistration.Locations[] _myLocations = null;
_myLocation.AddressLine1 = txtEmployerAddress1.Text;
_myLocation.AddressLine2 = txtEmployerAddress2.Text;
// more properties set here
_myLocations[0] = _myLocation;
_myMERegistration.Locations = _myLocations;
_Results = _myRegistrationService.getMERegistration(_myMERegistration);
int length = ...;
WebReferenceMERegistration.Locations[] _myLocations =
new WebReferenceMERegistration.Locations[length];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.