ketan-sharma-developer / ksoap2-android

Automatically exported from code.google.com/p/ksoap2-android
0 stars 0 forks source link

Send an Empty Body within the Envelope #77

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I need to send an Body like this:
<v:Body></v:Body>

But I cant get rid of the content between the body tags when using 
HttpTransportSE and SoapSerializationEnvelope.

The closest thing I can get is:
<v:Body>< /></v:Body> But then I get an SoapFault "name expected". Is it 
possible or can you make it possible?

Original issue reported on code.google.com by f...@digroli.com on 19 Aug 2011 at 12:53

GoogleCodeExporter commented 8 years ago
That might be true. I do not have the time to debug into the library and figure 
it out for you but if you do and fix it I can apply the patch and produce a new 
release. 

Original comment by mosa...@gmail.com on 19 Aug 2011 at 6:23

GoogleCodeExporter commented 8 years ago
I'll take a look at it, you'll hear from me during the following week. 

Best Regard 
Finn Larsen

Den 19/08/2011 kl. 20.24 skrev ksoap2-android@googlecode.com:

Original comment by f...@digroli.com on 21 Aug 2011 at 7:34

GoogleCodeExporter commented 8 years ago
I have fixed the problem by creating my own SoapSerializationEnvelope extending 
the original one and overridering the writeBody method with this:
@Override
    public void writeBody(XmlSerializer writer) throws IOException
    {
        if (bodyOut!=null){
        super.writeBody(writer);
        } 

    }
To use it, you just have to use the custom SoapSerializationEnvelope and set 
envelope.bodyOut=null;

I dont know if you want to cut a new release with this code. I would  possibly 
make a new method in the original SoapEnvelope called setEmptyEnvelope(). But 
that's up to you. 
You could get along with this, but then you would need to make a respectable
 documentation so people would know this is how it's done.

Hope I could help.

Finn Larsen

Den 19/08/2011 kl. 20.24 skrev ksoap2-android@googlecode.com:

Original comment by f...@digroli.com on 24 Aug 2011 at 8:14

GoogleCodeExporter commented 8 years ago
Why would you need the method setEmptyEnvelope? If I just pull in the bodyOut 
based logic you have that is not sufficient? 

Original comment by mosa...@gmail.com on 24 Aug 2011 at 6:36

GoogleCodeExporter commented 8 years ago
Also is your digroli email ok for the license file? 

Original comment by mosa...@gmail.com on 24 Aug 2011 at 6:38

GoogleCodeExporter commented 8 years ago
Well it's up to you. The fix i've made is sufficient. 

I would prefer you assigned it to finn.h.larsen@gmail.com if it's ok?

Den 24/08/2011 kl. 20.40 skrev ksoap2-android@googlecode.com:

Original comment by f...@digroli.com on 24 Aug 2011 at 6:44

GoogleCodeExporter commented 8 years ago
Well.. the method would just set body out to null right... might be a nice to 
have. 

Original comment by mosa...@gmail.com on 24 Aug 2011 at 6:56

GoogleCodeExporter commented 8 years ago
Exactly. It would be easier for the users knowing that if they set 
envelope.setEmptyBody(true) then the body would be empty. But then again, the 
other code would do just fine. 

Den 24/08/2011 kl. 20.57 skrev ksoap2-android@googlecode.com:

Original comment by f...@digroli.com on 24 Aug 2011 at 7:10

GoogleCodeExporter commented 8 years ago
Fix is in github. Will be released with 2.5.8 release

Original comment by mosa...@gmail.com on 25 Aug 2011 at 6:58