How do I consume a web service in TDM?

Discussion forum about all things TD Mobile.
FRBhote
India
Posts: 1326
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

How do I consume a web service in TDM?

Post by FRBhote » 11 Jun 2019, 12:27

TIA

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 818
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: How do I consume a web service in TDM?

Post by Igor Ivanovic » 11 Jun 2019, 14:09

Hi,

Under Server Resources/Symbol Imports, click on the AXL combo box (the one with a star), and choose Import Web Service.
Enter the URL of the WDSL (or browse to load a local WDSL file), and it will create the needed interop dll and .axl file and include it in you app.
Igor Ivanovic
Image

FRBhote
India
Posts: 1326
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: How do I consume a web service in TDM?

Post by FRBhote » 12 Jun 2019, 05:55

Thanks. DId that. Appears to work on the PC but not o the phone.

Actually I need to save a file on the server and made a web service for that.

Gave up - using npm now to do it.

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 818
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: How do I consume a web service in TDM?

Post by Igor Ivanovic » 12 Jun 2019, 08:09

Interesting.
What error do you get?
The web service is a server side import, so, in theory, it shouldn't matter if your app is on PC or mobile, or am I wrong?

I actually didn't try it from a mobile phone, but am really interested why it doesn't work.
Could you share a simple app?
Igor Ivanovic
Image

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 818
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: How do I consume a web service in TDM?

Post by Igor Ivanovic » 12 Jun 2019, 08:11

Forgot to ask...
How are you using NPM for the solution?
Igor Ivanovic
Image

FRBhote
India
Posts: 1326
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: How do I consume a web service in TDM?

Post by FRBhote » 12 Jun 2019, 13:33

Scrapped the web service. Using npm ftp.

Code: Select all

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
try
{ 
			 var dInfo = Td.Data.Binding.get('cFtp');
		//dInfo.getValue("sADDR");
	
	var sFTP_ADDR = 	dInfo.getValue("sADDR");
	var sFTP_USER = 	 dInfo.getValue("sUser");
	var sFTP_PW = 	dInfo.getValue("sPW");
	var sPATIENT_ID = 	 Td.Data.Binding.get('PATIENT_ID').value;
	
	alert(sFTP_ADDR);
	alert(sFTP_USER);
		alert(sFTP_PW);
	
	
	  window.cordova.plugin.ftp.connect(sFTP_ADDR, sFTP_USER, sFTP_PW, function(ok) {
        console.info("ftp: connect ok=" + ok);
		alert('connected ftp');
		  try{
		  	 window.cordova.plugin.ftp.mkdir (sPATIENT_ID,  function(){alert('Created Folder');},  function(error) {
            console.error("ftp: Folder create=" + error);
			alert('errorfolder');
			alert(error);});
		  }
		  catch(errr){
		  	
			  alert(errr);
		  }
			  
		 var sPhotoPath = sPATIENT_ID + '/Photograph.jpeg';
		
        // You can do any ftp actions from now on...
        window.cordova.plugin.ftp.upload('file:///storage/emulated/0/Download/Photograph.jpeg',sPhotoPath, function(percent) {
            if (percent == 1) {
                console.info("ftp: upload finish");
				
            } else {
                console.debug("ftp: upload percent=" + percent * 100 + "%");
            }
        }, function(error) {
            console.error("ftp: upload error=" + error);
			alert('error1');
			alert(error);
        });
		   var sAddrPath = sPATIENT_ID + '\Address_Proof.jpeg';
		  alert(sAddrPath);
		  window.cordova.plugin.ftp.upload('file:///storage/emulated/0/Download/Address_Proof.jpeg', sAddrPath, function(percent) {
            if (percent == 1) {
                console.info("ftp: upload finish");
				
            } else {
                console.debug("ftp: upload percent=" + percent * 100 + "%");
            }
        }, function(error) {
            console.error("ftp: upload error=" + error);
			alert('error1');
			alert(error);
        });
alert('Uploaded to Server');
    }, function(error) {
        console.error("ftp: connect error=" + error);
		alert('error2');
		alert(error);
    });
}
catch(err){	
	alert(err);
}
}

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 818
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: How do I consume a web service in TDM?

Post by Igor Ivanovic » 13 Jun 2019, 13:13

Oooh I see :D
Igor Ivanovic
Image

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest