سؤال

package com.appu.pack;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import android.app.Activity;
import android.os.Bundle;

public class SampleFinalSapActivity extends Activity {
    /** Called when the activity is first created. */
    private final String NAMESPACE ="urn:sap-com:document:sap:soap:functions:mc-style";//this is my server namespace..
    private final String METHOD_NAME ="ZMATERIALS_GROUP_LIST";
    private final String SOAP_ACTION = NAMESPACE + "/" + METHOD_NAME;
    private final String URL ="http://************:8000/sap/bc/srt/wsdl/srvc_14DAE9C8D79F1EE197AD09B4D05C4345/wsdl11/allinone/ws_policy/document?sap-client=800&sap-user=*****&sap-password=******";
            @Override
        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);

        Request.addProperty("Language", "d");

//this is the one of the property in wsdl file

        System.out.println("the  Request is :::::"+Request);

       SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
       envelope.setOutputSoapObject(Request);

        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

        System.out.println("TRANSPORT:"+androidHttpTransport);

 try
        {   

         androidHttpTransport.call(SOAP_ACTION, envelope);
        androidHttpTransport.debug = true;  //this is optional, use it if you don't want to use a packet sniffer to check what the sent message was (httpTransport.requestDump)

        //Object result = envelope.getResponse(); //getting response here

        //SoapPrimitive result1 = (SoapPrimitive)envelope.bodyIn;

       // System.out.println("Result : " + result1.toString());

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

     System.out.println("RESPONSE:"+response);
        }
       catch(Exception e)
        {
            e.printStackTrace();
        }
    }
}

When I run this application  I got the exception:02-04 09:31:37.213: WARN/System.err(538): org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <{http://schemas.xmlsoap.org/wsdl/}wsdl:definitions targetNamespace='urn:sap-com:document:sap:soap:functions:mc-style'>@1:686 in java.io.InputStreamReader@4052d188)

How can i resolve it ? here i am using Ksoap2.jar for calling webservices is there any alternative to call sap soap webservices with android ? thanks in Advance...

هل كانت مفيدة؟

المحلول

may be a little mistake in code.I couldn't understand find that mistake.I think there may be problem in the URL. may be you can refer my answer. Android Java connect to online database working code is posted there.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top