WebService返回0或错误

时间:2017-05-25 15:42:04

标签: java web-services soap

我想恢复数据库中的数据,但我与数据库的链接不起作用。 当我在没有参数的情况下调用我的WebService时,没关系。 但是当我尝试使用参数时不起作用。

My Class for call my webService:

 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

1 个答案:

答案 0 :(得分:0)

我发现了我的问题:

更改

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

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