Search code examples
androidasp.netweb-servicesandroid-ksoap2

.net web service returning NULL objects in the beginning of data


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; };  

Solution

  • 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