-
-
Save maheeka/237e4de01d13e066937285cc029e05d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina.net.http; | |
struct Address { | |
string address; | |
string street; | |
string state; | |
string city; | |
string zip; | |
} | |
struct Location { | |
string state; | |
string city; | |
} | |
service transformService { | |
@http:Path { value: "/location"} | |
@http:POST {} | |
resource createLocation (message m) { | |
Address a = {number: "123",street: "glenwood",state: "NJ",city: "bloomfield",zip: "07003"}; | |
Location l; | |
transform { | |
a.state = l.state; | |
a.city = l.city; | |
} | |
http:ClientConnector locationEP = create http:ClientConnector ("http://localhost:8080/service"); | |
string reqPath = "send/location"; | |
message response = http:ClientConnector.post(locationEP, reqPath, l); | |
reply response; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment