The 1C:Enterprise developers forum

#1
People who like this: 0 Yes / 0 No
Active user
Rating: 7
Joined: Jul 28, 2015
Company:

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.

Edited: Mehmet Tuğrul SARIÇİÇEK - Oct 10, 2015 01:17 AM
 
#2
People who like this: 0 Yes / 0 No
Timofey Bugaevsky
Guest

Joined:
Company:

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

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

 
#3
People who like this: 0 Yes / 0 No
Active user
Rating: 7
Joined: Jul 28, 2015
Company:

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;
   }

Edited: Mehmet Tuğrul SARIÇİÇEK - Nov 08, 2015 11:35 PM
 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.