1

I'm trying to pass a dataset value to a .net webservice by using ksoap2. I want to send the dataset from an Android (client) to the server.

The request needed is this:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
    <myDSTestFun xmlns="http://tempuri.org/">
        <dstest>
            <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
                <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
                    <xs:complexType>
                        <xs:choice minOccurs="0" maxOccurs="unbounded">
                            <xs:element name="Table1">
                            <xs:complexType>
                                <xs:sequence>
                                    <xs:element name="DEPCD" type="xs:string" minOccurs="0" />
                                    <xs:element name="DEPNAME" type="xs:string" minOccurs="0" />
                                </xs:sequence>
                            </xs:complexType>
                            </xs:element>
                        </xs:choice>
                    </xs:complexType>
                </xs:element>
            </xs:schema>
            <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
                <NewDataSet xmlns="">
                    <Table1 diffgr:id="Table11" msdata:rowOrder="0" diffgr:hasChanges="inserted">
                        <DEPCD>001</DEPCD>
                        <DEPNAME>IT</DEPNAME>
                    </Table1>
                    <Table1 diffgr:id="Table12" msdata:rowOrder="1" diffgr:hasChanges="inserted">
                        <DEPCD>002</DEPCD>
                        <DEPNAME>PM</DEPNAME>
                    </Table1>
                </NewDataSet>
            </diffgr:diffgram>
        </dstest>
    </myDSTestFun>
</soap:Body>
</soap:Envelope>

How can I create the request above and send it to the .net webservice?

Jonathan Leffler
  • 666,971
  • 126
  • 813
  • 1,185
  • so you want to send dataset from android(client) to server or from server to client? – Parth Doshi Dec 07 '11 at 02:47
  • i want to send dataset from client to server. in .net webservice there is a method which parameter is dataset, i need to pass a value to .net webservice from java to .net. – user1084751 Dec 07 '11 at 02:48
  • In android side, how have you stored your dataset? Which format have you used (eg.String,Object etc)? – Parth Doshi Dec 07 '11 at 03:06

2 Answers2

0

I did it once without using ksoap2. To do that you can create a mapper class which supports to call soap request. You can find here how to send soap request on android without ksoap2 library.

Mustafa Güven
  • 14,422
  • 10
  • 56
  • 80
-1

Well, I really don't know why are you sending the dataset back to the server, when it is usually the reverse. We often send the dataset to the client for processing.

Coming back to your question, I suggest you convert your dataset to JSON and do a HttpPost.

You can refer this for that.

On the server side, you need to deserialize your JSON, and use it for whatever purpose you want to.

Community
  • 1
  • 1
Parth Doshi
  • 4,155
  • 15
  • 71
  • 123