Hi Dimuthu,
Please share the complete code for the template/proxy service where you
defined the Faulth Sequence. I'll take a look at it.
Thanks.
On Sun, May 18, 2014 at 9:45 AM, Dimuthu Upeksha [via WSO2 Oxygen Tank] <
[email protected]> wrote:
> Hi Ramindu,
> I tried it
>
> <faultSequence>
> <log level="full"/>
> <makefault version="soap11">
> <code expression="get-property('ERROR_CODE')"/>
> <reason expression="get-property('ERROR_MESSAGE')"/>
> <detail/>
> </makefault>
> <respond/>
> </faultSequence>
>
> And response was same. Error code was missing
>
> HTTP/1.1 500 Internal Server Error
> Host: localhost:8243
> Content-Type: application/json
> Date: Sun, 18 May 2014 03:35:35 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 Sat, May 17, 2014 at 11:52 AM, Ramindu Deshapriya <[hidden
> email]<http://user/SendEmail.jtp?type=node&node=96898&i=0>
> > wrote:
>
>> Hi Dimuthu,
>>
>> Sorry, my earlier mail didn't get delivered.
>>
>> I think you might have to add a respond mediator to the fault sequence.
>>
>> Thanks.
>>
>>
>> On Thu, May 15, 2014 at 5:17 PM, Dimuthu Upeksha [via WSO2 Oxygen Tank]
>> <[hidden
>> email] <http://user/SendEmail.jtp?type=node&node=96883&i=0>> wrote:
>>
>>> Hi Ramindu,
>>>
>>> I added it
>>>
>>> <faultSequence>
>>> <log level="full"/>
>>> <makefault version="soap11">
>>> <code expression="get-property('ERROR_CODE')"/>
>>> <reason expression="get-property('ERROR_MESSAGE')"/>
>>> <detail/>
>>> </makefault>
>>> <send/>
>>> </faultSequence>
>>>
>>> Here is ESB log. But I don't get error code back with response.
>>>
>>> [2014-05-15 15:38:14,105] WARN {SERVICE_LOGGER.ldap} - Executing fault
>>> handler due to exception encountered
>>>
>>> [2014-05-15 15:38:14,105] WARN {SERVICE_LOGGER.ldap} - ERROR_CODE :
>>> 7000001 ERROR_MESSAGE : [LDAP: error code 49 - INVALID_CREDENTIALS: Bind
>>> failed: ERR_229 Cannot authenticate user uid=admin,ou=system]
>>>
>>> [2014-05-15 15:38:14,105] WARN {SERVICE_LOGGER.ldap} - Executing fault
>>> sequence mediator : org.apache.synapse.mediators.base.SequenceMediator
>>>
>>> [2014-05-15 15:38:14,105] INFO {SERVICE_LOGGER.ldap} - To:
>>> /services/ldap, MessageID: urn:uuid:6802c045-76ee-4c79-95b1-346ea166f8dc,
>>> Direction: request, Envelope: <?xml version="1.0"
>>> encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="
>>> http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:errorMessage
>>> xmlns:ns="http://org.wso2.esbconnectors.ldap">[LDAP: error code 49 -
>>> INVALID_CREDENTIALS: Bind failed: ERR_229 Cannot authenticate user
>>> uid=admin,ou=system]</ns:errorMessage></soapenv:Body></soapenv:Envelope>
>>>
>>>
>>>
>>>
>>> On Thu, May 15, 2014 at 3:59 PM, Ramindu Deshapriya <[hidden
>>> email]<http://user/SendEmail.jtp?type=node&node=96823&i=0>
>>> > wrote:
>>>
>>>> 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 <[hidden
>>>> email]<http://user/SendEmail.jtp?type=node&node=96823&i=1>
>>>> > 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 <[hidden
>>>>> email]<http://user/SendEmail.jtp?type=node&node=96823&i=2>
>>>>> > 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]"
>>>>>> <[hidden
>>>>>> email] <http://user/SendEmail.jtp?type=node&node=96823&i=3>> 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 [hidden
>>>>>>> email]<http://user/SendEmail.jtp?type=node&node=96823&i=4>
>>>>>>> To unsubscribe from WSO2 Development, click here.
>>>>>>> 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
>>>>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=96823&i=5>
>>>>>> 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
>>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=96823&i=6>
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Dimuthu Upeksha
>>> Engineering Intern
>>> WSO2 inc.
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=96823&i=7>
>>> 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-tp96810p96823.html
>>> To start a new topic under WSO2 Development, email [hidden
>>> email]<http://user/SendEmail.jtp?type=node&node=96883&i=1>
>>> To unsubscribe from WSO2 Development, click here.
>>> 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>
>>>
>>
>>
>>
>> --
>> 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>
>>
>>
>> ------------------------------
>> View this message in context: Re: [Dev] [ESB] ESB Connector - Fault
>> sequence
>> problem<http://wso2-oxygen-tank.10903.n7.nabble.com/Dev-ESB-ESB-Connector-Fault-sequence-problem-tp96810p96883.html>
>> Sent from the WSO2 Development mailing list
>> archive<http://wso2-oxygen-tank.10903.n7.nabble.com/WSO2-Development-f3.html>at
>> Nabble.com.
>>
>> _______________________________________________
>> Dev mailing list
>> [hidden email] <http://user/SendEmail.jtp?type=node&node=96898&i=1>
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Dimuthu Upeksha
> Engineering Intern
> WSO2 inc.
>
> _______________________________________________
> Dev mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=96898&i=2>
> 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-tp96810p96898.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>
>
--
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>
--
View this message in context:
http://wso2-oxygen-tank.10903.n7.nabble.com/Dev-ESB-ESB-Connector-Fault-sequence-problem-tp96810p96906.html
Sent from the WSO2 Development mailing list archive at Nabble.com._______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev