2017-05-25 159 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"; 
相關問題