I need to make proxy service in wso2 esb, that would be redirect requests to external wsdl service with pre send auth request to separate operation.
I make sequence like this:
clone
payloadFactory (auth xml request)
call (auth operation)
property (value=get-property('transport', 'Set-Cookie'), name=ExtCookie scope=operation)
property (value=get-property('operation', 'ExtCookie') name=Cookie)
Send (target operation)
When I make first call to this proxy service - It's work fine. But on second call I see in tcpdump that there is Cookie HTTP Header in the clone request.
I try add "property remove" with different scope(transport, operation, Synapse, default, axis2, axis2-client), but no one work. Cookie-Header wasn't removed. I need remove it for correct work with ext service.
Try with the following properties.
<property name="EXCESS_TRANSPORT_HEADERS" scope="axis2" action="remove"/>
<property name="Set-Cookie" scope="transport" action="remove"/>
Related
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 create simple api with URI-template
/my_context/{param1}?b={param2}
I created simple sequence for sending email message to endpoint with address
mailto:user#gmail.com
I opened link
/api/my_context/123?b=222
And found in log messages:
Send TO: user#gmail.com/my_context/123?b=222
Incorrect Address.
Why WSO2 ESB append uri to email address?
Removing REST_URL_POSTFIX property like this will change that behavior.
<property name="REST_URL_POSTFIX" action="remove" scope="axis2"/>
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.