You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by "Venkatesan, Kumaran" <Ku...@in.standardchartered.com> on 2008/03/29 18:54:54 UTC

soap fault through class mediators

Hi,

 

How to throw custom soap fault messages from the class mediators.

 

I have the code like below.

 

if (ome.getLocalName().equalsIgnoreCase("groupid")){

   if (ome.getText() != null){

      String soapUserid = ome.getText();

      if (!soapUserid.equalsIgnoreCase(groupId)){

      logger.debug("Groupid from Session object and SOAPXML not valid");

      // TODO: soap fault  //here I need to throw soap fault and it will
be captured at the client side.

      //return false; <this will stop the message mediation alone>

}

   }

 

This email is confidential. If you are not the addressee tell the sender immediately and destroy this email
without using, sending or storing it. Emails are not secure and may suffer errors, viruses, delay,
interception and amendment. Standard Chartered PLC and subsidiaries ("SCGroup") do not accept liability for
damage caused by this email and may monitor email traffic.


Re: soap fault through class mediators

Posted by Ruwan Linton <ru...@gmail.com>.
Hi Venkatesan,

The fault Detail was static so that you can not change that dynamically.
However I think it is worth letting this to be picked up dynamically from
the message as well. I will add this support to the trunk. Is it possible
for you to raise a JIRA for this?

Thanks,
Ruwan

On Mon, Mar 31, 2008 at 7:52 AM, Venkatesan, Kumaran <
Kumaran.Venkatesan@in.standardchartered.com> wrote:

>  Ruwan,
>
>
>
> Thanks a lot for your prompt response on this.
>
>
>
> The issue was resolved and the client application has received the soap
> fault message.  Initially have tried the same logic and the soap fault was
> created at the synapse server but not sent to the client even with "<send/>"
> mediator in the myFaultHander sequence.
>
>
>
> Then have added the "<property name="RESPONSE" value="true" />" in
> synapse.xml to send message out.
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <definitions xmlns="http://ws.apache.org/ns/synapse">
>
> <sequence name="myFaultHandler">
>
> <makefault>
>
>                                  <code value="tns:Receiver" xmlns:tns="
> http://www.w3.org/2003/05/soap-envelope"/>
>
>                                  <reason
> expression="get-property('ERROR_MESSAGE')"/>
>
>                                 <detail>This is the detail section of the
> makefault mediator</detail>
>
>         </makefault>
>
> *        <property name="RESPONSE" value="true" />*
>
>           <send/>
>
> </sequence>
>
>
>
> Now, the challenge is to dynamically change the value of <detail> tag of
> soap fault, so that it could be extracted in the client application.
>
>
>
> Any idea, how to dynamically change the value of <detail> tag, mostly it
> could be the value of synapseException  like below "This is the error".
>
>
>
> throw new SynapseException("This is the error");
>
>
>
>
>  ------------------------------
>
> *From:* Ruwan Linton [mailto:ruwan.linton@gmail.com]
> *Sent:* Sunday, March 30, 2008 7:02 AM
> *To:* dev@synapse.apache.org
> *Cc:* user@synapse.apache.org; pzfreo@gmail.com; asankha@wso2.com
> *Subject:* Re: soap fault through class mediators
>
>
>
> Hi Venkatesan,
>
> There are two possible answers, first in which is to construct a SOAPFault
> and set it to the message context envelope, but I think the more appropriate
> way of doing this is through throwing an exception with the required
> message.
>
> throw new SynapseException("This is the error");
>
> Thanks,
> Ruwan
>
> On Sat, Mar 29, 2008 at 11:24 PM, Venkatesan, Kumaran <
> Kumaran.Venkatesan@in.standardchartered.com> wrote:
>
> Hi,
>
>
>
> How to throw custom soap fault messages from the class mediators.
>
>
>
> I have the code like below.
>
>
>
> *if* (ome.getLocalName().equalsIgnoreCase("groupid")){
>
> *   if* (ome.getText() != *null*){
>
>       String soapUserid = ome.getText();
>
>       *if* (!soapUserid.equalsIgnoreCase(groupId)){
>
>       *logger*.debug("Groupid from Session object and SOAPXML not valid");
>
>       // *TODO*: soap fault  //here I need to throw soap fault and it will
> be captured at the client side.
>
>       //return false; <this will stop the message mediation alone>
>
> }
>
>    }
>
>
>
> This email is confidential. If you are not the addressee tell the sender immediately and destroy this email
>
> without using, sending or storing it. Emails are not secure and may suffer errors, viruses, delay,
>
> interception and amendment. Standard Chartered PLC and subsidiaries ("SCGroup") do not accept liability for
>
> damage caused by this email and may monitor email traffic.
>
>
>
>
> --
> Ruwan Linton
> http://www.wso2.org - "Oxygenating the Web Services Platform"
>
> This email is confidential. If you are not the addressee tell the sender immediately and destroy this email
> without using, sending or storing it. Emails are not secure and may suffer errors, viruses, delay,
> interception and amendment. Standard Chartered PLC and subsidiaries ("SCGroup") do not accept liability for
> damage caused by this email and may monitor email traffic.
>
>


-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"

Re: soap fault through class mediators

Posted by Ruwan Linton <ru...@gmail.com>.
Hi Venkatesan,

The fault Detail was static so that you can not change that dynamically.
However I think it is worth letting this to be picked up dynamically from
the message as well. I will add this support to the trunk. Is it possible
for you to raise a JIRA for this?

Thanks,
Ruwan

On Mon, Mar 31, 2008 at 7:52 AM, Venkatesan, Kumaran <
Kumaran.Venkatesan@in.standardchartered.com> wrote:

>  Ruwan,
>
>
>
> Thanks a lot for your prompt response on this.
>
>
>
> The issue was resolved and the client application has received the soap
> fault message.  Initially have tried the same logic and the soap fault was
> created at the synapse server but not sent to the client even with "<send/>"
> mediator in the myFaultHander sequence.
>
>
>
> Then have added the "<property name="RESPONSE" value="true" />" in
> synapse.xml to send message out.
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <definitions xmlns="http://ws.apache.org/ns/synapse">
>
> <sequence name="myFaultHandler">
>
> <makefault>
>
>                                  <code value="tns:Receiver" xmlns:tns="
> http://www.w3.org/2003/05/soap-envelope"/>
>
>                                  <reason
> expression="get-property('ERROR_MESSAGE')"/>
>
>                                 <detail>This is the detail section of the
> makefault mediator</detail>
>
>         </makefault>
>
> *        <property name="RESPONSE" value="true" />*
>
>           <send/>
>
> </sequence>
>
>
>
> Now, the challenge is to dynamically change the value of <detail> tag of
> soap fault, so that it could be extracted in the client application.
>
>
>
> Any idea, how to dynamically change the value of <detail> tag, mostly it
> could be the value of synapseException  like below "This is the error".
>
>
>
> throw new SynapseException("This is the error");
>
>
>
>
>  ------------------------------
>
> *From:* Ruwan Linton [mailto:ruwan.linton@gmail.com]
> *Sent:* Sunday, March 30, 2008 7:02 AM
> *To:* dev@synapse.apache.org
> *Cc:* user@synapse.apache.org; pzfreo@gmail.com; asankha@wso2.com
> *Subject:* Re: soap fault through class mediators
>
>
>
> Hi Venkatesan,
>
> There are two possible answers, first in which is to construct a SOAPFault
> and set it to the message context envelope, but I think the more appropriate
> way of doing this is through throwing an exception with the required
> message.
>
> throw new SynapseException("This is the error");
>
> Thanks,
> Ruwan
>
> On Sat, Mar 29, 2008 at 11:24 PM, Venkatesan, Kumaran <
> Kumaran.Venkatesan@in.standardchartered.com> wrote:
>
> Hi,
>
>
>
> How to throw custom soap fault messages from the class mediators.
>
>
>
> I have the code like below.
>
>
>
> *if* (ome.getLocalName().equalsIgnoreCase("groupid")){
>
> *   if* (ome.getText() != *null*){
>
>       String soapUserid = ome.getText();
>
>       *if* (!soapUserid.equalsIgnoreCase(groupId)){
>
>       *logger*.debug("Groupid from Session object and SOAPXML not valid");
>
>       // *TODO*: soap fault  //here I need to throw soap fault and it will
> be captured at the client side.
>
>       //return false; <this will stop the message mediation alone>
>
> }
>
>    }
>
>
>
> This email is confidential. If you are not the addressee tell the sender immediately and destroy this email
>
> without using, sending or storing it. Emails are not secure and may suffer errors, viruses, delay,
>
> interception and amendment. Standard Chartered PLC and subsidiaries ("SCGroup") do not accept liability for
>
> damage caused by this email and may monitor email traffic.
>
>
>
>
> --
> Ruwan Linton
> http://www.wso2.org - "Oxygenating the Web Services Platform"
>
> This email is confidential. If you are not the addressee tell the sender immediately and destroy this email
> without using, sending or storing it. Emails are not secure and may suffer errors, viruses, delay,
> interception and amendment. Standard Chartered PLC and subsidiaries ("SCGroup") do not accept liability for
> damage caused by this email and may monitor email traffic.
>
>


-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"

RE: soap fault through class mediators

Posted by "Venkatesan, Kumaran" <Ku...@in.standardchartered.com>.
Ruwan,

 

Thanks a lot for your prompt response on this.

 

The issue was resolved and the client application has received the soap
fault message.  Initially have tried the same logic and the soap fault
was created at the synapse server but not sent to the client even with
"<send/>" mediator in the myFaultHander sequence. 

 

Then have added the "<property name="RESPONSE" value="true" />" in
synapse.xml to send message out.

 

<?xml version="1.0" encoding="UTF-8"?>

<definitions xmlns="http://ws.apache.org/ns/synapse">

<sequence name="myFaultHandler">

<makefault>

                                 <code value="tns:Receiver"
xmlns:tns="http://www.w3.org/2003/05/soap-envelope"/>

                                 <reason
expression="get-property('ERROR_MESSAGE')"/>

                                <detail>This is the detail section of
the makefault mediator</detail>

        </makefault> 

        <property name="RESPONSE" value="true" />

          <send/>

</sequence>

 

Now, the challenge is to dynamically change the value of <detail> tag of
soap fault, so that it could be extracted in the client application.

 

Any idea, how to dynamically change the value of <detail> tag, mostly it
could be the value of synapseException  like below "This is the error".

 

throw new SynapseException("This is the error");

 

 

________________________________

From: Ruwan Linton [mailto:ruwan.linton@gmail.com] 
Sent: Sunday, March 30, 2008 7:02 AM
To: dev@synapse.apache.org
Cc: user@synapse.apache.org; pzfreo@gmail.com; asankha@wso2.com
Subject: Re: soap fault through class mediators

 

Hi Venkatesan,

There are two possible answers, first in which is to construct a
SOAPFault and set it to the message context envelope, but I think the
more appropriate way of doing this is through throwing an exception with
the required message.

throw new SynapseException("This is the error");

Thanks,
Ruwan

On Sat, Mar 29, 2008 at 11:24 PM, Venkatesan, Kumaran
<Ku...@in.standardchartered.com> wrote:

Hi,

 

How to throw custom soap fault messages from the class mediators.

 

I have the code like below.

 

if (ome.getLocalName().equalsIgnoreCase("groupid")){

   if (ome.getText() != null){

      String soapUserid = ome.getText();

      if (!soapUserid.equalsIgnoreCase(groupId)){

      logger.debug("Groupid from Session object and SOAPXML not valid");

      // TODO: soap fault  //here I need to throw soap fault and it will
be captured at the client side.

      //return false; <this will stop the message mediation alone>

}

   }

 

This email is confidential. If you are not the addressee tell the sender
immediately and destroy this email
without using, sending or storing it. Emails are not secure and may
suffer errors, viruses, delay,
interception and amendment. Standard Chartered PLC and subsidiaries
("SCGroup") do not accept liability for
damage caused by this email and may monitor email traffic.




-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform" 

This email is confidential. If you are not the addressee tell the sender immediately and destroy this email
without using, sending or storing it. Emails are not secure and may suffer errors, viruses, delay,
interception and amendment. Standard Chartered PLC and subsidiaries ("SCGroup") do not accept liability for
damage caused by this email and may monitor email traffic.


RE: soap fault through class mediators

Posted by "Venkatesan, Kumaran" <Ku...@in.standardchartered.com>.
Ruwan,

 

Thanks a lot for your prompt response on this.

 

The issue was resolved and the client application has received the soap
fault message.  Initially have tried the same logic and the soap fault
was created at the synapse server but not sent to the client even with
"<send/>" mediator in the myFaultHander sequence. 

 

Then have added the "<property name="RESPONSE" value="true" />" in
synapse.xml to send message out.

 

<?xml version="1.0" encoding="UTF-8"?>

<definitions xmlns="http://ws.apache.org/ns/synapse">

<sequence name="myFaultHandler">

<makefault>

                                 <code value="tns:Receiver"
xmlns:tns="http://www.w3.org/2003/05/soap-envelope"/>

                                 <reason
expression="get-property('ERROR_MESSAGE')"/>

                                <detail>This is the detail section of
the makefault mediator</detail>

        </makefault> 

        <property name="RESPONSE" value="true" />

          <send/>

</sequence>

 

Now, the challenge is to dynamically change the value of <detail> tag of
soap fault, so that it could be extracted in the client application.

 

Any idea, how to dynamically change the value of <detail> tag, mostly it
could be the value of synapseException  like below "This is the error".

 

throw new SynapseException("This is the error");

 

 

________________________________

From: Ruwan Linton [mailto:ruwan.linton@gmail.com] 
Sent: Sunday, March 30, 2008 7:02 AM
To: dev@synapse.apache.org
Cc: user@synapse.apache.org; pzfreo@gmail.com; asankha@wso2.com
Subject: Re: soap fault through class mediators

 

Hi Venkatesan,

There are two possible answers, first in which is to construct a
SOAPFault and set it to the message context envelope, but I think the
more appropriate way of doing this is through throwing an exception with
the required message.

throw new SynapseException("This is the error");

Thanks,
Ruwan

On Sat, Mar 29, 2008 at 11:24 PM, Venkatesan, Kumaran
<Ku...@in.standardchartered.com> wrote:

Hi,

 

How to throw custom soap fault messages from the class mediators.

 

I have the code like below.

 

if (ome.getLocalName().equalsIgnoreCase("groupid")){

   if (ome.getText() != null){

      String soapUserid = ome.getText();

      if (!soapUserid.equalsIgnoreCase(groupId)){

      logger.debug("Groupid from Session object and SOAPXML not valid");

      // TODO: soap fault  //here I need to throw soap fault and it will
be captured at the client side.

      //return false; <this will stop the message mediation alone>

}

   }

 

This email is confidential. If you are not the addressee tell the sender
immediately and destroy this email
without using, sending or storing it. Emails are not secure and may
suffer errors, viruses, delay,
interception and amendment. Standard Chartered PLC and subsidiaries
("SCGroup") do not accept liability for
damage caused by this email and may monitor email traffic.




-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform" 

This email is confidential. If you are not the addressee tell the sender immediately and destroy this email
without using, sending or storing it. Emails are not secure and may suffer errors, viruses, delay,
interception and amendment. Standard Chartered PLC and subsidiaries ("SCGroup") do not accept liability for
damage caused by this email and may monitor email traffic.


Re: soap fault through class mediators

Posted by Ruwan Linton <ru...@gmail.com>.
Hi Venkatesan,

There are two possible answers, first in which is to construct a SOAPFault
and set it to the message context envelope, but I think the more appropriate
way of doing this is through throwing an exception with the required
message.

throw new SynapseException("This is the error");

Thanks,
Ruwan

On Sat, Mar 29, 2008 at 11:24 PM, Venkatesan, Kumaran <
Kumaran.Venkatesan@in.standardchartered.com> wrote:

>  Hi,
>
>
>
> How to throw custom soap fault messages from the class mediators.
>
>
>
> I have the code like below.
>
>
>
> *if* (ome.getLocalName().equalsIgnoreCase("groupid")){
>
> *   if* (ome.getText() != *null*){
>
>       String soapUserid = ome.getText();
>
>       *if* (!soapUserid.equalsIgnoreCase(groupId)){
>
>       *logger*.debug("Groupid from Session object and SOAPXML not valid");
>
>       // *TODO*: soap fault  //here I need to throw soap fault and it will
> be captured at the client side.
>
>       //return false; <this will stop the message mediation alone>
>
> }
>
>    }
>
>
>
> This email is confidential. If you are not the addressee tell the sender immediately and destroy this email
> without using, sending or storing it. Emails are not secure and may suffer errors, viruses, delay,
> interception and amendment. Standard Chartered PLC and subsidiaries ("SCGroup") do not accept liability for
> damage caused by this email and may monitor email traffic.
>
>


-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"

Re: soap fault through class mediators

Posted by Ruwan Linton <ru...@gmail.com>.
Hi Venkatesan,

There are two possible answers, first in which is to construct a SOAPFault
and set it to the message context envelope, but I think the more appropriate
way of doing this is through throwing an exception with the required
message.

throw new SynapseException("This is the error");

Thanks,
Ruwan

On Sat, Mar 29, 2008 at 11:24 PM, Venkatesan, Kumaran <
Kumaran.Venkatesan@in.standardchartered.com> wrote:

>  Hi,
>
>
>
> How to throw custom soap fault messages from the class mediators.
>
>
>
> I have the code like below.
>
>
>
> *if* (ome.getLocalName().equalsIgnoreCase("groupid")){
>
> *   if* (ome.getText() != *null*){
>
>       String soapUserid = ome.getText();
>
>       *if* (!soapUserid.equalsIgnoreCase(groupId)){
>
>       *logger*.debug("Groupid from Session object and SOAPXML not valid");
>
>       // *TODO*: soap fault  //here I need to throw soap fault and it will
> be captured at the client side.
>
>       //return false; <this will stop the message mediation alone>
>
> }
>
>    }
>
>
>
> This email is confidential. If you are not the addressee tell the sender immediately and destroy this email
> without using, sending or storing it. Emails are not secure and may suffer errors, viruses, delay,
> interception and amendment. Standard Chartered PLC and subsidiaries ("SCGroup") do not accept liability for
> damage caused by this email and may monitor email traffic.
>
>


-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"