Olá, estou com problemas para consumir um webservice utiliznado KSoap2.
O requisição para o método “ValidUser” do webservice deveria retornar uma resposta boolean,
porem a messagem que retorna é : “Server was unable to process request. —> Object reference not set to an instance of an object.”.
Segue abaixo o código em que estou fazendo os testes.
import org.ksoap2.SoapEnvelope;
import org.ksoap2.SoapFault;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import com.lexmark.prtapp.ksoap.HttpTransport;
public class Teste
{
public static void main (String args[])
{
String operation="ValidUser";
String ServiceNamespace = "http://tempuri.org";
String ServiceEndpointURL = "http://www.n-billing.com/TestLexmarkWS/TestLexmarkWS_01.asmx";
String Soap_Action=ServiceNamespace+"/"+operation;
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER10);
HttpTransport ht=new HttpTransport(ServiceEndpointURL);
SoapObject soapBody;
try
{
//Criando Objeto Soap e adicinando parametros parametros
soapBody = new SoapObject(ServiceNamespace, operation);
soapBody.addProperty("user","admin");
soapBody.addProperty("password","321");
//Set propertys envelope
envelope.dotNet=true;
envelope.bodyOut = soapBody;
envelope.bodyIn=null;
//Chamado para webservice
ht.debug = true;
ht.call(Soap_Action,envelope);
//resposta webservice
if (envelope.bodyIn instanceof SoapFault)
{
SoapFault soapFault = (SoapFault) envelope.bodyIn;
System.out.println(soapFault.faultstring);
}
else
{
SoapObject result = (SoapObject) envelope.bodyIn;
System.out.println(result.getProperty(0).toString());
}
}
catch (Exception e)
{
System.out.println("Catch:-->"+e.getMessage());
}
}
}
Alguem teria a solução para esse problema?
obrigado.