Ola Pessoal crie um webservice no eclipe para que o android possa consulmir ela fiz os teste com ws e esta ok porem quando faco a conexao com android esta dando erro
a minha classe esta assim
package br.com.dsoft;
import android.app.Activity;
import android.os.Bundle;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.ksoap2.serialization.PropertyInfo;
import android.widget.TextView;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
public class WebActivity extends Activity {
/** Called when the activity is first created. */
private static final String NAMESPACE = “http://br.webservice.br”;
private static String URL=“http://localhost:8080/Webservice/services/Dsoftws?WSDL”;
private static final String METHOD_NAME = “algo”;
private static final String SOAP_ACTION = “http://br.webservice.br/algo”;
private TextView lblResult;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
System.out.println("Ola Carrega lbserul");
lblResult = (TextView) findViewById(R.id.result);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo propInfo=new PropertyInfo();
propInfo.name="arg0";
propInfo.type=PropertyInfo.STRING_CLASS;
request.addProperty(propInfo, "John Smith");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive resultsRequestSOAP = (SoapPrimitive) envelope.getResponse();
lblResult.setText(resultsRequestSOAP.toString());
} catch (Exception e) {
}
}
}
meu ws esta assim
<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions targetNamespace=“http://br.webservice.br” xmlns:apachesoap=“http://xml.apache.org/xml-soap” xmlns:impl=“http://br.webservice.br” xmlns:intf=“http://br.webservice.br” xmlns:wsdl=“http://schemas.xmlsoap.org/wsdl/” xmlns:wsdlsoap=“http://schemas.xmlsoap.org/wsdl/soap/” xmlns:xsd=“http://www.w3.org/2001/XMLSchema”>
wsdl:types
</wsdl:types>
<wsdl:message name=“algoRequest”>
<wsdl:part element="impl:algo" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name=“algoResponse”>
<wsdl:part element="impl:algoResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name=“Dsoftws”>
<wsdl:operation name="algo">
<wsdl:input message="impl:algoRequest" name="algoRequest">
</wsdl:input>
<wsdl:output message="impl:algoResponse" name="algoResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name=“DsoftwsSoapBinding” type=“impl:Dsoftws”>
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="algo">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="algoRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="algoResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name=“DsoftwsService”>
<wsdl:port binding="impl:DsoftwsSoapBinding" name="Dsoftws">
<wsdlsoap:address location="http://localhost:8080/Webservice/services/Dsoftws"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
fico no aguardo Obrigado