Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Geocoding using Google API Via Http Client

Former Member
0 Kudos
1,726

Hi Gurus ,

          Am trying to use Google Geo coding(for Latitude and Longitude  information) .I have written program to consume Google Geocode API via HTTP send/receive using Google Maps URL .

1.cl_http_client=>create_by_url

2.http_client_send

3.http_client_receive

But HTTP response is 'Application server error'.

Any prerequisite in system to done for Http send and receive ?

Regards,

Uma

1 ACCEPTED SOLUTION

SimoneMilesi
Active Contributor
0 Kudos
501

Hi Uma!
I just implemented the same procedure to calculate distances in TM routes 

A couple of things you can check:

1-The client is created by http connection (created in SM59) or passing the url?

2-Did you check if you got any proxy / firewall active with your Basis team? My first test got that error due a proxy active

3- could you share your code on how you build the client and the request?

Ty

8 REPLIES 8

SimoneMilesi
Active Contributor
0 Kudos
502

Hi Uma!
I just implemented the same procedure to calculate distances in TM routes 

A couple of things you can check:

1-The client is created by http connection (created in SM59) or passing the url?

2-Did you check if you got any proxy / firewall active with your Basis team? My first test got that error due a proxy active

3- could you share your code on how you build the client and the request?

Ty

0 Kudos
501

Thanks Simone,Even Am trying the same in TM .It will be great if you can help out.

1-The client is created by http connection (created in SM59) or passing the url?

     i used URL method to call google geocode

2-Did you check if you got any proxy / firewall active with your Basis team? My first test got that error due a proxy active

     Sure will check that.Can you please tell the way to check proxy?any transaction ?

    

3- could you share your code on how you build the client and the request?

Used below code

   

.GPS like tool in SAP using Google Map API – SAP Yard


Am getting below exception :


connect to maps.google.com:80 failed: NIECONN_REFUSED(-10)


0 Kudos
501

Create a dummy HTTP destination in SM59 for the URL you want to request and check if it works there. 

Make sure that HTTPS service is available in your SMICM configuration (SMICM => Goto => Services).

If it is still failing increase trace level in SMICM => Goto => Trace Level => Increase and test again. Next paste the result from trace file here (not whole file but only the error info).

0 Kudos
501

I see in your example you are using as URL HTTPS which reply on port 443, not 80 and this could be the first issue

About proxy, ask Basis team, I did the same

Another question: you want to calculate the distance between 2 addresses or just geocoding a place?

Looking at the link, it seems that the request/URL is build pretty different from what Google Maps suggests

https://developers.google.com/maps/documentation/embed/

Getting Started  |  Google Maps Geocoding API  |  Google Develop...


https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=YOUR_API_KEY

It looks like this your url once you completed it? (apart the API Key)

PS.

TM->Transportation Module on SD, not under HR world for me

0 Kudos
501

Thanks Bartosz, I have created dummy RFC destination type 'G' and Tested am getting below errors also I don't have HTTPS in SMICM.

RFC Connection Failed with below error :

Connect to maps.google.com:80 failed: NIECONN_REFU

SMICM Trace :

[Thr 4756] Thu Aug 04 15:23:37 2016

[Thr 4756] SiPeekPendConn: SiSelectInt timed out for sock 99396 (5000ms)

[Thr 4756] NiICheckPendConnection: connection of hdl 144 to 216.58.197.78:80 still in progress (5000)

[Thr 4756] NiIConnect: hdl 144 took local address 0.0.0.0:59223

[Thr 4756] NiIConnect: state of hdl 144 NI_CONN_WAIT

[Thr 4756] NiHLGetHostName: found address 216.58.197.78 in cache

[Thr 4756] NiIGetHostName: addr 216.58.197.78 = hostname 'maps.google.com'

[Thr 4756] NiSrvLGetServName: found port number 80 in cache

[Thr 4756] NiSrvLGetServName: retrying to get service name for '80'

[Thr 4756] *** ERROR => NiBufIConnect: non-buffered connect pending after 5000ms (hdl 144;maps.google.com:80) [nibuf.cpp    4524]

[Thr 4756] NiICloseHandle: called for hdl 144 while waiting for connection

[Thr 4756] NiICloseHandle: shutdown and close hdl 144/sock 99396

[Thr 4756] IcmIConnConnect: Connect to host: maps.google.com, service: 80, NIECONN_REFUSED(-10)

[Thr 4756] *** WARNING => Connect to maps.google.com:80 failed: NIECONN_REFUSED(-10) {00113c00} [icxxconn.c 2356]

[Thr 4756] DpSesGetWorkerType: return workerType DIA for T63_U22449

[Thr 4756] RqQQueueGetNumberOfRequests: Queue <T63_U22449_M0> in slot 67 contains 0 requests of type DIA

[Thr 4756] DpSesGetTasks: found 1 open tasks for T63_U22449_M0

[Thr 4756] DpSesGetWorkerType: return workerType DIA for T63_U22449

[Thr 4756] RqQQueueGetNumberOfRequests: Queue <T63_U22449_M1> in slot 104 contains 0 requests of type DIA

[Thr 4756] DpSesGetTasks: found 0 open tasks for T63_U22449_M1

[Thr 4756] DpSesGetWorkerType: return workerType DIA for T63_U22449

[Thr 4756] RqQQueueGetNumberOfRequests: Queue <T63_U22449_M2> in slot 105 contains 0 requests of type DIA

[Thr 4756] DpSesGetTasks: found 0 open tasks for T63_U22449_M2

[Thr 4756] IcmConnConnect: Connect failed for session GUI T63_U22449_M0, 100, UMAMAG, SMGTERSTS, time=15:23:33, W6, program=RSHTT

[Thr 4756] IcmConnConnect(id=17/146432): free MPI request blocks

[Thr 4756] MPI<8132>30#7 GetInbuf -1 1f41e0 252 (1) -> MPI_EOS: End Of Stream

[Thr 4756] MPI<8132>30#8 FreeInbuf#1 0 1f41e0  0 -> MPI_OK

[Thr 4756] MPI<8131>35#5 GetOutbuf -1 1f41e0 65536 (0) -> 0000000017EA4250 104857600 MPI_OK

[Thr 4756] NiIGetServNo: servicename '8000' = port 8000

[Thr 4756] Address   Offset  Error response:

Regards,

Uma

0 Kudos
501

Yeah Simone.Initially am testing with geo coordinates.Once connection is good will write strategy  to get distance via Google API.I have registered and have  API key.

I hope its problem with connection and requested Basis team to look .

Regards,

Uma

0 Kudos
501

Hi Uma,

If you're missing HTTPS service then get in touch with the Basis team to fix it - otherwise HTTPS connection will not work.

The other thing is that you're executing your test with the wrong port:

[Thr 4756] *** WARNING => Connect to maps.google.com:80 failed: NIECONN_REFUSED(-10) {00113c00} [icxxconn.c 2356]


It should be port 443.

Moreover as far as I remember when configuring the connection to Google API for the last time it was necessary to set this option as well in the RFC connection options.

SimoneMilesi
Active Contributor
0 Kudos
501

for https setup, refer to this blog from