I publised one test API on WSO2 API Manager as prototype API. But When I am trying to curl the API endpoint I am getting bellow error
curl http://localhost:8280/weather2/v1.0.0
<am:fault xmlns:am="http://wso2.org/apimanager">
<am:code>101508</am:code>
<am:type>Status report</am:type>
<am:message>Runtime Error</am:message>
<am:description>Error in Sender</am:description>
</am:fault>
I am getting the same error for Managed API as well.
There is existing issue which cause this behavior[]. However you can create a custom sequence as below and add it as a insequencefor the API in manage API phase. The issue was, without below sequence the host header going to endpoint asHost: api.mydubaitrip.com:80 which is not supported by that endpoint.
<sequence xmlns="http://ws.apache.org/ns/synapse" name="remove_port_In">
<property name="REQUEST_HOST_HEADER" value="api.mydubaitrip.com" scope="axis2"/>
</sequence>
[1] https://wso2.org/jira/browse/APIMANAGER-4429
Related
I am trying to use the monetization feature in WSO2 APIM. I am testing it out with default Stripe as its billing engine. I have followed this documentation for the configuration WSO2 APIM Monetization. I have commented out the existing workflow definition for SubscriptionCreation and SubscriptionDeletion and added the definition mentioned in the steps.
The current workflow definition after the update looks like this ->
<WorkFlowExtensions>
<ApplicationCreation executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationCreationSimpleWorkflowExecutor"/>
<!--ApplicationCreation executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationCreationApprovalWorkflowExecutor"/-->
<ProductionApplicationRegistration executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationRegistrationSimpleWorkflowExecutor"/>
<!--ProductionApplicationRegistration executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationRegistrationApprovalWorkflowExecutor"/-->
<SandboxApplicationRegistration executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationRegistrationSimpleWorkflowExecutor"/>
<!--SandboxApplicationRegistration executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationRegistrationApprovalWorkflowExecutor"/-->
<!--<SubscriptionCreation executor="org.wso2.carbon.apimgt.impl.workflow.SubscriptionCreationSimpleWorkflowExecutor"/>-->
<SubscriptionCreation executor="org.wso2.apim.monetization.impl.workflow.StripeSubscriptionCreationWorkflowExecutor"/>
<!--SubscriptionCreation executor="org.wso2.carbon.apimgt.impl.workflow.SubscriptionCreationApprovalWorkflowExecutor"/-->
Subscription Update ->
<SubscriptionUpdate executor="org.wso2.carbon.apimgt.impl.workflow.SubscriptionUpdateSimpleWorkflowExecutor"/>
<!--SubscriptionUpdate executor="org.wso2.carbon.apimgt.impl.workflow.SubscriptionUpdateApprovalWorkflowExecutor"/-->
<!--SubscriptionUpdate executor="org.wso2.carbon.apimgt.impl.workflow.SubscriptionUpdateWSWorkflowExecutor">
<Property name="serviceEndpoint">http://localhost:9765/services/SubscriptionApprovalWorkFlowProcess/</Property>
<Property name="username">username</Property>
<Property name="password">password</Property>
<Property name="callbackURL">https://host:port/services/WorkflowCallbackService</Property>
</SubscriptionUpdate-->
<UserSignUp executor="org.wso2.carbon.apimgt.impl.workflow.UserSignUpSimpleWorkflowExecutor"/>
<!--UserSignUp executor="org.wso2.carbon.apimgt.impl.workflow.UserSignUpApprovalWorkflowExecutor"/-->
<!--
***NOTE:***
Users of deletion workflows are expected to implement their own deletion workflow executors and services.
By default API Manager only implements the core functionalities required to support deletion workflows and
simple deletion workflow executors. Default WS deletion workflow implementations are not available with the
distribution.
-->
<!--<SubscriptionDeletion executor="org.wso2.carbon.apimgt.impl.workflow.SubscriptionDeletionSimpleWorkflowExecutor"/>-->
<SubscriptionDeletion executor="org.wso2.apim.monetization.impl.workflow.StripeSubscriptionDeletionWorkflowExecutor"/>
<!--SubscriptionDeletion executor="org.wso2.carbon.apimgt.impl.workflow.SubscriptionDeletionSimpleWorkflowExecutor">
<Property name="serviceEndpoint">http://host:port/services/SubscriptionApprovalWorkFlowProcess/</Property>
<Property name="username">username</Property>
<Property name="password">password</Property>
<Property name="callbackURL">https://host:port/services/WorkflowCallbackService</Property>
</SubscriptionDeletion -->
<ApplicationDeletion executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationDeletionSimpleWorkflowExecutor"/>
<!--ApplicationDeletion executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationDeletionSimpleWorkflowExecutor">
<Property name="serviceEndpoint">http://host:port/services/ApplicationApprovalWorkFlowProcess/</Property>
<Property name="username">username</Property>
<Property name="password">password</Property>
<Property name="callbackURL">https://host:port/services/WorkflowCallbackService</Property>
</ApplicationDeletion-->
<!-- Publisher related workflows -->
<APIStateChange executor="org.wso2.carbon.apimgt.impl.workflow.APIStateChangeSimpleWorkflowExecutor" />
<!--APIStateChange executor="org.wso2.carbon.apimgt.impl.workflow.APIStateChangeApprovalWorkflowExecutor">
<Property name="stateList">Created:Publish,Published:Block</Property>
</APIStateChange-->
<APIProductStateChange executor="org.wso2.carbon.apimgt.impl.workflow.APIProductStateChangeSimpleWorkflowExecutor" />
<!--APIProductStateChange executor="org.wso2.carbon.apimgt.impl.workflow.APIProductStateChangeApprovalWorkflowExecutor">
<Property name="stateList">Created:Publish,Published:Block</Property>
</APIProductStateChange-->
`
When I try to monetize a policy or when I try to subscribe API to an application using the monetized policy, I get the following error ->
ERROR - StripeSubscriptionCreationWorkflowExecutor Error while creating a customer in Stripe for username
ERROR - APIConsumerImpl Could not execute Workflow
org.wso2.carbon.apimgt.impl.workflow.WorkflowException: Error while creating a customer in Stripe for username
Caused by: com.stripe.exception.ApiConnectionException: IOException during API request to Stripe (https://api.stripe.com): HTTPS hostname wrong: should be <api.stripe.com> Please check your internet connection and try again. If this problem persists,you should check Stripe's service status at https://twitter.com/stripestatus, or let us know at support#stripe.com.
It seems the issue is due to the workflow update, but I couldn't figure out the exact issue.
Update: -
I tried removing the workflow changes, and with that configuration, I am able to create an API subscription (Hostname error occurs sometimes and sometimes it does not) but even if the subscription is created respective customer is not getting created on the connected Stripe account.
It seems like your server is unable to communicate with Stripe API endpoint (https://api.stripe.com). You might want to add Stripe domains to your server's allowlist.
I'm wrapping OpenweatherAPI in a wso2 api : WeatherAPI
The openweatherapi has an appid= passed in every call. Where do I put it in WeatherAPI wso2-config ?
Note that I'm incorrectly showing resource and APPID in the endpoint section.
The production endpoint must only read:
https://api.openweathermap.org/data/2.5/
Please provide screenshot in your answer.
Backend Endpoint: https://api.openweathermap.org/data/2.5/
There should be a resource named /weather which accepts query parameter q. (i.e the API query)
APPID is the token that should be sent in every call, which is an access key for Weather API.
Since the APPID is a constant and should be sent with every request, you can add it in a mediation sequence and engage it in the as the In-Sequence of the API.
You can use a sequence similar to this example.
<sequence xmlns="http://ws.apache.org/ns/synapse" name="append_app_id">
<property name="REST_URL_POSTFIX" expression="fn:concat(get-property('axis2','REST_URL_POSTFIX'), '&APPID=<value>')" scope="axis2" type="STRING"/>
</sequence>
I'm currently developing a proxy service using ESB. The service first uses a callout mediator to call a service in DSS and after calls the final endpoint. The DSS endpoint is defined as a WSDL endpoint.
The proxy service URL is, e.g. <host>/esb/services/exampleService, and when I send a post to the service it tries to add this context to the URL of the DSS endpoint, giving out an exception in DSS, namely:
The service cannot be found for the endpoint reference (EPR) <host>/services/dssservice.SOAP11Endpoint/esb/services/exampleService
Is there a way to stop ESB from adding on to the URL?
Callout Configuration:
<callout action="urn:exampleservice" endpointKey="DSSEndpoint"initAxis2ClientOptions="false">
<source type="envelope"/>
<target
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
</callout>
If you require more information, just ask.
Try to define this property before call mediator :
<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>
I've a SOAP web services hosted in a Weblogic Server that uses Web service addressing (WS-A). I'm trying to publish it using WSO2 API Manager.
The original request has a complete SOAP header including an Action and MessageID:
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Action>urn:es:cetelem:ws:venta:promociones:services:promocionesService:promocionesService_v03:PromocionesServicePortType:obtenerPromocionesOperacionVndRequest</wsa:Action>
<wsa:MessageID>uuid:969e636c-067f-4bed-a38a-65f0f81c295d</wsa:MessageID>
</soapenv:Header>
But the wso2-am removes the fields Action and MessageID from the SOAP Header before sending to the final endpoint in the Werblogic server. This is an example of the wrong hearder sent by wso2-am
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"/>
How can I configure wso2-am to keep the SOAP Header sent by the client.
I found a solution. I added a new sequence mediation extension in [CARBON-HOME]/repository/deployment/server/synapse-configs/default/sequences to preserve original WS-A headers. The new extension set to true the PRESERVE_WS_ADDRESSING property.
Visit https://docs.wso2.com/display/ESB460/Generic+Properties .
The code of the new mediator is:
<sequence xmlns="http://ws.apache.org/ns/synapse" name="WSO2AM--Ext--In">
<property name="PRESERVE_WS_ADDRESSING" value="true" scope="default" type="STRING"/>
</sequence>
I am using WSO2 ESB 4.0.3 with Java 6 on MAC OSX 10.7.4. I have also installed Data Services Features.
In the typical scenario I have one proxy service which the client calls and I pass one the request to Data Service. Now if I have FAULT message from the Data service back to proxy how do I check in proxy service whether the response from Data Service is Fault or normal valid response?
Currently I am using following filter mediator logic in outsequence of proxy service
<filter xpath="get-property('FAULT')">
<then>
<log category="ERROR" level="custom" separator=",">
<property name="OWCHECK-faultMessage" value="TQS_OWCHECK - Received Fault From OWCHECK Data Service !!!!"/>
<property expression="$body" name="Fault-I-Got-Is"/>
<property name="OWCHECK-Forwading-Error" value="TQS_OWCHECK - Forwarding the Fault to Error Handler !!!!"/>
</log>
<else>
<xslt key="conf:/tqs/owcheck/proxy-output-transform.xslt"/>
<log category="INFO" level="custom" separator=",">
<property name="ValidResponse" value="TQS_OWCHECK - Sending Valid Response Back."/>
</log>
<send/>
</else>
</filter>
But this logic of checking the "FAULT" property works when axis2 has NIO senders & receivers in axis2.xml.
How ever if I switch the receivers & senders in axis2.xml from NIO to standard servlet one's (org.wso2.carbon.core.transports.http.HttpTransportListener / org.wso2.carbon.core.transports.http.HttpTransportListener) I do not get the "FAULT" property set and my error handling does not work.
Is there a standard way of checking if the response from one proxy service to another or response from data service to proxy is FAULT or not? I am looking for something which is independent of transport senders and receivers, at least HTTP ones.
Please help.
thanks
Abhijit
It is not good documentation I believe where none of the samples talk about how to handle the faults from Data service to Proxy service or am I missing something?
I would be thankful if I know the best practices to handle the errors from Data service as well as from one proxy to another proxy service.
Please help. This is big project at very prestigious company.
I think you need to check whether the soap body element has a soap:fault message or not. you can use the filter mediator with some xpath expression to check that.