á estou há 1 mês pesquisando sobre o assunto e tudo o que consegui até
agora foi desenvolver um WS em Java, que realiza a consulta no MySQL e
retorna os dados de Latitude e Longitude de uma tabela de locais
específicos. Preciso fazer com que minha aplicação consuma o WS e
coloque o retorno do WS em uma variável.

O WS retorna o seguinte dado:

<ns:queryLatitudeResponse>
<ns:return>-25.421571</ns:return>
<ns:return>-26.878695</ns:return>
<ns:return>-27.878695</ns:return>
</ns:queryLatitudeResponse>

No Android, eu tenho uma classe que é responsável por consumir o WS e
ela armazena o resultado em variáveis que serão passadas por parâmetro
para outra classe:

    public class Conexao extends Activity {

        private static final String SOAP_ACTION = "http://localhost:
8080/axis2/services/ObterGeoPointService/queryLatitude";
        private static final String METHOD_NAME = "queryLatitude";
        private static final String NAMESPACE = "http://localhost:8080/
axis2/services/ObterGeoPointService";
        private static final String URL = "
http://localhost:8080/axis2/services/ObterGeoPointService?wsdl";;


        double lat, lon = 0;

        public Conexao() {

            try {
                SoapObject request = new SoapObject(NAMESPACE,
METHOD_NAME);
                SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(
                        SoapEnvelope.VER11);
                envelope.setOutputSoapObject(request);
                HttpTransportSE androidHttpTransport = new
HttpTransportSE(URL);
                androidHttpTransport.call(SOAP_ACTION, envelope);

                Object result = envelope.getResponse();
                String[] results = (String[]) result;
                lat =Double.parseDouble(results[0]);
                lon = Double.parseDouble(results[1]);

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        public double getLatitude(){
            return this.lat;
        }
        public double getLongitude(){
            return this.lon;
        }
    }

Para acessar o WS pelo navegador:

Service Description : ObterGeoPointService
Service EPR : http://localhost:8080/axis2/services/ObterGeoPointService
Available Operations

    queryLatitude
    queryNome_Local
    queryDados_Local
    queryLongitude
http://localhost:8080/axis2/services/ObterGeoPointService?wsdl

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to