7

I have web service, which is returning XML data. but in the data I am receiving Null fields in the beginning of it. The actual data is also available but followed by Null fields. I am accessing the webservice in Android using ksoap2. SoapObject variable has full data but also have those null field, which is kinda creating problem to work with this service. here you can see, in the starting it has nothing but later it has data starting with Tag "Title"

04-12 10:55:09.405: D/ENVELOPE(1394): GetGuestEventsListingForServiceResponse{GetGuestEventsListingForServiceResult=anyType{schema=anyType{element=anyType{complexType=anyType{choice=anyType{element=anyType{complexType=anyType{sequence=anyType{element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; }; }; }; }; }; }; }; diffgram=anyType{NewDataSet=anyType{Table=anyType{Title=THE CLUSTER DAY-1,  JUNKOVATION; Description=anyType{}; EventDate=Apr 12, 2013; EventTime=5:00 PM; Venue=BLOCK 13-306; CreatedBy=16689; CreatedOn=2013-04-11T09:52:07.163+05:30; EventFor=All; Type=Internal; IsActive=true; };  
Cœur
  • 37,241
  • 25
  • 195
  • 267
JNI_OnLoad
  • 5,472
  • 4
  • 35
  • 60
  • Could you please share your WSDL formats for the request and the response ? – Swayam Apr 14 '13 at 19:15
  • Also, check your server side for `` and you can simply remove it as all the empty data is inside the `` tag. – Swayam Apr 14 '13 at 19:18

1 Answers1

1

I don't understand where is the problem. If you format result String as xml, you obtain this:

<GetGuestEventsListingForServiceResponse>
  <GetGuestEventsListingForServiceResult>
     <schema>
        <element>
          <complexType>
            <choice>
              <element>
                <complexType>
                   <sequence>
                     <element/>
                     <element/>
                     <element/>
                     <element/>
                     <element/>
                     <element/>
                     <element/>
                     <element/>
                     <element/>
                     <element/>
                   </sequence>
                </complexType>
              </element>
            </choice>
          </complexType>
        </element>
     </schema>
    <diffgram>
      <NewDataSet>
        <Table>
          <Title>THE CLUSTER DAY-1, JUNKOVATION</Title>
          <Description/>
          <EventDate>Apr 12, 2013</EventDate>
          <EventTime>5:00 PM</EventTime>
          <Venue>BLOCK 13-306</Venue>
          <CreatedBy>16689</CreatedBy>
          <CreatedOn>2013-04-11T09:52:07.163+05:30</CreatedOn>
          <EventFor>All</EventFor>
          <Type>Internal</Type>
          <IsActive>true</IsActive>
        </Table>
      </NewDataSet>
    </diffgram>
  </GetGuestEventsListingForServiceResult>
</GetGuestEventsListingForServiceResponse>

If you mean why there are those empties element, you have to check web service on server side. If you are interfacing with ".NET" web service on server side, try to set binding as BasicBinding

kinghomer
  • 3,021
  • 2
  • 33
  • 56
  • 1
    I dont have access to web services directly and looking for optimized solution to handle it at client side, I have implemented it somehow by using some Java Api's like split, replace and all. But does not seem like good solution. – JNI_OnLoad Apr 15 '13 at 03:40
  • If you can't modify code on server side, the only thing you can do is to ignore useless response nodes and consider just what you have to handle. In this specific case, ignore if node is called "schema" and handle if node is "NewDataSet". By the way, if i remember well, this response happens when binding isn't set as BasicBinding – kinghomer Apr 15 '13 at 08:24