Domanda

I am trying out WSO2 api manager.

The sample api I am using is:

http://www.thomas-bayer.com/sqlrest/CUSTOMER

The hosted api url is

https://localhost:8243/customer/1.0.0/1

When I invoke the internal url, I see following headers in outbound message

GET http://www.thomas-bayer.com/sqlrest/CUSTOMER/1 HTTP/1.1 
Accept-Encoding: gzip,deflate
Host: www.thomas-bayer.com
Connection: Keep-Alive
User-Agent: Synapse-PT-HttpComponents-NIO

However, I get following message

Connection closed by target host before receiving the request

If I access the url (http://www.thomas-bayer.com/sqlrest/CUSTOMER/1) directly, it works.

Any idea why this might be happening?

È stato utile?

Soluzione

I believe the way you are defining URL pattern is incorrect in API Manager Publisher while publishing the API.

This is how I managed to do it,

  • Create two GET methods with URL pattern as follows
  • /{id} - This works as a path parameter therefore when calling the API you can pass the customer ID after the "/"
  • /* - This gives the list of customers
  • Use "http://www.thomas-bayer.com/sqlrest/CUSTOMER" as your production Endpoint

After defining above way,

  • You can call the API with "h ttps://localhost:8243/customer/1.0.0" which gives the list of customers
  • To view a specific customer details you can use the endpoint as "https://localhost:8243/customer/1.0.0/1" which works as a path parameter
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top