where is the best place of validation?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

where is the best place of validation?

acec acec
Hi,
After I read "Best Practices Guide", I still have a
question: "where is the best place of validation?"

I found "Another good example is doing special
pre-processing and validation on parameters before
passing them to a service for processing" in that
guide, so the validation should not be a part of
service, then I try to find an example, which has
validation logic.
But I found all validations were done in service, such
as:
DhlServices.java,
public static String sendDhlRequest(String xmlString)
{
...
 if (xmlString == null) {
            throw new DhlConnectException("XML message
cannot be null");
        }
...
}

Thanks a lot.
tomcat acec


      __________________________________________________________________
Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know at http://ca.answers.yahoo.com
Reply | Threaded
Open this post in threaded view
|

Re: where is the best place of validation?

BJ Freeman
I hope you get more responses than just mine.
Just as a note,
services as denoted in Best Practices Guide, mean those defined in the
servicedef and Scripts folders.
like the services_shipment_dhl.xml
the routine you show is not a service but a routine in the service java
class.
you have two types of Service code. Java and mini-language.
I believe, that the statement about validation was more directed to the
mini-laguage type of service.


acec acec sent the following on 4/17/2008 11:29 AM:

> Hi,
> After I read "Best Practices Guide", I still have a
> question: "where is the best place of validation?"
>
> I found "Another good example is doing special
> pre-processing and validation on parameters before
> passing them to a service for processing" in that
> guide, so the validation should not be a part of
> service, then I try to find an example, which has
> validation logic.
> But I found all validations were done in service, such
> as:
> DhlServices.java,
> public static String sendDhlRequest(String xmlString)
> {
> ...
>  if (xmlString == null) {
>             throw new DhlConnectException("XML message
> cannot be null");
>         }
> ...
> }
>
> Thanks a lot.
> tomcat acec
>
>
>       __________________________________________________________________
> Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know at http://ca.answers.yahoo.com
>
>
>

Reply | Threaded
Open this post in threaded view
|

return my parameters

acec acec
Hi,
I have the following request mapping in my
controller.xml.
=================================================
<request-map uri="RemoveIt">
 <event type="service" path="" invoke="removeIt" />
 <response name="success" type="request-redirect"
value="ListIt"/>
 <response name="error" type="request-redirect"
value="ListIt"/>
</request-map>
=================================================
One of my freemarker file has a url link like:
<@ofbizUrl>RemoveIt</@ofbizUrl>?id=11&view=10"

When I click that link, it will call removeIt() in my
service definition, then I want to pass the parameter:
view=10 to ListIt.
If I use type="request-redirect", it will pass all
parameters, but id=11 should be removed.
If I use request-redirect-noparam, it will not pass
parameters at all.

Is there a way to decide which parameter will be
passed?

Thanks.
tomcat acec



      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the new Yahoo! Canada Messenger for the Web BETA at http://ca.messenger.yahoo.com/webmessengerpromo.php