I am working on a project where i have to make a SOAP Request object from the following code:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mod="http://www.tmforum.org/xml/tip/model" xmlns:prob="http://www.tmforum.org/xml/tip/cbe/problem" xmlns:geo="http://www.tmforum.org/xml/tip/cbe/loc/geo" xmlns:loc="http://www.tmforum.org/xml/tip/cbe/loc" xmlns:tt="http://www.tmforum.org/xml/tip/cbe/tt" xmlns:ent="http://www.tmforum.org/xml/tip/internal/entity" xmlns:ext="http://www.tmforum.org/xml/tip/cbe/problem/extensions">
<soapenv:Header/>
<soapenv:Body>
<mod:retrieveProblemRequest>
<!--Optional:-->
<mod:customerProblem>
<!--Optional:-->
<prob:problemId>0005004426</prob:problemId>
</mod:customerProblem>
</mod:retrieveProblemRequest>
</soapenv:Body>
</soapenv:Envelope>
I am using KSOAP2 to make request object but suffereing a problem in assigning namespaces, so the request sent is always incorrect.
Kindly provide me the Code to convert this SoapRequest into SoapObject in android..
EDIT: my code is as follows:
private static String SOAP_ACTION1 = "/BusinessServices/Inbound/TIP_R4GCanonicalModel_model_problemservicev1dot3-service0.serviceagent/ProblemServiceV1dot3Endpoint0/retrieveProblem";
private static String REQUEST_TARGET_NAMESAPCE="http://xmlns.example.com/1362214927265/";
private static String TARGET_NAMESPACE_MOD = "http://www.tmforum.org/xml/tip/model/";
private static String NAMESPACE_PROB="http://www.tmforum.org/xml/tip/cbe/problem/";
private static String METHOD_NAME = "retrieveProblem";
private static String URL = "http://10.128.28.44:10005/BusinessServices/Inbound/ProblemService_proxy.serviceagent/ProblemServiceV1dot3Endpoint0";
public static String LOG_TAG = "SOAPRequestResponseActivity";
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btnFar = (Button) findViewById(R.id.btnFar);
btnFar.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
// Initialize soap request + add parameters
SoapObject request = new SoapObject(REQUEST_TARGET_NAMESAPCE,METHOD_NAME);
SoapObject retrieveInfo=new SoapObject(TARGET_NAMESPACE_MOD,"retrieveProblemRequest");
SoapObject customerObject=new SoapObject(TARGET_NAMESPACE_MOD, "customerProblem");
PropertyInfo info=new PropertyInfo();
info.setNamespace(NAMESPACE_PROB);
info.setName("problemId");
info.setValue("0005004426");
customerObject.addProperty(info);
retrieveInfo.addSoapObject(customerObject);
request.addSoapObject(retrieveInfo);
Log.i(LOG_TAG, "===Request soap object after params=="
+ request.toString());
// Declare the version of the SOAP request
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.implicitTypes=true;
envelope.setOutputSoapObject(request);
try {
HttpTransportSE androidHttpTransport = new HttpTransportSE(
URL);
ArrayList<HeaderProperty> headerProperty = new ArrayList<HeaderProperty>();
headerProperty.add(new HeaderProperty("SOAPAction", "/BusinessServices/Inbound/TIP_R4GCanonicalModel_model_problemservicev1dot3-service0.serviceagent/ProblemServiceV1dot3Endpoint0/retrieveProblem"));
androidHttpTransport.call(SOAP_ACTION1, envelope,headerProperty);
As Soon As Call methode is called it throws Exception HttpRequestFailed with error code 500.Since the request is incorrect somewhere server is not able to parse it.
Kindly provide me appropriate solution.