Understanding a java class of a wsdl service
我正在尝试用Java编写WSDL Web服务的测试代码。这段代码返回了一些变量的值,必须进行排序。在这个代码中,我在C语言上有EN等价物,但是我不理解如何用Java进行转换。这是我在Java中的代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | package betdaqclient; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.xml.bind.JAXBElement; public class test { public static void main(String[] args) { ExternalApiHeader externalAPIHeader = new ExternalApiHeader(); externalAPIHeader.languageCode ="en"; externalAPIHeader.username ="myusername"; externalAPIHeader.password ="mypassword"; externalAPIHeader.version = new BigDecimal ("2.0"); ReadOnlyService_Service ro = new ReadOnlyService_Service(); ReadOnlyService readOnlyService = ro.getReadOnlyService(); SecureService_Service ss = new SecureService_Service(); SecureService secureService = ss.getSecureService(); GetAccountBalancesRequest getAccountBalanceRequest = new GetAccountBalancesRequest(); GetAccountBalancesResponse2 getAccountBalanceResponse = secureService.getAccountBalances(getAccountBalanceRequest, externalAPIHeader); System.out.printf("%n%nUser :" + externalAPIHeader.username); System.out.printf("%nBalance :" + getAccountBalanceResponse.balance.toString()); System.out.printf("%nExposure :" + getAccountBalanceResponse.exposure.toString()); System.out.printf("%nAvailable:" + getAccountBalanceResponse.availableFunds.toString()+"%n"); SimpleOrderRequest bet = new SimpleOrderRequest(); bet.selectionId = (long) IdMarket; bet.polarity = (byte) 1 ; //<-----BACK? bet.stake = new BigDecimal("1.00") ; bet.price = new BigDecimal("1.01") ; bet.cancelOnInRunning = true ; PlaceOrdersNoReceiptRequest request = new PlaceOrdersNoReceiptRequest(); /* Lacking Code */ PlaceOrdersNoReceiptResponse2 response = secureService.placeOrdersNoReceipt(request,externalAPIHeader); } } |
我想我的
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | public long[] PlaceOrdersNoReceipt(long selectionId, byte polarity, decimal amount , decimal odds, byte resetCount) { SimpleOrderRequest order = new SimpleOrderRequest(); order.SelectionId = selectionId; order.Polarity = polarity; order.Stake = amount; order.Price = odds; order.ExpectedSelectionResetCount = resetCount; PlaceOrdersNoReceiptRequest request = new PlaceOrdersNoReceiptRequest(); request.Orders = new SimpleOrderRequest[1] {order}; PlaceOrdersNoReceiptResponse response = _proxy.PlaceOrdersNoReceipt(request); if (response.ReturnStatus.Code != 0) throw new Exception(response.ReturnStatus.Description); return response.OrderHandles; } |
号
这是从WSDL构建的类的定义:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name ="PlaceOrdersNoReceiptRequest", propOrder = { "orders", "wantAllOrNothingBehaviour" }) public class PlaceOrdersNoReceiptRequest { @XmlElement(name ="Orders", required = true) protected PlaceOrdersNoReceiptRequest.Orders orders; @XmlElement(name ="WantAllOrNothingBehaviour") protected boolean wantAllOrNothingBehaviour; public PlaceOrdersNoReceiptRequest.Orders getOrders() {return orders;} public void setOrders(PlaceOrdersNoReceiptRequest.Orders value) {this.orders = value;} public boolean isWantAllOrNothingBehaviour() { return wantAllOrNothingBehaviour; } public void setWantAllOrNothingBehaviour(boolean value) {this.wantAllOrNothingBehaviour = value;} @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name ="", propOrder = {"order"}) public static class Orders { @XmlElement(name ="Order", required = true) protected List<SimpleOrderRequest> order; public List<SimpleOrderRequest> getOrder() { if (order == null) { order = new ArrayList<SimpleOrderRequest>(); } return this.order; } } } |
问题是,我如何将电子类的
缺少的代码应该是
1 2 3 4 5 |