I have enabled debug mode by setting httpTransport.debug = true
. However, httpTransport.requestDump
does not show anything. May I have a hint as to why it is not working please? Is there any way I can view the soap message created in the envelope?
Thank you very much for your help.
final String NAMESPACE = getString(R.string.namespace);
final String METHOD_NAME = getString(R.string.method_name);
final String SOAP_ACTION = getString(R.string.soap_action);
final String SERVICE_URL = getString(R.string.service_url);
final String API_KEY = getString(R.string.api_key);
StringBuilder sb = new StringBuilder();
sb.append("<APIKey>");
sb.append(API_KEY);
sb.append("</APIKey><ISBN>");
sb.append(ean);
sb.append("</ISBN><Modifiers></Modifiers>");
Log.d(TAG, sb.toString());
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
// GetAvailabilityInfoRequest availability = new GetAvailabilityInfoRequest(API_KEY, ean);
request.addProperty("GetAvailabilityInfoRequest", sb.toString());
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = false;
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(SERVICE_URL);
httpTransport.debug = true;
try {
httpTransport.call(SOAP_ACTION, envelope);
Log.d(TAG, httpTransport.requestDump);
Log.d(TAG, httpTransport.responseDump);
} catch (Exception e) {
Log.e(TAG, "Error ", e);
}
This is my request,
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:xsi="w3.org/2001/XMLSchema-instance";
xmlns:xsd="w3.org/2001/XMLSchema";
xmlns:soap="schemas.xmlsoap.org/soap/envelope/">;
<soap:Body>
<GetAvailabilityInfoRequest xmlns="nlb.gov.sg/ws/CatalogueService">;
<APIKey>****APIKEY***</APIKey>
<ISBN>9781579124854</ISBN>
<Modifiers></Modifiers>
</GetAvailabilityInfoRequest>
</soap:Body>
</soap:Envelope>
Best Regards, JN
I assume you are trying to create a request as follows,
<Body>
<GetAvailabilityInfoRequest>
<APIKey>key</APIKey>
<ISBN>ean</ISBN>
<Modifiers></Modifiers>
</GetAvailabilityInfoRequest>
</Body>
Also I assume your METHOD_NAME
is GetAvailabilityInfoRequest
.
Try the following code to create the request,
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("APIKey", key);
request.addProperty("ISBN", ean);
request.addProperty("Modifiers", "");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = false;
envelope.setOutputSoapObject(request);