wso2Api Manager Call Rest Backend with Soap Request and Response - wso2

Our Requirement is that I had Backend Api Service (Rest Services) which have Http Method Post, and Request as JSON which will call wso2APi Manager as Reqest and Response as SOAP
what i had tested was
For Creating API i had used ,Already wsdl of our Dummy Services,also Sequence and Out Sequence.
But when i am calling Rest Back-end Services ,it is not Response Any OutPut to me
Please guide me how i will meet this Scinario

Can you directly call the backend service? If so , then you can compare the request going from AM t0 Backend verser the direct backend call (headers, body etc.) and check what is missing. to check the AM-Backend request you can enable wirelogs. see http://mytecheye.blogspot.com/2013/09/wso2-esb-all-about-wire-logs.html

Related

WSO2 AM - adding custom validation before invoking the backend service

Scenario
I have configured the API in WSO2 which connects to my back-end HTTP service.
Before calling my back-end service, I want to call another HTTP end point (XML over HTTP) to perform some validations. If the validation response is success then the back end point configured in the API gateway can be invoked else the API needs to return error. Please let me know how this can be achieved.
Thanks,
Karthi
You can add a custom in sequence in your API https://docs.wso2.com/display/AM260/Adding+Mediation+Extensions and handle that particular logic there.
In the In sequence, you can add a call mediator https://docs.wso2.com/display/EI660/Call+Mediator to call the Back end and following that you may add a filter mediator https://docs.wso2.com/display/EI660/Filter+Mediator and validate the response and proceed the mediation flow based on it.
In the filter mediator, you may implement a logic to respond back from there itself if it is an error else do nothing so that it will proceed and call you API back end.

Getting binary response or method not allowed. When tried setting only http endpoint I never got response its just keeping processing for long time

I am using wso2 1.10.0 api manager for first time. I need to access the http backend with simple query parameter. I published the api and tried either by setting as queryparam or json object, it's not giving me the expected result. I will get binary response or method not allowed. When tried setting only http endpoint I never got response its just keeping processing for long time. Please suggest me how do I access simple http backend. Need to show demo in a week.
Please help to solve this.
You get 'method not allowed' when you try to access a resource which was not defined for that method (say backend has POST method supporting resource only and you try to do a GET request)
I guess the issue is with the way you have defined the resources for the api from the publisher application. (invalid HTTP methods for resources)
If you think you have defined them correctly, then the next step to identify the issue is wirelogs. wirelogs provide all the info in request passing through the api manager gateway (request headers, body etc)
Follow this article http://mytecheye.blogspot.com/2013/09/wso2-esb-all-about-wire-logs.html on how to enable and read them
You can then directly call the backend (say curl -v to the backend) and compare the request from the direct call vs the one going out from
gateway to the backend and check the difference. This would help you start finding the issue
Since you are new to API manager, I would recommend you to do following first
Try out a simple scenario similar to your one. You can google it. This is from official documentation. would recommend to try out a simple scenario first. say https://docs.wso2.com/display/AM1100/Convert+a+JSON+Message+to+SOAP+and+SOAP+to+JSON
Then use SOAP UI or similar app to directly call the backend web service (not the api manager) and get the SOAP request and SOAP response for the backend.
Then create the api in API manager. you need to do the same thing in the sample i provided. only difference is the soap payload. use the previously collected SOAP messages.
Enable wire logs. for that see the comments in the previous answer. In wirelogs you will see >> and << signs
To read the wire log, first we have to identify message direction.
DEBUG - wire >> - This represent the message coming into API manager from the wire (will notice two set of these. one coming in to the
gateway from the rest client and response coming in to the api manager from the backend. )
DEBUG - wire << - This represents the message going to the wire from API manager (again two sets. request going from api manager to the
backend service and the response sent to the rest client from the api manager.)
the soap message will be printed in this log. check for the request going from api manager to the backend and the response coming from the
backend to the api manager. you can compare that to the onces you collected in the step 2 and do modifications if needed to the sequnces.
the wirelogs will also print the http headers. so check that as well.
hope you could set up a working sample using these steps

Publish and subscribe the POST restful client in the WSO2 API-1.7

I have a post restful client which I need to publish.I am able to publish the same and post subscription, what would be the payload parameters as its a restful client.As I go through the WSO2 docs, they all refer to SOAP requests.
You do not have to send SOAP requests to WSO2 api manager. You can configure api manager to build the message to send to the backend service using you incoming request body (either json or SOAP request)
for example try this sample. This shows how a JSON request is converted to a SOAP payload to access SOAP web service backend. Here payload factory mediator is used to convert the JSON message to SOAP message. if you do not use that mediators, you would be able to send the incomming JSON body directly to backend service (if backend accepts JSON)

Ability to call a soap web service from a browser

I need to clarify some problems regarding soap web services.
1) can I call a soap web service by just typing the url of the endpoint in the browser?
2) does the answer for question depend on what type of technologies used to develop the soap web service?
If I need to invoke a soap web service, i need to send a soap request. But by just sending a get or post request from a browser cannot generate a soap request. so by default I shouldn't be able to invoke a soap web service just using the browser.
but the following two resources are contradicting above assumptions of mine.Can someone explain me how these soap web services can be invoked without a soap request?
https://msdn.microsoft.com/en-us/library/aa719483%28v=vs.71%29.aspx
http://alvinalexander.com/blog/post/java/how-to-call-web-service-from-browser

API Manager passing JWT to backend service

A backend service needs to know the user for the service call. Reading through the API 1.6.0 documentation I have configured it to generate JWT and removed and republished my services as stated. Running tests, I am not seeing the JWT being passed to the backed service in the response headers in Fiddler. I am not using the ESB or Identity services from WSO2.
What am I missing?
JWT information should be passed in the header under the parameter X-JWT-Assertion. The Content is been encoded. Use TCPMon to intercept the request and see if the API Manager is actually passing the JWT. This would be a good starting point to debug.