0

Me and my some friends working on an android application that has to send the request in the xml format and then in response it will get the reply/response also in the xml format. but the problem is when we sent the xml request to the server it give us message in string say "7". Now the 7 means that what xml we are sending matching no arguments in the function. We are trying to invoke the SearchCalls method which is SearchCalss(x,x,x,x,.....).

we observed the xml (that we are sending) which is given below:

<?xml version="1.0" encoding= "UTF-8" ?><v:Envelope> 
   xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> 
   xmlns:d="http://www.w3.org/2001/XMLSchema"> 
   xmlns:c="http://www.w3.org/2003/05/soap-encoding"> 
   xmlns:v="http://www.w3.org/2003/05/soap-envelope">
 <v:Header> /><v:Body>
<SearchCalls> xmlns="http://tempuri.org/">
<username>admin</username>
<password>admin</password>
<FirstNameCriteria></FirstNameCriteria>
<FirstName></FirstName>
<LastNameCriteria></LastNameCriteria>
<LastName></LastName>
<GroupSearchOption></GroupSearchOption>
<GroupName></GroupName>
<EncryptedCallsCriteria>
</EncryptedCallsCriteria>
<AssociatedAgentCriteria>
</AssociatedAgentCriteria>
<CalledByCriteria></CalledByCriteria>
<CalledBy></CalledBy>
<CalledToCriteria></CalledToCriteria>
<CalledTo></CalledTo>
<CalledDateSearchCriteria>Past-N-days</CalledDateSearchCriteria>  
<NumberOfDays>777</NumberOfDays>
<StartDate></StartDate>
<EndDate></EndDate>
<CallDurationCriteria></CallDurationCriteria>
<CallDuration></CallDuration>
<CallDirectionCriteria></CallDirectionCriteria>
<ArchivedCallsCriteria></ArchivedCallsCriteria>
<ScreenCaptureCallsCriteria></ScreenCaptureCallsCriteria>
<DeviceHangUpCriteria></DeviceHangUpCriteria>
<CallIDSearchCriteria></CallIDSearchCriteria>
<CallID></CallID>
<CorrelatorIDSearchCriteria></CorrelatorIDSearchCriteria>
<CorrelatorID></CorrelatorID>
<DeviceSearchCriteria></DeviceSearchCriteria>
<Device></Device>
<FlagSearchCriteria>All</FlagSearchCriteria>
<NotesSearchCriteria></NotesSearchCriteria>
<Notes></Notes>
<CallStatus></CallStatus>
<CallTypeSearchCriteria></CallTypeSearchCriteria>
<CustomField1_Criteria></CustomField1_Criteria>
<CustomFiled1_Value></CustomFiled1_Value>
<CustomField2_Criteria></CustomField2_Criteria>
<CustomField2_Value></CustomField2_Value>
<CustomField3_Criteria></CustomField3_Criteria>
<CustomField3_Value></CustomField3_Value>
<CustomField4_Criteria></CustomField4_Criteria>
<CustomField4_Value></CustomField4_Value>
<CustomField5_Criteria></CustomField5_Criteria>
<CustomField5_Value></CustomField5_Value>
<CustomField6_Criteria></CustomField6_Criteria>
<CustomField6_Value></CustomField6_Value>
<CustomField7_Criteria></CustomField7_Criteria>
<CustomField7_Value></CustomField7_Value>
<CustomField8_Criteria></CustomField8_Criteria>
<CustomField8_Value></CustomField8_Value>
<CustomField9_Criteria></CustomField9_Criteria>
<CustomField9_Value></CustomField9_Value>
<CustomField10_Criteria></CustomField10_Criteria>
<CustomField10_Value></CustomField10_Value>
</SearchCalls></v:Body></v:Envelope>

and the requested xml must be like the xml which is given below (its the sample where as we have to replace placeholders of only some mandatory arguments such as username=admin etc ).

    <?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <SearchCalls xmlns="http://tempuri.org/">
      <username>string</username>
      <password>string</password>
      <FirstNameCriteria>string</FirstNameCriteria>
      <FirstName>string</FirstName>
      <LastNameCriteria>string</LastNameCriteria>
      <LastName>string</LastName>
      <GroupSearchOption>string</GroupSearchOption>
      <Groupname>string</Groupname>
      <EncryptedCallsCriteria>string</EncryptedCallsCriteria>
      <AssociatedAgentCriteria>string</AssociatedAgentCriteria>
      <CalledByCriteria>string</CalledByCriteria>
      <CalledBy>string</CalledBy>
      <CalledToCriteria>string</CalledToCriteria>
      <CalledTo>string</CalledTo>
      <CalledDateSearchCriteria>string</CalledDateSearchCriteria>
      <NumberOfDays>string</NumberOfDays>
      <StartDate>string</StartDate>
      <EndDate>string</EndDate>
      <CallDurationCriteria>string</CallDurationCriteria>
      <CallDuration>string</CallDuration>
      <CallDirectionCriteria>string</CallDirectionCriteria>
      <ArchivedCallsCriteria>string</ArchivedCallsCriteria>
      <ScreenCaptureCallsCriteria>string</ScreenCaptureCallsCriteria>
      <DeviceHangUpCriteria>string</DeviceHangUpCriteria>
      <CallIDSearchCriteria>string</CallIDSearchCriteria>
      <CallID>string</CallID>
      <CorrelatorIDSearchCriteria>string</CorrelatorIDSearchCriteria>
      <CorrelatorID>string</CorrelatorID>
      <DeviceSearchCriteria>string</DeviceSearchCriteria>
      <Device>string</Device>
      <FlagSearchCriteria>string</FlagSearchCriteria>
      <NotesSearchCriteria>string</NotesSearchCriteria>
      <Notes>string</Notes>
      <CallStatus>string</CallStatus>
      <CallTypeSearchCriteria>string</CallTypeSearchCriteria>
      <CustomField1_Criteria>string</CustomField1_Criteria>
      <CustomField1_Value>string</CustomField1_Value>
      <CustomField2_Criteria>string</CustomField2_Criteria>
      <CustomField2_Value>string</CustomField2_Value>
      <CustomField3_Criteria>string</CustomField3_Criteria>
      <CustomField3_Value>string</CustomField3_Value>
      <CustomField4_Criteria>string</CustomField4_Criteria>
      <CustomField4_Value>string</CustomField4_Value>
      <CustomField5_Criteria>string</CustomField5_Criteria>
      <CustomField5_Value>string</CustomField5_Value>
      <CustomField6_Criteria>string</CustomField6_Criteria>
      <CustomField6_Value>string</CustomField6_Value>
      <CustomField7_Criteria>string</CustomField7_Criteria>
      <CustomField7_Value>string</CustomField7_Value>
      <CustomField8_Criteria>string</CustomField8_Criteria>
      <CustomField8_Value>string</CustomField8_Value>
      <CustomField9_Criteria>string</CustomField9_Criteria>
      <CustomField9_Value>string</CustomField9_Value>
      <CustomField10_Criteria>string</CustomField10_Criteria>
      <CustomField10_Value>string</CustomField10_Value>
    </SearchCalls>
  </soap:Body>
</soap:Envelope>

Now if you look in a glance it looks like the same , but if you observe closely then you will notice that there is some little changes in our xml .In starting tag it is where as it should be

Any Idea about this? is our xml that we are sending is not correct? what we have noticed are the mistakes or its normal as main concern is to invoke the SearchCall function? I am using external library to conversion "ksoap2-android-assembly-3.0.0-RC.4-jar-with-dependencies"

Any Idea what is the matter. ? (I think I am quiet clear in the question)

Black
  • 21
  • 6
  • You should make a String and send it to your server. – Tushar Gogna Jan 08 '15 at 12:19
  • But it is accepting xml not string – Black Jan 08 '15 at 12:20
  • read my question again I have added some more things in question Which I missed while asking in first place – Black Jan 08 '15 at 12:20
  • Column containing this value in the database on server is of the type string or file? – Tushar Gogna Jan 08 '15 at 12:23
  • string . All fields are string – Black Jan 08 '15 at 12:31
  • Ok. Coming back to my 1st comment. You should make a String and send it to your server. I recently made a similar project where I made XML dynamically and sent it to server. It's better to make it dynamically rather than like an XML file. – Tushar Gogna Jan 08 '15 at 12:33
  • So How to make a string ? can you share me that method – Black Jan 08 '15 at 12:36
  • You can use **XmlSerializer** in order to get that. [Check my question/answer](http://stackoverflow.com/questions/25636421/creating-an-xml-for-dynamically-created-elements) – Tushar Gogna Jan 08 '15 at 12:40
  • I have read your answer but in fact I got nothing.The fields in my questions are clear to you , can you just convert 2 or 3 fields from my question just to show demo , that How should I do this – Black Jan 08 '15 at 12:52
  • You require all these fields and that also always? You're creating an HTML tag like Header and all which is not included in request. – Tushar Gogna Jan 08 '15 at 13:00
  • Yes I need those fields always , and which header are you talking about? – Black Jan 08 '15 at 13:01
  • yes where is that v in the Body tag has come from whereas it is supposed to be a and it is supposed to be a no tag at all – Black Jan 08 '15 at 13:06
  • Then remove it and other tags which are not required. – Tushar Gogna Jan 08 '15 at 13:11
  • that is my main conceren – Black Jan 08 '15 at 13:16
  • ok removing it and will tell you – Black Jan 08 '15 at 13:16
  • well if the xml different tags are creating problem , then i think SOAP service or server should not respond at all , – Black Jan 08 '15 at 13:18
  • This is the only problem. Remove unwanted tags and you'll get the response. – Tushar Gogna Jan 08 '15 at 13:19
  • I mean My server is giving me a error code , which tells that the parameters you are passing to function is not valid/or data against those function are not available , so it means that error code confirms us that the xml we are sending is accepted though there is some problem in function call or parameters ? what you say ? – Black Jan 08 '15 at 13:19
  • It means that the generated XML (the one you're creating) is not what is accepted at the server end. – Tushar Gogna Jan 08 '15 at 13:25

1 Answers1

0

@PsyDuck I am putting as answer bcz some one can have same issue and confusions. it is accepted by the server without removing the header tag.The xml which I was creating by using Ksoap2 library creates it, bcz it has hardcoded namespace etc, so it is identical what I have made and what should be the exact xml file for the server . So the problem was in the parameters which was a typo mistake , I corrected that and got response. So I am leaving here a link for the same question which clearifies that xml made by this Ksoap2 library is same as requested by the server or Soap services. here is a link

Community
  • 1
  • 1
Black
  • 21
  • 6