url-maping or uri-template value appended to endoint during call - wso2

I have a resource in my wso2 esb
<resource methods="POST" protocol="http" uri-template="/ft">
<inSequence>
<sequence key="T24InSequence"/>
</inSequence>
<outSequence>
<sequence key="T24OutSequence"/>
</outSequence>
</resorce>
I have a wsdl endpoint that is being called in the T24 Sequence
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="operationsDbWsdlEndpoint" xmlns="http://ws.apache.org/ns/synapse">
<wsdl port="HTTPEndpoint" service="mfb_transact_service" uri="http://localhost:8290/services/mfb_transact_service?wsdl">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</wsdl>
</endpoint>
and I call the endpoint in the following manner
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="T24InsertCashinDBSquence" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log level="full">
<property name="DBACTION" value="=================== INSERT INTO CASHIN DB =================="/>
</log>
<property expression="get-property('SYSTEM_DATE','yyyy-MM-dd HH:mm:ss')" name="requestTime" scope="default" type="STRING"/>
<payloadFactory media-type="xml">
<format>
<p:insert_sop_t24FT_operation xmlns:p="t24FT">
<!--Exactly 1 occurrence -->
<xs:sopRequestId xmlns:xs="t24FT">$1</xs:sopRequestId>
<!--Exactly 1 occurrence -->
<xs:destinationInstitutionCode xmlns:xs="t24FT">$2</xs:destinationInstitutionCode>
<!--Exactly 1 occurrence -->
<xs:destinationAccountNumber xmlns:xs="t24FT">$3
</xs:destinationAccountNumber>
<!--Exactly 1 occurrence -->
<xs:sourceInstitutionCode xmlns:xs="t24FT">$4
</xs:sourceInstitutionCode>
...
</p:insert_sop_t24FT_operation>
</format>
<args>
<arg evaluator="json" expression="$.requestID"/>
<arg evaluator="json" expression="$.destinationInstitutionCode"/>
<arg evaluator="json" expression="$.destinationAccountNumber"/>
<arg evaluator="json" expression="$.sourceInstitutionCode"/>
...
</args>
</payloadFactory>
<property name="FORCE_ERROR_ON_SOAP_FAULT" scope="default" type="STRING" value="true"/>
<callout endpointKey="operationsDbWsdlEndpoint">
<source type="envelope"/>
<target key="response"/>
</callout>
</sequence>
I can not figure out why when I call the endpoint I get the following error
Error processing POST request for : /services/mfb_transact_service.HTTPEndpoint/ft org.apache.axis2.AxisFault: The endpoint reference (EPR) for the Operation not found is /services/mfb_transact_service.HTTPEndpoint/ft and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator.
So it seems like wso2 is appending the /ft to the wsdl url

Can you try adding the following before the callout mediator?
<property name="REST_URL_POSTFIX" action="remove" scope="axis2"/>

Related

WSO2 ESB call not passing envelope

I have an API of the form
<api xmlns="http://ws.apache.org/ns/synapse" name="MyRestApi" context="/practice">
<resource methods="GET" uri-template="/{someValue}">
<inSequence>
<header name="Action" value="urn:sayHello"/>
<payloadFactory media-type="xml">
<format>
<p:sayHello xmlns:p="http://practice">
<p:inputString>$1</p:inputString>
</p:sayHello>
</format>
<args>
<arg evaluator="xml" expression="$ctx:uri.var.someValue"/>
</args>
</payloadFactory>
<log level="full"/>
<call>
<endpoint>
<address uri="http://192.168.0.105:9763/services/Practice/sayHello" format="soap12"/>
</endpoint>
</call>
<enrich>
<source type="body" clone="true"/>
<target type="property" action="child" property="body_of_first_call"/>
</enrich>
<property xmlns:ns="http://practice" name="response" expression="//ns:return" scope="default" type="STRING"/>
<property xmlns:ns="http://practice" name="response2" expression="//ns:sayHelloResponse" scope="default" type="STRING"/>
<log>
<property name="myValue" expression="$ctx:response"/>
<property name="myValue2" expression="$ctx:response2"/>
<property name="myValue3" expression="$ctx:body_of_first_call"/>
</log>
<payloadFactory media-type="xml">
<format>
<result>
<sentValue>$1</sentValue>
<returnedValue>$2</returnedValue>
</result>
</format>
<args>
<arg evaluator="xml" expression="$ctx:uri.var.someValue"/>
<arg evaluator="xml" expression="$ctx:response"/>
</args>
</payloadFactory>
<property name="messageType" value="application/xml" scope="axis2" type="STRING"/>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
Based almost entirely on a guide found here
It's at this point just an attempt to grasp the concepts of connectors and APIs so I can apply it to what I'm doing at work, but I've hit a snag. Any attempts to communicate with an outside SOAP service, which my ESB will need to do, either fails to find the endpoint or fails to pass on the values in the SOAP envelope.
As written above the code will find the endpoint, but the input value inputString in the request is always null. It's essentially identical to putting that address into your browser which completely omits the SOAP envelope, however logging the call prints the envelope as expected to the console so the envelope is being generated but not making its way to the application server.
Things I have also tried:
1) Changing the endpoint address to be the service endpoint, rather than the specific operation. This causes an error from the AS claiming the operation cannot be found. This endpoint and operation work as expected in SoapUI.
2) Using a WSDL endpoint instead of address. Result is the same as in 1.
3) Adding/removing the header tag. All three endpoints have been tried with/without the header tag. Their results do not change.
At this point I've exhausted my admittedly poor understanding of ESBs.
To invoke my service I set up my mediator this way.
<call blocking="true">
<endpoint>
<address uri="http://169.254.193.10:9769/services/ServicePharmacy" format="soap11"/>
</endpoint>
</call>
the blocking property in true is to do synchronous messaging
<call blocking="true">
</call>
this is my API
<api xmlns="http://ws.apache.org/ns/synapse" name="showByIdCallMediator" context="/getByIdCall">
<resource methods="GET" uri-template="/{Id}">
<inSequence>
<property name="getId" expression="get-property('uri.var.Id')" scope="default" type="STRING"/>
<log>
<property name="ID" expression="get-property('getId')"/>
</log>
<payloadFactory media-type="xml">
<format>
<p:searchPharmacy xmlns:p="http://pharmacy.arce.org">
<ax22:pharmacy xmlns:ax22="http://pharmacy.arce.org">
<xs:id xmlns:xs="http://pharmacy.arce.org/xsd">$1</xs:id>
</ax22:pharmacy>
</p:searchPharmacy>
</format>
<args>
<arg evaluator="xml" expression="get-property('getId')"/>
</args>
</payloadFactory>
<header name="Action" scope="default" value="urn:searchPharmacy"/>
<call blocking="true">
<endpoint>
<address uri="http://169.254.193.10:9769/services/ServicePharmacy" format="soap11"/>
</endpoint>
</call>
<log>
<property xmlns:ns="http://org.apache.synapse/xsd" name="Status" expression="get-property('axis2','HTTP_SC')"/>
</log>
<log level="full"/>
<enrich>
<source type="body" clone="true"/>
<target type="property" property="Ouput_Respose_Service"/>
</enrich>
<log level="custom" separator=",">
<property name="Service_Response" expression="get-property('Ouput_Respose_Service')"/>
</log>
<respond description=""/>
</inSequence>
<outSequence>
<log level="full"/>
<send/>
</outSequence>
<faultSequence>
<sequence key="{faultSEQ}"/>
</faultSequence>
</resource>
</api>

Different behaviors between ESB 4.9.0 and 4.8.1

I have this proxy service in ESB 4.8.1, when I test it with SoapUI 5.2.1. I got this problem:
Does not write the full log in the server console when a timeout rise, but when I change it to custom it works.
Does not return any response to SoapUI (payloadFactory does not work)
When I deploy it in ESB 4.9.0 it works perfectly. Its a bug from the older version? How can I fix it?
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="StockQuoteProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<send>
<endpoint>
<address uri="http://localhost:8089/mockStockQuoteProxySoap11Binding"
format="soap11">
<timeout>
<duration>1000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<errorCodes>101500,101501,101506,101507,101508</errorCodes>
<initialDuration>2000</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>3000</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<errorCodes>101504,101505</errorCodes>
<retriesBeforeSuspension>3</retriesBeforeSuspension>
<retryDelay>1</retryDelay>
</markForSuspension>
</address>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence>
<log level="full">
<property name="FALLO" value="DETALLES DEL ERROR!!"/>
<property name="message" expression="get-property('ERROR_MESSAGE')"/>
<property name="code" expression="get-property('ERROR_CODE')"/>
<property name="detail" expression="get-property('ERROR_DETAIL')"/>
<property name="exception" expression="get-property('ERROR_EXCEPTION')"/>
</log>
<payloadFactory>
<format>
<ns:MyResponse xmlns:ns="http://services.samples">
<ns:Error>Execution Error</ns:Error>
</ns:MyResponse>
</format>
</payloadFactory>
<header name="To" action="remove"/>
<property name="RESPONSE" value="true"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<send/>
</faultSequence>
</target>
<description/>
</proxy>
Thanks in advance.
Try with this fault sequence:
Steps:
Create my response message.
Use the enrich mediator to store the body in property OK.
Create a fault message.
Override the body with the property OK using the enrich mediator.
<payloadFactory>
<format>
<ns:getQuoteResponse xmlns:ns="http://services.samples">
<ns:return xmlns:ax21="http://services.samples/xsd">
<status>ERROR</status>
</ns:return>
</ns:getQuoteResponse>
</format>
</payloadFactory>
<log level="full">
<property name="MESSAGE" value="Mensaje despues del payloadFactory"></property>
</log>
<enrich>
<source clone="true" type="body"></source>
<target action="replace" type="property" property="OK"></target>
</enrich>
<makefault version="soap11">
<code xmlns:soap11Env="schemas.xmlsoap.org/soap/envelope/" value="soap11Env:EdnpointTimeout"/>
<reason value="timeout fault"/>
<role/>
</makefault>
<enrich>
<source type="property" clone="true" property="OK"/>
<target type="body"/>
</enrich>
<log level="full">
<property name="MESSAGE" value="Mensaje despues del enrich"></property>
</log>
<send/>
When I run this proxy this is what I get as the response and the console log. Were you expecting something like this?
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<ns:MyResponse xmlns:ns="http://services.samples">
<ns:Error>Execution Error</ns:Error>
</ns:MyResponse>
</soap:Body>
</soap:Envelope>
INFO - LogMediator To: /services/StockQuoteProxy.StockQuoteProxyHttpSoap12Endpoint, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:44da8426-00fc-442a-b4e9-1a9a1dd948f2, Direction: request, FALLO = DETALLES DEL ERROR!!, message = Error connecting to the back end, code = 101503, detail = Error connecting to the back end, exception = null, Envelope: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body></soap:Body></soap:Envelope>

Iterate Mediator sends duplicate payload almost always

We are trying out a scenario where we want to iterate over a list of nodes and make a POST call to some service with each individual request payload. We are seeing the iterate mediator actually sends two elements in that call and
that causes issues on the API end.
I have a mock service deployed locally that returns response say :
<result>
<row>
<product_id>8351</product_id>
<event_key>17708</event_key>
<event_code>AEONBM</event_code>
<show_title>Some Show</show_title>
<venue_name>Eugene ONeill Theatre</venue_name>
<area>ORCHC</area>
<row>C</row>
<seat_num>103</seat_num>
<seat_increment>1</seat_increment>
<marketing_code>PREMIUM</marketing_code>
<Cost>352.0000</Cost>
</row>
<row>
<product_id>8351</product_id>
<event_key>17708</event_key>
<event_code>AEONBM</event_code>
<show_title>Some Show</show_title>
<venue_name>Eugene ONeill Theatre</venue_name>
<area>ORCHC</area>
<row>C</row>
<seat_num>104</seat_num>
<seat_increment>1</seat_increment>
<marketing_code>PREMIUM</marketing_code>
<Cost>352.0000</Cost>
</row
</result>
Here is how my proxy service looks like:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="CreateListingFromGetLocation"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full">
<property name="text" value="Triggering getLocation API call.."/>
</log>
<send receive="createListingsFromGetLocationResponseSequence">
<endpoint>
<http method="get" uri-template="http://localhost:8989/GetLocation/"/>
</endpoint>
</send>
<property name="OUT_ONLY" value="true"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</target>
<description/>
</proxy>
Here is my receiving sequence that is using the iterate mediator:
<sequence xmlns="http://ws.apache.org/ns/synapse" name="createListingsFromGetLocationResponseSequence">
<iterate xmlns:tem="http://tempuri.org" xmlns:ns="http://org.apache.synapse/xsd" expression="//result/row">
<target>
<sequence>
<log level="full">
<property name="LocationRow" value="Row element from GetLocationResponse"></property>
</log>
<payloadFactory media-type="xml">
<format>
<listing xmlns="">
<eventId>$1</eventId>
<eventDescription>$2</eventDescription>
<pricePerTicket>
<amount>$3</amount>
<currency>USD</currency>
</pricePerTicket>
<quantity>$4</quantity>
<section>$5</section>
<rows>$6</rows>
<seats>$7</seats>
<splitOption>NONE</splitOption>
</listing>
</format>
<args>
<arg expression="//event_key" evaluator="xml"></arg>
<arg expression="//show_title" evaluator="xml"></arg>
<arg expression="//Cost" evaluator="xml"></arg>
<arg expression="//seat_increment" evaluator="xml"></arg>
<arg expression="//area" evaluator="xml"></arg>
<arg expression="//row/row" evaluator="xml"></arg>
<arg expression="//seat_num" evaluator="xml"></arg>
</args>
</payloadFactory>
<log level="full">
<property name="ListingRequest" value="Listing request xml"></property>
</log>
<property name="Content-Type" value="application/xml" scope="transport" type="STRING"></property>
<property name="messageType" value="application/xml" scope="transport" type="STRING"></property>
<property name="TARGET_HOST" value="srwd30" scope="transport" type="STRING"></property>
<property name="HTTP_METHOD" value="POST" scope="transport" type="STRING"></property>
<send>
<endpoint>
<http format="pox" method="post" uri-template="http://www.srwd30.com/listings/v1/"></http>
</endpoint>
</send>
</sequence>
</target>
</iterate>
</sequence>
Firstly, I see that it is iterating over each xml node properly, here are some logs indicating that:
[2014-04-22 13:29:42,020] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:3bc14a33-3a7a-478e-bdbf-720f1ec855a5, Direction: response, LocationRow = Row element from GetLocationResponse, Envelope: <?xml version="1.0" encoding="utf-8
"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><row>
<product_id>8351</product_id>
<event_key>17708</event_key>
<event_code>AEONBM</event_code>
<show_title>Some Show</show_title>
<venue_name>Eugene ONeill Theatre</venue_name>
<area>ORCHC</area>
<row>D</row>
<seat_num>103</seat_num>
<seat_increment>1</seat_increment>
<marketing_code>PREMIUM</marketing_code>
<Cost>352.0000</Cost>
</row></soapenv:Body></soapenv:Envelope>
[2014-04-22 13:29:42,021] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:0e04ac15-a0bf-41a3-a7d7-80a1401d3efc, Direction: response, ListingRequest = Listing request xml, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:En
velope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><listing><eventId>17708</eventId><eventDescription>Some Show</eventDescription><pricePerTicket><amount>352.0000</amount><currency>USD</currency></pricePerTicket><quantity>1</quantity><section>ORCHC</section><rows
>C</rows><seats>103</seats><splitOption>NONE</splitOption></listing></soapenv:Body></soapenv:Envelope>
But on my API I see that we are receiving duplicate or two root nodes:
Content-Type: application/xml
Headers: {cache-control=[no-cache], connection=[Keep-Alive],
content-type=[application/xml], host=[www.srwd30.com], http_method=[POST], messagetype=[application/xml], target_host=[srwd30], transfer-encoding=
[chunked], user-agent=[Synapse-PT-HttpComponents-NIO]}
Payload: <listing><eventId>17708</eventId><eventDescription>Some Show</eventDescription><pricePerTicket><amount>352.0000</amount><currency>USD</currenc
y></pricePerTicket><quantity>1</quantity><section>ORCHC</section><rows>C</rows><seats>103</seats><splitOption>NONE</splitOption></listing><listing><eventId>1770
8</eventId><eventDescription>Some Show</eventDescription><pricePerTicket><amount>352.0000</amount><currency>USD</currency></pricePerTicket><quantity>1<
/quantity><section>ORCHC</section><rows>D</rows><seats>104</seats><splitOption>NONE</splitOption></listing>
--------------------------------------
2014-04-22 19:01:51,468 [e14f#fbf/http://www.srwd30.com/listings/v1/] priority=WARN app_name=shared-stubhubjobs thread=http-0.0.0.0-
8080-8 location=AbstractJAXBProvider line=112 javax.xml.bind.UnmarshalException
- with linked exception:
[com.ctc.wstx.exc.WstxParsingException: Illegal to have multiple roots (start tag in epilog?).
at [row,col {unknown-source}]: [1,291]]
From the looks of it, iterator is sending two elements when I make that send call. Am i missing something or doing something wrong? How can make each call independent from other?
I got the issue resolved by adding a Action header using urn:test value for that header. I realized that this was causing that duplicate requests to be sent and sometimes only one request being sent even if the iterator has about 10 records.
<proxy name="PushInventory"
transports="https http"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<log level="full">
<property name="STATUS"
value="+++++++++++++++++ Inside PushInventory Proxy Service ++++++++++++++++++"/>
</log>
<iterate xmlns:tem="http://tempuri.org"
xmlns:ns="http://org.apache.synapse/xsd"
id="pushInventoryIterator"
expression="//result/row"
sequential="true">
<target>
<sequence>
<payloadFactory media-type="xml">
<format>
<listing xmlns="">
<eventId>$1</eventId>
<eventDescription>$2</eventDescription>
<pricePerTicket>
<amount>$3</amount>
<currency>USD</currency>
</pricePerTicket>
<quantity>$4</quantity>
<section>$5</section>
<rows>$6</rows>
<seats>$7</seats>
<splitOption>NONE</splitOption>
</listing>
</format>
<args>
<arg evaluator="xml" expression="//event_key"/>
<arg evaluator="xml" expression="//show_title"/>
<arg evaluator="xml" expression="//Cost"/>
<arg evaluator="xml" expression="//seat_increment"/>
<arg evaluator="xml" expression="//area"/>
<arg evaluator="xml" expression="//row_desc"/>
<arg evaluator="xml" expression="//seat_num"/>
</args>
</payloadFactory>
<log level="full">
<property name="STATUS"
value="++++++++++++ Invoking Listing EndPoint ++++++++++++++"/>
</log>
<property name="Authorization"
value="Basic dafdsfadsfdsafdsfdsafdsafsdfadsf"
scope="transport"
type="STRING"/>
<property name="Content-Type"
value="application/xml"
scope="transport"
type="STRING"/>
<property name="messageType"
value="application/xml"
scope="axis2"
type="STRING"/>
<property name="HTTP_METHOD" value="POST" scope="transport" type="STRING"/>
<header name="Action" scope="default" value="urn:test"/>
<send>
<endpoint key="ListingEndPoint"/>
</send>
</sequence>
</target>
</iterate>
</inSequence>
<outSequence>
<log level="full">
<property name="STATUS"
value="+++++++++++++++++ Inside OutSequence of PushInventory ++++++++++++++++++"/>
</log>
<aggregate>
<completeCondition>
<messageCount min="10" max="10"/>
</completeCondition>
<onComplete xmlns:ns2="com.blah.blah" expression="//listing">
<log level="full" separator=",">
<property name="STATUS"
value="+++++++++++++++++ Aggregating responses back ++++++++++++++++++"/>
</log>
<enrich>
<source type="envelope" clone="true"/>
<target type="body"/>
</enrich>
<send/>
</onComplete>
</aggregate>
</outSequence>
</target>
</proxy>
You put your log before the iterator mediator and see what you're receiving from the endpoint. It may contain duplicate entries. Then within iterate you have another log mediator. Check for records are right.

Set Custom Payload in wso2 ESB or AM?

I have a rest API in ESB server.I need to set payload as follows
<fields>Name</fields>
<query>
<term>
<NUM>100</NUM>
</term>
</query>
any suggestion ?
you could use the payloadfactory mediator in ESB 4.8.1, take this xml as an example. you need to do some changes :-) but it´s an start:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="JsonToXMLProxy"
transports="https http local"
startOnLoad="true"
trace="disable">
<description/>
<target>
<endpoint>
<address uri="http://www.w3schools.com/webservices/tempconvert.asmx" format="soap11"/>
</endpoint>
<inSequence>
<log>
<property name="TEMPERATURA_ENTRADA" expression="json-eval($.celsius)"/>
</log>
<payloadFactory media-type="xml">
<format>
<web:CelsiusToFahrenheit xmlns:web="http://www.w3schools.com/webservices/">
<web:Celsius>$1</web:Celsius>
</web:CelsiusToFahrenheit>
</format>
<args>
<arg evaluator="json" expression="$.celsius"/>
</args>
</payloadFactory>
<header name="Action"
value="http://www.w3schools.com/webservices/CelsiusToFahrenheit"/>
</inSequence>
<outSequence>
<log>
<property xmlns:p="http://www.w3schools.com/webservices/"
name="TEMPERATURA_SALIDA"
expression="//p:CelsiusToFahrenheitResponse/p:CelsiusToFahrenheitResult"/>
</log>
<payloadFactory media-type="json">
<format>
"Temperatura" : {
"EnFahrenheit" : $1
}
</format>
<args>
<arg xmlns:p="http://www.w3schools.com/webservices/"
evaluator="xml"
expression="//p:CelsiusToFahrenheitResponse/p:CelsiusToFahrenheitResult"/>
</args>
</payloadFactory>
<property name="messageType" value="application/json" scope="axis2"/>
<send/>
</outSequence>
</target>
</proxy>
Try payload/enrich mediators ..

how to make a fault message and send it to a jms provider

I'am evaluating WSO2 esb and try this simple use case :
jms -> (esb) -> WebService (HelloService on WSO2 Application Server)
Send ws response to jms queue (end point EPQ_ESB_OUT)
Send fault to jms queue (end point EPQ_ESB_ERR)
When I stop WSO2 Application Server, the fault sequence is called and a message is sent to EPQ_ESB_ERR but the message is always empty...
I've tried to use makefault and buildfactory mediators but it fails in both case (empty message in both case).
My Proxy :
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Test04Proxy02" transports="jms" startOnLoad="true" trace="enable">
<target>
<endpoint key="EPW_HelloService"/>
<inSequence>
<log>
<property name="STEP" value="==== INseq"/>
</log>
</inSequence>
<outSequence>
<property name="OUT_ONLY" value="true"/>
<log>
<property name="STEP" value="==== OUTseq"/>
</log>
<send>
<endpoint key="EPQ_ESB_OUT"/>
</send>
</outSequence>
<faultSequence>
<property name="OUT_ONLY" value="true" scope="default" type="STRING"/>
<log level="full">
<property name="STEP" value="==== FAULTseq"/>
<property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
<property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
<property name="ERROR_DETAIL" expression="get-property('ERROR_DETAIL')"/>
</log>
<payloadFactory>
<format>
<ns:text xmlns:ns="http://myns">$1</ns:text>
</format>
<args>
<arg xmlns:ns="http://myns"
evaluator="xml"
expression="get-property('ERROR_MESSAGE')"/>
</args>
</payloadFactory>
<send>
<endpoint key="EPQ_ESB_ERR"/>
</send>
</faultSequence>
</target>
</proxy>
Any help would be appreciate. Thanks.
Just a guess:
Maybe you are having some issues with namesspaces. WSO seems to use the ns namespace itself extensively, so I would try using a different namespace in your payload factory, eg
<payloadFactory>
<format>
<myns:text xmlns:myns="http://myns">$1</myns:text>
</format>
<args>
<arg evaluator="xml" expression="get-property('ERROR_MESSAGE')"/>
</args>
</payloadFactory>
(you shouldn't actually need a namespace definition in the <arg> element)
problem solved :
Replaced ... by
<makefault version="soap11">
<code expression="get-property('ERROR_CODE')"/>
<reason expression="get-property('ERROR_MESSAGE')"/>
</makefault>
and added
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
just before the end tag.
Don't really know why it works now with this parameter...