The script below does a SOAP requirment (wsdl = "http://ws.cdyne.com/ip2geo/ip2geo.asmx?wsdl") ... from an IP address that is entered by the user illustrated in the figure 1, and then returns the regional information of this IP and fills in the table also shown in the figure 1.
​
Page is called Soaptestpublic Response actionIndex() throws IOException, IllegalArgumentException, IllegalAccessException {Soaptest model = new Soaptest();model.load();SoaptestView view = new SoaptestView();/*----#gen-exampleEXAMPLES COPY/PASTE:INFO: Core.query(null,... change 'null' to your db connection name, added in Application Builder.model.loadTable_1(Core.query(null,"SELECT 'Accusantium perspiciatis amet' as cidade,'Sit natus sit aperiam sit' as country,'Lorem unde ut rem consectetur' as country_code,'Omnis ut voluptatem unde rem' as latitude,'Rem totam accusantium deserunt' as longitude,'Magna ipsum doloremque totam u' as provincia "));----#gen-example *//*----#start-code(index)----*/​String wsdlUrl = "http://ws.cdyne.com/ip2geo/ip2geo.asmx?wsdl";​// An Map of Soap HTTP HeadersMap<String, String> headers = new HashMap<String, String>();headers.put("soapAction", "http://ws.cdyne.com/ResolveIP");​// An Map of Soap Envelope namespaceMap<String, String> namespaces = new HashMap<String, String>();namespaces.put("SOAP-ENV", "http://www.w3.org/2003/05/soap-envelope");namespaces.put("ws", "http://ws.cdyne.com/");​// <ws:ResolveIP>// <ws:ipAddress>?</ws:ipAddress>// <ws:licenseKey>?</ws:licenseKey>//</ws:ResolveIP>​Map<String, Object> bodyContent = new HashMap<String, Object>();Map<String, Object> subContent = new HashMap<String, Object>();if (Core.isNotNull(model.getIp_address())) {​subContent.put("ws:ipAddress", model.getIp_address());subContent.put("ws:licenseKey", "");bodyContent.put("ws:ResolveIP", subContent);​nosi.core.webapp.webservices.soap.SoapClient sc = Core.soapClient(wsdlUrl, namespaces, headers,bodyContent);​if (sc != null && sc.hasErrors()) { // Verifica se ocorreu algum erro ...Core.setMessageError(Arrays.toString(sc.getErrors().toArray()));} else {// Preencher os dados na tabela​// retorna soap body como um java.util.MapMap<String, Object> map = sc.getResponseBody("soap");if (map != null) {List<Soaptest.Table_1> table1 = new ArrayList<>();map = (Map<String, Object>) map.get("ResolveIPResponse");if (map != null)map.forEach((k, v) -> {Map<String, String> l = (Map<String, String>) v;​Soaptest.Table_1 row = new Soaptest.Table_1();row.setCidade(l.get("City"));row.setCountry(l.get("Country"));row.setCountry_code(l.get("CountryCode"));row.setLatitude(l.get("Latitude"));row.setLongitude(l.get("Longitude"));row.setProvincia(l.get("StateProvince"));​table1.add(row);});model.setTable_1(table1);}​}}​/*----#end-code----*/view.setModel(model);return this.renderView(view);}