FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour SOAP WebService
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
SOAP WebService
Posted: Thu Mar 13, 2014 05:33 PM
Hello,

I need to send and receive some information to a SOAP webservice to connect my program to a Truck-tracking program.
I received this C-code from that company
Code (fw): Select all Collapse
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestWebservice
{
  class Program
  {
    static void Main(string[] args)
    {
      using (ServiceReference1.Service1Client myGeoPlanner = new ServiceReference1.Service1Client())
      {
        string login = "login";
        string password = "pasword";
        string exception = null;

        List<ServiceReference1.vehilcle> vehilcles = myGeoPlanner.GetVehicles(login, password, false, ref exception);

        int vehicleId = 100879;
        DateTime validFromDate = DateTime.Now;
        DateTime validToDate = DateTime.Now.AddDays(6);

        string codeClient = "789456";
        //bool exception6 = myGeoPlanner.CreateRegionCodeClientLatLon2(login, password, "Qeos Parking", "Enclus du Haut. 10", "", "7750", "Mont-de-L'Enclus", "BELGIUM", codeClient, 20, 50.756789181291943, 3.4804098796214475);

        //var routeId = myGeoPlanner.PutRoute(login, password, vehicleId, "test qeos", 21, validFromDate, validToDate, ref exception);
      }
    }
  }
}


Has anyone have done this allready?
Can anyone convert this to xHarbour?

Thanks,
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: SOAP WebService
Posted: Fri Mar 14, 2014 02:53 PM

Marc,

Perhaps this old message thread will help.

viewtopic.php?f=3t=18979

Regards,
James

&

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: SOAP WebService
Posted: Fri Mar 14, 2014 03:26 PM

I don't see a URL in the sample you provided. Did they give you a URL, login, and password to test the system with? Or, possibly the test login and password is as shown in the sample--"login" and "pasword" (note only one s)? Still need a URL.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: SOAP WebService
Posted: Fri Mar 14, 2014 03:58 PM
James,

Thanks for the link. I already found this tread, but I don't know how to use it.
They also gave me a URL, but it's not in that code... I don't know whre to put the URL

I also found this tread http://forums.fivetechsupport.com/viewtopic.php?f=3&t=27333 but I can't compile the example. I get an error..
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: SOAP WebService
Posted: Sat Mar 15, 2014 02:17 AM

Marc,

I have only done some work with web services that didn't require a login so all I needed to do was read the XML page off the site.

To use a secure login you have to use the SOAP software (free download from Microsoft). It is actually an old technology so you will find the Microsoft says it was discontinued in 2005 (but it still appears to be available).

So, one reason the sample you tried to compile errored out was because you have to have SOAP installed. I think the sample you were trying also requires an SSL class that is a separate download (from I don't know where). I think it is a Harbour addon or xHarbour. Reinaldo Crespo seems to be the one to talk to. I suggest responding to the old thread to see if he answers, otherwise you can just email him (his address is in the thread).

Also, there is a good description of SOAP here:

http://msdn.microsoft.com/en-us/library/ms996507.aspx

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: SOAP WebService
Posted: Mon Mar 17, 2014 04:51 PM
Hi,

I finaly can connect to the webservice :-)

Code (fw): Select all Collapse
myGeoPlanner:= CreateObject("MSSOAP.SoapClient30")
myGeoPlanner:MSSoapInit(alltrim(UPurl))

vehilcles := myGeoPlanner:GetVehicles(login, password, .f., @fout)
msginfo(valtype(vehilcles))


The only problem is that I receive an object.
Any idea how to get the data.

This is the doc about the GetVehicles object
Code (fw): Select all Collapse
[OperationContract] List<vehilcle> GetVehicles(string login, string password, Boolean logical_deleted_include, ref string exception);

Boolean logical_deleted_include = True = Get active and not active vehicles False = Get only active vehicles ref string exception = If an error occurs the error or exception will be copied into the string exception.

Return: List<vehilcle> = List of vehicles


Thanks
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: SOAP WebService
Posted: Mon Mar 17, 2014 07:12 PM
Marc,

Try:

Code (fw): Select all Collapse
vehilcles := myGeoPlanner:GetVehicles(login, password, .f., @fout)
oXml := TXmlDocument():New( vehilcles )
xbrowse( oXml )

I note that you have misspelled vehicle as "vehilcle."

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: SOAP WebService
Posted: Mon Mar 17, 2014 07:18 PM
James Bott wrote:Marc,

Try:

Code (fw): Select all Collapse
vehilcles := myGeoPlanner:GetVehicles(login, password, .f., @fout)
oXml := TXmlDocument():New( vehilcles )
xbrowse( oXml )

I note that you have misspelled vehicle as "vehilcle."

James


Thanks James,
I will try it. vehilcle is not misspelled. 'List<vehilcle> GetVehicles' is a copy/paste of the documentation of that webservice.
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: SOAP WebService
Posted: Mon Mar 17, 2014 09:29 PM
Marc,

I will try it. vehilcle is not misspelled. 'List<vehilcle> GetVehicles' is a copy/paste of the documentation of that webservice.


Yes, I noticed they misspelled it also. It appears to just be a variable name (which can be anything) and if it were me and I intentionally misspelled it, then later I would spell it correctly somewhere else in the code and then wonder why it was erroring out. Just thought I would mention it.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: SOAP WebService
Posted: Thu Mar 20, 2014 12:57 PM

Hi,

It seems stat I only have a problem with receiving arrays.
If a call a method that returns a INT, i receive it without problems.

If the methode returns this, I have an object.
List<vehilcle> = List of vehicles

If the methode returns this, I have a value.
int? = Driver id

Does anyone know how to read an array?

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: SOAP WebService
Posted: Thu Mar 20, 2014 02:05 PM
Marc,

Maybe you can convert it to an XML document?

Code (fw): Select all Collapse
List<vehilcle> = List of vehicles
oXml := TXmlDocument():New( vehilcle )
xbrowse( oXml )


James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: SOAP WebService
Posted: Thu Mar 20, 2014 03:04 PM
This is from the Microsoft article on SOAP:

"SOAP is a specification that defines the XML format for messages—and that's about it for the required parts of the spec."


XML Web Services Basics
http://msdn.microsoft.com/en-us/library/ms996507.aspx


James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion