0

I had created webservice using jaxws in myeclipse5.1.1GA and I can call this webservice method in eclipse indigo64 bit. Problem is that when I can set parameters of webmethod which is in webservice using soap object's setparameter() method but it is not set in webservice's webmethod.

how to set parameter:

public class MyAsyncTask extends AsyncTask<String, Void, Object> {
    private String METHOD_NAME="";
    private String NAMESPACE="http://ws.easyway3e.com/";
    private String SOAP_ACTION="";
    private static final String URL="http://10.0.2.2:8080/WebService/DBConn?wsdl";
    @Override
    protected Object doInBackground(String... params) {
    System.out.println("Call-1 -----"+params[0]+","+params[1]+",
                       "+params[2]+","+params[3]);
    METHOD_NAME="openConnection";               
    SoapObject request=new SoapObject(NAMESPACE, METHOD_NAME);
    request.addProperty(DRIVERNAME);
    request.addProperty("d_Name",params[0]);
    request.addProperty("c_String",params[1]);
    request.addProperty("u_Name",params[2]);
    request.addProperty("pass",params[3]);
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope
                                         (SoapEnvelope.VER11);
    envelope.dotNet=true;
    envelope.setOutputSoapObject(request);
    System.out.println(envelope.bodyOut.toString());
    HttpTransportSE androidHttpTranportSE=new HttpTransportSE(URL);
    androidHttpTranportSE.setXmlVersionTag("<?xml version=\"1.0\" 
                                           encoding=\"UTF-8\"?>");
    try {
        SOAP_ACTION = NAMESPACE + METHOD_NAME;
        androidHttpTranportSE.call(SOAP_ACTION, envelope);
        SoapPrimitive  resultsRequestSOAP = (SoapPrimitive) envelope.getResponse();
        System.out.println(" Connection is =>"+resultsRequestSOAP.toString());

    } catch (IOException e) { e.printStackTrace(); } 
    Object result = null;
    try { result = envelope.getResponse(); } 
    return result;
}
sschrass
  • 7,014
  • 6
  • 43
  • 62
user1508234
  • 7
  • 1
  • 5

1 Answers1

0

You have already answered your own question.You have put

request.addProperty("d_Name",params[0]);

and this is correct way to add parameter to SOAP webservice.

You can also refer the following links to clear your concept about webservice all in android.

web service in android/eclipse

http://www.ibm.com/developerworks/webservices/library/ws-android/index.html

Community
  • 1
  • 1
himanshu
  • 1,990
  • 3
  • 18
  • 36