Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
11
Erster Beitrag:
vor 8 Jahren
Letzter Beitrag:
vor 7 Jahren, 11 Monaten
Beteiligte Autoren:
Paul Murray, Stefan Bentvelsen, Arie, Paulo Oliveira, PEM.pcs.crosspost, Georgio

Web Services WinDev 15 or WinDev Mobile 15

Startbeitrag von PEM.pcs.crosspost am 17.07.2010 06:42

Greetings All,

Can someone kindly point me to a tutorial that deals with consuming a web service?

Thank you!!

Paul

Message forwarded from pcsoft.us.windev

Antworten:

Hi Paul,

A little more detail? What kind of service?

For mobile: Windows or Android?

Thanks!
Georgio

von Georgio - am 21.07.2010 18:03
Hi Georgio,

In WinDev Mobile, I created a single window with two edit fields as Place and LatLong.

I then imported an ASMX web service which will return a string with the lat and long given the Place. I can 'see' the web service with the methods in the project explorer.

I 'thought' from the tutorials that I could simply call this web service as a procedure, but I guess it must be more difficult than that. It certainly would be more difficult in PB.

And thanks for your thoughts!!

Paul

Here is the code associated with a button on the window:


PlaceEXPRESS is string
sLatlongEXPRESS is string

sPlaceEXPRESS = EDT_place..Value

Info("The value of PlaceEXPRESS is: "+ sPlaceEXPRESS)

sLatlongEXPRESS = GetLatLongByStreetAdd(sPlaceEXPRESS)

Info("The value of LatLongEXPRESS Is: "+ sLatlongEXPRESS)

EDT_LatLong..Value = sLatlongEXPRESS


Here is the error that I get when I run the code:

Error at line 8 of Click BTN_Button1 process.
No 'GetLatLongByStreetAdd' operation with 1 parameter(s) was found.

**********************************************

----- Technical Information -----

WL call:
Process of 'Click BTN_Button1' (EXPRESS_Window_GetLatLong.BTN_Button1), line 8, thread 0

What happened?
No 'GetLatLongByStreetAdd' operation with 1 parameter(s) was found.

Error code: 40048
Level: fatal error (EL_FATAL)

Dump of the error of 'WD150XML.DLL' module (15.00Fqa).
Additional Information:
EIT_PILEWL :
Click BTN_Button1 (EXPRESS_Window_GetLatLong.BTN_Button1), line 8
EIT_DATEHEURE : 23/07/2010 12:40:20

von Paul Murray - am 23.07.2010 16:48
In the windev menu go to Workshop -->XML Web Services -->Import
This will generate several procedures to handle the web service.

After that check the GetLatLongByStreetAdd procedure (i'm assuming this is the name of the procedure) from your code it looks like it have one parameter a ends with result, it's true?

why don't you post the code of the GetLatLongByStreetAdd procedure.

von Paulo Oliveira - am 23.07.2010 16:57
Thanks, Paulo.

I have already imported the web service into my project.

The problem is that I am not sure how to call it.

When I double click on the web service method that I want to use, I see this:


[ {Result} = ] GetLatLongByStreetAdd ({parameters} is GetLatLongByStreetAdd)


I had to change "

von Paul Murray - am 24.07.2010 18:25
Hi Paul,

I suppose that GetLatLongByStreetAdd has to be a structure that is defined somewhere in de set of webservice-procedures. You must use that structure too as type of your parameter.

von Stefan Bentvelsen - am 24.07.2010 20:55
Thanks, Stefan.

I am not sure why it should have to be a structure when the argument is a single string and the result is a single string.

Is there a tutorial for this?

Thank you,

Paul

von Paul Murray - am 25.07.2010 14:03
Hi Paul,

I do not know why it is a structure, but in my opinion it is a structure because there is no datatype GetLatLongByStreetAdd in WinDev, like the type of the parameter in your piece of code:

[ {Result} = ] GetLatLongByStreetAdd ({parameters} is GetLatLongByStreetAdd)

I have not seen a tutorial for this. And every web service can have different parameters. It's defined in and depending of the wsdl-file.

von Stefan Bentvelsen - am 25.07.2010 17:16
I figured it would probably help if I simply include the URL to the web service that I am trying to use:

http://168.144.242.108/Mapping/service1.asmx

http://168.144.242.108/Mapping/service1.asmx?wsdl

The method that I am interested in using is: GetLatLongByStreetAdd

If someone could help me with some sample code on how to actually call the service, I would really appreciate it.

The argument is a string (e.g., 245 Park Ave., New York, NY 10018).

The result is a string that includes both lat and long.

Thanks for any help!!!!

Paul

von Paul Murray - am 25.07.2010 17:16
Okay,

I was able to use my web service in WinDev. But it had NOTHING to do with the Web Service that I imported via Workshop | Webservices | Import and use a Webservice in this project...

Here is the code that works...

sPlaceEXPRESS is string
sLatlongEXPRESS is string
bResExecuteEXPRESS is boolean


sPlaceEXPRESS = EDT_Place..Value

Info("The value of PlaceEXPRESS is: "+ sPlaceEXPRESS)

SOAP.Value[1] = sPlaceEXPRESS
SOAP.Name[1] = "Address"
SOAP.Type[1] = SOAPStringType
bResExecuteEXPRESS = SOAPRun("http://168.144.242.108/GoogleMapsWebService/Service1.asmx","GetLatLongByStreetAdd","http://tempuri.org/","http://tempuri.org/GetLatLongByStreetAdd";)

// Is the communication with the server successful?
IF bResExecuteEXPRESS = True THEN
// Is the procedure successfully run?
IF SOAPGetResult(SOAPResult) "" THEN
// Display the result returned by the procedure
Info("The result is: " + SOAPGetResult(SOAPResult))
ELSE
// Display the error returned by the SOAP server
Error(SOAPError(SOAPErrMessage))
END
ELSE
Error(ErrorInfo(errMessage))
END


//sLatlongEXPRESS = GetLatLongByStreetAdd(sPlaceEXPRESS)

Info("The value of LatLongEXPRESS Is: "+ sLatlongEXPRESS)

//EDT_LatLong..Value = sLatlongEXPRESS

EDT_LatLong..Value = SOAPGetResult(SOAPResult)

Can someone kindly tell me tell me how I to use a web service that is imported?

Thank you!!!

Paul

von Paul Murray - am 25.07.2010 19:49
Hi Paul, .

this will work.

s1 is GetLatLongByStreetAdd
s1.Address = "245 Park Ave., new York, NY 10018"
s2 is GetLatLongByStreetAddResponse
s2 = GetLatLongByStreetAdd(s1)
Info(s2.GetLatLongByStreetAddResult)

Or even shorter
s1 is GetLatLongByStreetAdd
s1.Address = "245 Park Ave., new York, NY 10018"
s2 is string = GetLatLongByStreetAdd(s1)
Info(s2)



von Arie - am 18.08.2010 08:22
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.