我已经使用jaxws
in创建了 webservice myeclipse5.1.1GA
,我可以在eclipse indigo64 bit
. 问题是当我可以使用soap对象的setparameter()
方法在webservice中设置webmethod的参数但它没有在webservice的webmethod中设置时。
如何设置参数:
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;
}