2017-05-25 99 views
0

我想恢复我的数据库上的数据,但我与数据库的链接不起作用。 当我打电话给我的WebService没有参数,没关系。 但是,当我尝试使用参数不起作用。WebService返回0或错误

我的班叫我的web服务:

public final String SOAP_ACTION = "http://webgarda20170508110006.azurewebsites.net/Add"; 

    public final String OPERATION_NAME = "Add"; 

    public final String NAMESPACE = "http://webgarda20170508110006.azurewebsites.net/"; 

    public final String SOAP_ADDRESS = "http://webgarda20170508110006.azurewebsites.net/Garda.asmx"; 
    public CallSoap() 
    { 
    } 
    public String Call(int a,int b) 
    { 
     SoapObject request = new SoapObject(NAMESPACE,OPERATION_NAME); 
     PropertyInfo pi=new PropertyInfo(); 
     pi.setName("a"); 
     pi.setValue(a); 
     pi.setType(Integer.class); 
     request.addProperty(pi); 
     pi=new PropertyInfo(); 
     pi.setName("b"); 
     pi.setValue(b); 
     pi.setType(Integer.class); 
     request.addProperty(pi); 

     SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
       SoapEnvelope.VER11); 
     envelope.dotNet = true; 

     envelope.setOutputSoapObject(request); 

     HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS); 
     Object response=null; 
     try 
     { 
      httpTransport.call(SOAP_ACTION, envelope); 
      response = envelope.getResponse(); 

     } 
     catch (Exception exception) 
     { 
      response=exception.toString(); 
     } 
     return response.toString(); 
    } 

link for the detail of my werbservice

+0

定义“不起作用”。 – litelite

+0

我的设置不被我的web服务读取。它不影响这两个变量。对于我的webService变量为空,并返回0.它返回相同的结果,如果我什么都不发送。 –

+0

因此输入参数(a和b)会被忽略? – litelite

回答

0

,我发现我的问题:

变化

public final String NAMESPACE="http://webgarda20170508110006.azurewebsites.net/"; 

public final String NAMESPACE="http://webgarda20170508110006.azurewebsites.net";