kvin024 / ksoap2-android

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

SoapObject order #113

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
SoapObject request = new SoapObject(namespace, url);
request addProperty("connectionId", id);
SoapObject contents = new SoapObject("", "data_contents");
contents.addProperty("id", mid);
contents.addProperty("description", mDes);
contents.addProperty("name", mName);
request.addSoapObject(contents);

What is the expected output?
2. I expect to see.
<senddata xmlns="namespace" id="o0" c:root="1">
<connectionID>myIDvalue</connectionID>
<data_contents>
<id>midValue</id>
<description>myDesValue</description>
<name>mNameValue</name>
</data_contents>
</senddata>

What do you see instead?
<senddata xmlns="namespace" id="o0" c:root="1">
<data_contents>
<id>midValue</id>
<description>myDesValue</description>
<name>mNameValue</name>
</data_contents>
<connectionID>myIDvalue</connectionID>
</senddata>

What version of the product are you using? On what operating system?
ksoap2-android-assembly-2.6.0-jar-with-dependencies

Please provide any additional information below.
i have started with verion 2.5.8
have tryed 2.6.1 and 2.6.2
2.6.2 just faults.
I have spent 4 days trying to get the connectionID first. in my case this seem 
to be a requirement. if i use soapUI and move the ConnectionID to the beginning 
all works fine.

I will send a file but not for publication.

Original issue reported on code.google.com by hilljoh...@gmail.com on 23 Mar 2012 at 2:39

GoogleCodeExporter commented 9 years ago
This should work with some of the recent changes done to preserve ordering and 
might be a valid bug. Could you supply your scenario as a failing test case 
(e.g. in SoapSerializationEnvelopeTest) at a minimum and potentially look into 
creating a fix.. ?

Original comment by mosa...@gmail.com on 23 Mar 2012 at 4:41

GoogleCodeExporter commented 9 years ago
@Override
        protected String doInBackground(String... urls) {
            String reSultstr = null;
            for (String url : urls) {
                SoapObject request = new
SoapObject(WSDL_TARGET_NAMESPACE, url);

                request.addProperty("connectionId",
ConnectionID);
                SoapObject message = new SoapObject("",
"twoWaySmsMessage");

                message.addProperty("message", message);
                message.addProperty("mobiles",
mobilenumber);
                message.addProperty("messageId", messageID);

                request.addSoapObject(message);

                SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
                envelope.dotNet = true;

                envelope.setOutputSoapObject(request);
                HttpTransportSE httpTransport = new
HttpTransportSE(SOAP_ADDRESS);
                try {
                    httpTransport.debug = true;
                    httpTransport.call(SOAP_ACTION,
envelope);
                    // Object response =
envelope.getResponse();
                    // reSultstr = response.toString();
                    SoapObject response = (SoapObject)
envelope.getResponse();
                    reSultstr =
response.getProperty(0).toString();

                } catch (Exception exception) {
                    reSultstr = exception.toString();

                }
            }
            return reSultstr;
        }

        @Override
        protected void onPostExecute(String result) {
            if (result == null) {
                CurrentBalance.setText("Fail");
            } else if (result.startsWith("SoapFault")) {
                CurrentBalance.setText("Not connected");
                disconnectBtn.setText("Connect");
            } else if (result.startsWith("true")) {
                CurrentBalance.setText("Not connected");
                disconnectBtn.setText("Connect");
            } else {
                CatchError(result);
            }
        }
    }

Original comment by hilljoh...@gmail.com on 25 Mar 2012 at 11:14

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I have the same problem.

The entry for WebServices is
      <imp:getCoberturaADSLNuevo>
         <imp:telefono>911111111</imp:telefono>
         <imp:modalidad>
            <xsd:movimientoComercial>A</xsd:movimientoComercial>
            <xsd:tipoServicioDSL>I</xsd:tipoServicioDSL>
            <xsd:velocidadModalidadDSL>E</xsd:velocidadModalidadDSL>
         </imp:modalidad>
      </imp:getCoberturaADSLNuevo>

My code is

                        request.addProperty("telefono", 911111111);         
            SoapObject message = new SoapObject("", "modalidad");
            message.addProperty("movimientoComercial", "A");
            message.addProperty("tipoServicioDSL", "I");
            message.addProperty("velocidadModalidadDSL", "E");

            //request.setProperty(0, "telefono");
            request.addSoapObject(message);

But not work.

Original comment by albertod...@gmail.com on 27 Mar 2012 at 8:32

GoogleCodeExporter commented 9 years ago
I resolved my problem.

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
            request.addProperty("telefono",     911111111);         
            SoapObject message = new SoapObject(NAMESPACE, "modalidad");
            message.addProperty("movimientoComercial", "A");
            message.addProperty("tipoServicioDSL", "I");
            message.addProperty("velocidadModalidadDSL", "E");

            request.addProperty("modalidad", message);

Original comment by albertod...@gmail.com on 27 Mar 2012 at 9:18

GoogleCodeExporter commented 9 years ago

Original comment by mosa...@gmail.com on 10 Apr 2012 at 4:27

GoogleCodeExporter commented 9 years ago
Hello, 
I am using same code structure in my application. But one fault message error 
is coming  every time. Kindly requested to any one, please help me and my error 
is as below.

Request Xml string as :

<xs:element name="addSiloEvent">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="asdf" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="asdf" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="asdf" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="asdf" nillable="true" type="xs:string"/>
<xs:element xmlns:q41="url" minOccurs="0" name="sadf" nillable="true" 
type="q41:SiloEvent"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:complexType name="SiloEvent">
<xs:sequence>
<xs:element minOccurs="0" name="adfs" type="xs:dateTime"/>
<xs:element minOccurs="0" name="asdf" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="adf" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="asdf" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="asdf" type="xs:int"/>
<xs:element minOccurs="0" name="asdf" type="xs:int"/>
<xs:element minOccurs="0" name="asdf" nillable="true" type="tns:CropType"/>
<xs:element minOccurs="0" name="asdf" type="xs:double"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="CropType">
<xs:sequence>
<xs:element minOccurs="0" name="adsf" type="xs:int"/>
<xs:element minOccurs="0" name="asdf" type="xs:int"/>
<xs:element minOccurs="0" name="asdf" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="adfs" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="CropType" nillable="true" type="tns:CropType"/>

*****************************************************************
Code is as :

StringBuilder sb = null;
            SoapObject request = new SoapObject(Controller.NAMESPACE, "addSiloEvent");
            request.addProperty("afd", userName);
            request.addProperty("asdf", authToken);
            request.addProperty("ad", "TestByManoj");
            request.addProperty("af", "SiloNameData");

            SoapObject siloType_add = new SoapObject("tns:CropType", "CropType");
            siloType_add.addAttribute("afds", 14);
            siloType_add.addAttribute("asdf", 0);
            siloType_add.addAttribute("asdf", "Wheat"); 
            siloType_add.addAttribute("adsf", "Lincon");

            SoapObject siloEventObject = new SoapObject("q41:SiloEvent", "siloevent");
            siloEventObject.addAttribute("adf", new Date());
            siloEventObject.addAttribute("asdf", "AddToSilo");
            siloEventObject.addAttribute("asdf", "Grate");
            siloEventObject.addAttribute("asf", "Note");
            siloEventObject.addAttribute("asdf", 0);
            siloEventObject.addAttribute("asfd", 40);
            siloEventObject.addAttribute("asdf", siloType_add);
            siloEventObject.addAttribute("asf", 800);

            request.addProperty("siloevent", siloEventObject);

            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11);
            envelope.dotNet = true;
            envelope.setOutputSoapObject(request);
            envelope.implicitTypes = true;
            MarshalDate md = new MarshalDate();
            md.register(envelope);
            MarshalDouble mDoubl = new MarshalDouble();
            mDoubl.register(envelope);

            System.out.println("1111");
            HttpTransportSE androidHttpTransport = new HttpTransportSE( Controller.URL6767);
            androidHttpTransport.call(Controller.SOAP_ACTION + "addSiloEvent",  envelope);
            System.out.println("1111");

            SoapObject sObject = (SoapObject) envelope.getResponse();

*************************************************
Error is coming as below :

06-22 12:47:21.518: W/System.err(526): SoapFault - faultcode: 
'a:InternalServiceFault' faultstring: 'Sequence contains no matching element' 
faultactor: 'null' detail: org.kxml2.kdom.Node@44f3d948

Kindly requested to any one Guy have idea please let me know.

Thanks

Original comment by manoj.kb...@gmail.com on 22 Jun 2012 at 7:27

GoogleCodeExporter commented 9 years ago
Dont post to old fixed issues. Ask on the mailing list.

Original comment by mosa...@gmail.com on 23 Jun 2012 at 6:39