Hi,

This is regarding consuming PHP based webservice using ksoap2 in
android platform(version 2.3.1).

The exception occurs when at line
androidHttpTransport.call(SOAP_ACTION, envelope); as per below code.
Please could you help on this issue regarding the exception.

Below is the code snippet which consumes the SOAP Webservice using
ksoap2 api:

        private ArrayList<String> getCategoryNameService() {
                ArrayList<String> indexstring = new ArrayList<String>();
                String SOAP_ACTION = "http://service/xsd/getCategoryNames";;

                String METHOD_NAME = "getCategoryNames";

                //String NAMESPACE = "urn:mretail";
                //String NAMESPACE = "http://service";;

                 String NAMESPACE = "http://service/xsd";;

                // String URL =
                // 
"http://20.201.140.126:8080/RetailAppPrj/services/RetailService?
wsdl";
                String URL = "http://innovation.in.csc.com/mobile/RetailAppPrj/
mretail_server.php";
                arrayListPrice = new ArrayList<String>();
                try {
                        SoapObject request = new SoapObject(NAMESPACE, 
METHOD_NAME);

                        SoapSerializationEnvelope envelope = new 
SoapSerializationEnvelope(
                                        SoapEnvelope.VER11);
                        envelope.dotNet = true;
                        /*
                         * envelope.encodingStyle=SoapEnvelope.ENC;
                         * envelope.setAddAdornments(false); 
envelope.implicitTypes=false;
                         */
                        envelope.setOutputSoapObject(request);

                        HttpTransportSE androidHttpTransport = new 
HttpTransportSE(URL);
                        androidHttpTransport.debug = true;
                        try {
                                System.out.println("calling the 
wserv1111.....");
                                System.out.println("Soap action name: "+ 
SOAP_ACTION);
                                androidHttpTransport.call(SOAP_ACTION, 
envelope);

                                //SoapObject soapObject = (SoapObject) 
envelope.bodyIn;
                                SoapObject soapObject = (SoapObject) 
envelope.getResponse();

                                if (soapObject != null) {

                                        for (int i = 0; i < 
soapObject.getPropertyCount(); i++) {
                                                
indexstring.add(soapObject.getProperty(i).toString());
                                        }
                                }

                        } catch (XmlPullParserException exception) {
                                exception.printStackTrace();
                                System.out.println("The  xml parser Errors are "
                                                + exception.toString());
                        } catch (NullPointerException exception) {
                                System.out.println("The null pointer  Errors 
are "
                                                + exception.toString());
                        }

                } catch (Exception e) {

                }
                return indexstring;
        }

Below is the wsdl file content:

<wsdl:definitions targetNamespace="http://
service"><wsdl:documentation>
                Please Type your service description here
        </wsdl:documentation><wsdl:types><xs:schema
attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://service/xsd";><xs:element
name="getCategoryNamesResponse"><xs:complexType><xs:sequence><xs:element
name="return" nillable="true" type="xs:anyType"/></xs:sequence></
xs:complexType></xs:element><xs:element
name="main"><xs:complexType><xs:sequence><xs:element
maxOccurs="unbounded" name="args" nillable="true" type="xs:string"/></
xs:sequence></xs:complexType></xs:element></xs:schema></
wsdl:types><wsdl:message name="getCategoryNamesMessage"/><wsdl:message
name="getCategoryNamesResponse"><wsdl:part name="part1"
element="ns0:getCategoryNamesResponse"/></wsdl:message><wsdl:message
name="getConnectionMessage"/><wsdl:message
name="mainMessage"><wsdl:part name="part1" element="ns0:main"/></
wsdl:message><wsdl:portType
name="RetailServicePortType"><wsdl:operation
name="getCategoryNames"><wsdl:input
message="tns:getCategoryNamesMessage"
wsaw:Action="urn:getCategoryNames"/><wsdl:output
message="tns:getCategoryNamesResponse"/></
wsdl:operation><wsdl:operation name="getConnection"><wsdl:input
message="tns:getConnectionMessage" wsaw:Action="urn:getConnection"/></
wsdl:operation><wsdl:operation name="main"><wsdl:input
message="tns:mainMessage" wsaw:Action="urn:main"/></wsdl:operation></
wsdl:portType><wsdl:binding name="RetailServiceSOAP11Binding"
type="tns:RetailServicePortType"><soap:binding transport="http://
schemas.xmlsoap.org/soap/http" style="document"/><wsdl:operation
name="getCategoryNames"><soap:operation
soapAction="urn:getCategoryNames" style="document"/
><wsdl:input><soap:body use="literal"/></
wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></
wsdl:operation><wsdl:operation name="getConnection"><soap:operation
soapAction="urn:getConnection" style="document"/
><wsdl:input><soap:body use="literal"/></wsdl:input></
wsdl:operation><wsdl:operation name="main"><soap:operation
soapAction="urn:main" style="document"/><wsdl:input><soap:body
use="literal"/></wsdl:input></wsdl:operation></
wsdl:binding><wsdl:binding name="RetailServiceSOAP12Binding"
type="tns:RetailServicePortType"><soap12:binding transport="http://
schemas.xmlsoap.org/soap/http" style="document"/><wsdl:operation
name="getCategoryNames"><soap12:operation
soapAction="urn:getCategoryNames" style="document"/
><wsdl:input><soap12:body use="literal"/></
wsdl:input><wsdl:output><soap12:body use="literal"/></wsdl:output></
wsdl:operation><wsdl:operation name="getConnection"><soap12:operation
soapAction="urn:getConnection" style="document"/
><wsdl:input><soap12:body use="literal"/></wsdl:input></
wsdl:operation><wsdl:operation name="main"><soap12:operation
soapAction="urn:main" style="document"/><wsdl:input><soap12:body
use="literal"/></wsdl:input></wsdl:operation></
wsdl:binding><wsdl:binding name="RetailServiceHttpBinding"
type="tns:RetailServicePortType"><http:binding verb="POST"/
><wsdl:operation name="getCategoryNames"><http:operation
location="getCategoryNames"/><wsdl:input><mime:content type="text/xml"/
></wsdl:input><wsdl:output><mime:content type="text/xml"/></
wsdl:output></wsdl:operation><wsdl:operation
name="getConnection"><http:operation location="getConnection"/
><wsdl:input><mime:content type="text/xml"/></wsdl:input></
wsdl:operation><wsdl:operation name="main"><http:operation
location="main"/><wsdl:input><mime:content type="text/xml"/></
wsdl:input></wsdl:operation></wsdl:binding><wsdl:service
name="RetailService"><wsdl:port name="RetailServiceSOAP11port_http"
binding="tns:RetailServiceSOAP11Binding"><soap:address
location="http://innovation.in.csc.com/mobile/RetailAppPrj/
mretail_server.php"/></wsdl:port><wsdl:port
name="RetailServiceSOAP12port_http"
binding="tns:RetailServiceSOAP12Binding"><soap12:address
location="http://innovation.in.csc.com/mobile/RetailAppPrj/
mretail_server.php"/></wsdl:port><wsdl:port
name="RetailServiceHttpport"
binding="tns:RetailServiceHttpBinding"><http:address location="http://
innovation.in.csc.com/mobile/RetailAppPrj/mretail_server.php"/></
wsdl:port></wsdl:service></wsdl:definitions>

Getting following exception

03-27 21:13:10.960: W/System.err(1507):
org.xmlpull.v1.XmlPullParserException: expected: END_TAG {http://
schemas.xmlsoap.org/soap/envelope/}Body (position:END_TAG </{http://
schemas.xmlsoap.org/soap/envelope/}SOAP-ENV:Fault>@2:246 in
java.io.InputStreamReader@405457d8)
03-27 21:13:10.991: W/System.err(1507):         at
org.kxml2.io.KXmlParser.exception(KXmlParser.java:273)
03-27 21:13:11.000: W/System.err(1507):         at
org.kxml2.io.KXmlParser.require(KXmlParser.java:1424)
03-27 21:13:11.000: W/System.err(1507):         at
org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:138)
03-27 21:13:11.000: W/System.err(1507):         at
org.ksoap2.transport.Transport.parseResponse(Transport.java:63)
03-27 21:13:11.180: W/System.err(1507):         at
org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:100)
03-27 21:13:11.180: W/System.err(1507):         at
com.android.csc.mretail.MRetailActivity.getCategoryNameService(MRetailActivity.java:
1047)
03-27 21:13:11.281: W/System.err(1507):         at
com.android.csc.mretail.MRetailActivity.onCreate(MRetailActivity.java:
125)
03-27 21:13:11.281: W/System.err(1507):         at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
03-27 21:13:11.281: W/System.err(1507):         at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
1586)
03-27 21:13:11.413: W/System.err(1507):         at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
1638)
03-27 21:13:11.413: W/System.err(1507):         at
android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-27 21:13:11.420: W/System.err(1507):         at android.app.ActivityThread
$H.handleMessage(ActivityThread.java:928)
03-27 21:13:11.420: W/System.err(1507):         at
android.os.Handler.dispatchMessage(Handler.java:99)
03-27 21:13:11.420: W/System.err(1507):         at
android.os.Looper.loop(Looper.java:123)
03-27 21:13:11.461: W/System.err(1507):         at
android.app.ActivityThread.main(ActivityThread.java:3647)
03-27 21:13:11.461: W/System.err(1507):         at
java.lang.reflect.Method.invokeNative(Native Method)
03-27 21:13:11.461: W/System.err(1507):         at
java.lang.reflect.Method.invoke(Method.java:507)
03-27 21:13:11.461: W/System.err(1507):         at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-27 21:13:11.461: W/System.err(1507):         at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-27 21:13:11.470: W/System.err(1507):         at
dalvik.system.NativeStart.main(Native Method)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to