Hi Dimuthu,

You'll have to drop in a fault sequence similar to the following somewhere
(either in template or Proxy service) and call it onError on the main
sequence:

                   <faultSequence>
<makefault version="soap11">
<code expression="get-property('ERROR_CODE')" />
<reason expression="get-property('ERROR_MESSAGE')" />
<detail expression="get-property('ERROR_DETAIL')" />
</makefault>
<send />
</faultSequence>


On Thu, May 15, 2014 at 3:41 PM, Dimuthu Upeksha <[email protected]> wrote:

> I get following response. But I couldn't find error code (700001) I have
> added at connector side. Only error message is shown inside response body.
> How can I get error code?
>
> HTTP/1.1 500 Internal Server Error
> Host: localhost:8243
> Content-Type: application/json
> Date: Thu, 15 May 2014 10:08:14 GMT
> Server: WSO2-PassThrough-HTTP
> Transfer-Encoding: chunked
> Connection: Keep-Alive
>
> {"Exception":"[LDAP: error code 49 - INVALID_CREDENTIALS: Bind failed:
> ERR_229 Cannot authenticate user uid=admin,ou=system]"}
>
>
> On Thu, May 15, 2014 at 8:58 AM, Ramindu Deshapriya <[email protected]>wrote:
>
>> Hi DImuthu,
>>
>> The HTTP status code will always be 500 for a SOAP fault, which is what
>> you're generating here. Your custom error code will be available in the
>> message that gets returned within the body of the response.
>>
>> Thanks.
>> On May 14, 2014 6:55 PM, "Dimuthu Upeksha [via WSO2 Oxygen Tank]" <
>> [email protected]> wrote:
>>
>>> Hi,
>>>
>>> I'm working on LDAP connector for ESB. I have declared some custom error
>>> codes to represent errors happening inside the connector
>>> Ex
>>> Entry already exists : 500001
>>> Entry does not exists : 500002
>>> Authentication failure : 500003
>>>
>>> At such situations I use following code sample to move to error sequence
>>>
>>> messageContext.setProperty(SynapseConstants.ERROR_CODE, errorCode);
>>> //here errorCode=500001
>>> messageContext.setProperty(SynapseConstants.ERROR_MESSAGE,errorMessage);
>>> messageContext.setProperty(SynapseConstants.ERROR_EXCEPTION,e);
>>> messageContext.setFaultResponse(true);
>>> handleException(errorMessage,e,messageContext);
>>>
>>> In proxy configuration
>>>
>>> <faultSequence>
>>>        <log level="full"/>
>>>        <makefault version="soap11">
>>>               <code expression="get-property('ERROR_CODE')"/>
>>>               <reason expression="get-property('ERROR_MESSAGE')"/>
>>>               <detail/>
>>>         </makefault>
>>>         <send/>
>>> </faultSequence>
>>>
>>> Then I tried sending a fault request to connector using SoapUI. As
>>> response I got error message correctly but status code was always 500. How
>>> can I get actual error code I have passed back to client? What is the
>>> standard way?
>>>
>>> Thanks
>>> Dimuthu
>>> --
>>> Dimuthu Upeksha
>>> Engineering Intern
>>> WSO2 inc.
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=96810&i=0>
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>> ------------------------------
>>>  If you reply to this email, your message will be added to the
>>> discussion below:
>>>
>>> http://wso2-oxygen-tank.10903.n7.nabble.com/Dev-ESB-ESB-Connector-Fault-sequence-problem-tp96810.html
>>>  To start a new topic under WSO2 Development, email
>>> [email protected]
>>> To unsubscribe from WSO2 Development, click 
>>> here<http://wso2-oxygen-tank.10903.n7.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3&code=cmFzYWRlODhAZ21haWwuY29tfDN8LTEwNDAzODU2MTk=>
>>> .
>>> NAML<http://wso2-oxygen-tank.10903.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Dimuthu Upeksha
> Engineering Intern
> WSO2 inc.
>



-- 
Au revoir!
Ramindu Deshapriya.

Member - Sahana Software Foundation http://sahanafoundation.org
http://rdeshapriya.com

<http://www.facebook.com/rdeshapriya>   <http://twitter.com/#%21/rami_desh>
<https://plus.google.com/113801459480978566130>
<http://www.linkedin.com/profile/view?id=84017607&trk=tab_pro>
<http://rdeshapriya.com> <http://lmakuthan.blogspot.com>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to