Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > Getting data from 1C:Enterprise webservices to android native app(ksoap2)

Forum

Search UsersRules
Getting data from 1C:Enterprise webservices to android native app(ksoap2)
#1
Active user
Points:: 0
Joined:: Jul 28, 2015

Hi everyone;

Anybody here is who tried connect 1C:Enterprise web services from android native app with ksoap2?

I tried but I failed. I did a mistake here but I couldn't find it.

If anybody here know how is do that, Could you help me please?

Or Can we publish 1C:Enterprise web service like .Net webservices. F.e. we wrote a web service with .net we enter the service url "asmx" we see web methods list but I enter to browser



And I clicked the link I saw the wsdl file.

But f.e when you enter in your browser http://www.webservicex.net/length.asmx you'll see method.

Can we publish our web services like this, or Have we got anyway of handle datas what is returned from ours 1C web services with ksoap2?

Could you help me please?

Edit : I solve this, If anybody need help about this, I want to show my example. Thank you.

Profile
#2
Guest
Points::
Joined::

Hello, Mehmet Tuğrul SARIÇİÇEK.

It would be great if you could share your solution. Thanks in advance!

Profile
#3
Active user
Points:: 0
Joined:: Jul 28, 2015

On your native android app the class which is extend AsyncTask. Don't forget you need to ksoap2.

Code
public class ServiceGetDatas extends AsyncTask<String, String, Boolean> {
   
   static Context c;
   static ProgressDialog pd;
//This is ours webservice cws file adress
        public static String Url ="http://youripadress(or domain)/configname/ws/MobileTech.1cws";
//wsdl file adreess
   public static String Soap_Action = "youripadress(or domain)/configname/ws/MobileTech.1cws?wsdl/";
//the namespace what is you use to create XdtoObject
   public static String Namespace   = "yournamespace";
//It is stable. Don't change this.
   public static String HeaderType  = "Authorization";
//You can use another user but you have give permission of connect to webservice, I use administrator
   public static String HeaderData  = "Basic " + Base64.encode("Administrator:password".getBytes());
   public ServiceGetDatas(Context c) {
      this.c = c;
      pd = new ProgressDialog(c);
   }
   
   @Override
   protected void onPreExecute() {
      pd.setTitle("Lütfen Bekleyin");
      pd.setMessage("Giriş Yapılıyor");
      pd.setIndeterminate(true);
      pd.setCancelable(false);
      pd.show();  
   }

   @Override
   protected Boolean doInBackground(String... params) {
            
      String methodName = "yourMethodName";
      SoapObject request = new SoapObject(Namespace,methodName);
      SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(11);
      envelope.dotNet = true;
      envelope.setOutputSoapObject(request);
      
      HttpTransportSE httpse = new HttpTransportSE(Url);
        ArrayList<HeaderProperty> headerList = new ArrayList<HeaderProperty>();
        headerList.add(new HeaderProperty(conn.HeaderType, conn.HeaderData));
      try 
      {
         httpse.call(Soap_Action+methodName, envelope, headerList);
//this is(response) response from your webservice method
         SoapObject response = (SoapObject)envelope.getResponse();
//and you can parse like this
         for(int i=0;i<response.getPropertyCount();i++)
      {
                         SoapObject soapObject = (SoapObject)response.getProperty(i);
                         if (soapObject.hasProperty("x))
                            String x = soapObject .getPropertyAsString("x"); 
                }
         
      } catch (Exception e) {Log.e("hata :", e.toString());}
      return null;
   }

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.