I have done a simple project to call wcf web service using ksoap2. But when it calls envelope.getResponse(); it gives error saying
Error: SoapFault - faultcode: 'a:InternalServiceFault' faultstring: 'The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.' faultactor: 'null' detail: null
package testing.wcf;
import java.io.IOException;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
import android.os.Bundle;
import android.os.StrictMode;
import android.widget.TextView;
import android.annotation.SuppressLint;
import android.app.Activity;
public class MainActivity extends Activity
{
private static final String strNAMESPACE = "http://www.testing.co.in/TestingService/";
private static final String strURL = "http://www.testing.co.in/TestingService/UserDetails.svc";
private static final String strSOAP_ACTION = "http://testing.co.in/TestingService/UserDetails/LoginDetails";
private static final String strMETHOD_NAME = "LoginDetails";
TextView tv;
StringBuilder sb;
String strInputXML;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tv = (TextView)findViewById(R.id.testing);
sb = new StringBuilder();
Call();
tv.setText(sb.toString());
//setContentView(tv);
}
public void Call()
{
try
{
SoapObject request = new SoapObject(strNAMESPACE, strMETHOD_NAME);
String inputxml = "<?xml version="+"\""+"1.0"+"\""+" encoding="+"\""+"utf-8"+"\""+" ?>" +"<MOB> \n <PIN>0000</PIN> \n <LOGINID>TEST</LOGINID> \n <PNUMBER>112233</pNUMBER> \n <REQUESTID>LoginVal</REQUESTID> \n </MOB>";
request.addAttribute("strInputXML", inputxml);
request.addAttribute("strOutputXML","");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(strURL);
androidHttpTransport.call(strSOAP_ACTION, envelope);
SoapPrimitive result = (SoapPrimitive)envelope.getResponse();
String resultData = result.toString();
sb.append(resultData + "\n");
}
catch(Exception e)
{
sb.append("Error:\n" + e.getMessage() + "\n");
}
}
}
Here I want to send the request like this
<?xml version="1.0" encoding="utf-8" ?>
<PhoneData>
<PINNO>0000</PINNO>
<LOGINID>HELLO</LOGINID>
<PASSWORD>1234</PASSWORD>
<REQID>0</REQID>
</PhoneData>
My respond XML should be
<?xml version="1.0" encoding="utf-8" ?>
<PhoneData>
<OTA>1234</OTA>
</PhoneData>