Closed GoogleCodeExporter closed 8 years ago
I have been having the same problem I have been working on this for over a week
is there an alternative?
Original comment by Daysa...@gmail.com
on 18 Jul 2011 at 10:17
The only alternative I found (which I hate) was to build the request by hand:
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope
SoapEnvelope.VER10);
envelope.encodingStyle = SoapEnvelope.ENC;
StringBuilder envelopeXml = new StringBuilder();
envelopeXml.append("<soap:Envelope ");
envelopeXml.append("xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" ");
envelopeXml.append("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ");
envelopeXml.append("xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">");
envelopeXml.append("<soap:Body xmlns:ms='http://feh.com/FehService/v2'>");
envelopeXml.append("<ms:sendMessage>");
envelopeXml.append("<instructions>");
envelopeXml.append("<messageId>"123</messageId>");
envelopeXml.append("<recipients>"456"</recipients>");
envelopeXml.append("<shortText>"+shortText+"</shortText>");
envelopeXml.append("<longText>"+longText+"</longText>");
envelopeXml.append("</instructions>");
envelopeXml.append("</ms:sendMessage>");
envelopeXml.append("</soap:Body>");
envelopeXml.append("</soap:Envelope>");
String soapXML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
envelopeXml.toString();
URL url = new URL(soapUrl);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestProperty("SOAPAction", SOAP_ACTION_SEND);
connection.setRequestProperty("Content-Type", "text/xml");
connection.setRequestProperty("Content-Length","" + soapXML.getBytes().length);
connection.setRequestProperty("User-Agent", "kSOAP/2.0");
connection.setRequestProperty("Authorization", login);
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setConnectTimeout(CONNECTION_TIMEOUT);
// send the request
OutputStream os = null;
try {
os = connection.getOutputStream();
os.write(soapXML.getBytes(), 0, soapXML.getBytes().length);
} catch (Exception e) {
Log.e(LOG_TAG, "Error sending request.", e);
} finally {
if (os != null) {
try {
os.close();
} catch (Exception e2) {
// don't care
}
}
}
Original comment by jam.mon...@gmail.com
on 18 Jul 2011 at 2:47
Why dont you debug and see what adds the ns in the framework and provide a
patch that changes it?
Original comment by mosa...@gmail.com
on 18 Jul 2011 at 4:23
Project time constraints.
Original comment by jam.mon...@gmail.com
on 18 Jul 2011 at 5:57
Have you tried implict types = true?
Original comment by mosa...@gmail.com
on 25 Aug 2011 at 7:00
Hi, Is there an update on this solution, I am facing same problem in ksoap2.5.7
version. Appreciate your inputs in this regard.
Original comment by mukund.r...@gmail.com
on 7 Sep 2011 at 2:47
Not from my end.
Original comment by mosa...@gmail.com
on 7 Sep 2011 at 3:32
I am not a contributor to this project and have since dropped using it, so
unless someone else fixed it I can only assume the bug still exists.
Original comment by jam.mon...@gmail.com
on 8 Sep 2011 at 1:16
there is an ugly hack/workaround, comment // xsi = SoapEnvelope.XSI; in ctor of
SoapEnvelope class.
Original comment by rkovh...@gmail.com
on 17 Apr 2012 at 1:39
[deleted comment]
There is a proposed fix in the master branch on github now. Could those
affected by it please test and verify that it is working?
See https://github.com/mosabua/ksoap2-android/pull/21
Original comment by mosa...@gmail.com
on 5 Jun 2012 at 5:00
Or maybe provide a test case in SoapSerializationEnvelope that fails with a
desired output so we can fix it..
Original comment by mosa...@gmail.com
on 5 Jun 2012 at 6:13
This fix works, but I also wnat to eliminate attributes such as "root" element
from base object:
<?xml version="1.0" encoding="UTF-8"?>
<v:Envelope xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns:d="http://www.w3.org/2001/XMLSchema"
xmlns:c="http://schemas.xmlsoap.org/soap/encoding/">
<v:Header />
<v:Body>
<n0:get-method xmlns:n0="urn:mynamespace" id="o0" c:root="1">
<n0:mode>mm</n0:mode>
</n0:get-method>
</v:Body>
</v:Envelope>
Original comment by Dmitriy....@gmail.com
on 17 Aug 2012 at 9:28
That fix is in master now. I am not sure about removing the rest... maybe look
at the code and provide a pull request..
Original comment by mosa...@gmail.com
on 17 Aug 2012 at 7:30
Original comment by mosa...@gmail.com
on 13 Sep 2012 at 4:59
Original issue reported on code.google.com by
jam.mon...@gmail.com
on 6 Jul 2011 at 3:08