SOAP WebService

SOAP WebService

Postby Marc Vanzegbroeck » Thu Mar 13, 2014 5: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: Select all  Expand view
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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: SOAP WebService

Postby James Bott » Fri Mar 14, 2014 2:53 pm

Marc,

Perhaps this old message thread will help.

viewtopic.php?f=3&t=18979

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: SOAP WebService

Postby James Bott » Fri Mar 14, 2014 3: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: SOAP WebService

Postby Marc Vanzegbroeck » Fri Mar 14, 2014 3: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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: SOAP WebService

Postby James Bott » Sat Mar 15, 2014 2: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: SOAP WebService

Postby Marc Vanzegbroeck » Mon Mar 17, 2014 4:51 pm

Hi,

I finaly can connect to the webservice :D

Code: Select all  Expand view
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: Select all  Expand view
[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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: SOAP WebService

Postby James Bott » Mon Mar 17, 2014 7:12 pm

Marc,

Try:

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

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

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: SOAP WebService

Postby Marc Vanzegbroeck » Mon Mar 17, 2014 7:18 pm

James Bott wrote:Marc,

Try:

Code: Select all  Expand view
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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: SOAP WebService

Postby James Bott » Mon Mar 17, 2014 9: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: SOAP WebService

Postby Marc Vanzegbroeck » 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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: SOAP WebService

Postby James Bott » Thu Mar 20, 2014 2:05 pm

Marc,

Maybe you can convert it to an XML document?

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


James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: SOAP WebService

Postby James Bott » Thu Mar 20, 2014 3: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 26 guests