Hi Jacques,

I wanted to perform a service call from an ofbiz form using ajax.  The
service required authentication, and I wasn't sure how to get the username
and password of the logged in user to pass to the soap service call.

I'm using r4.0 and didn't see any ajax examples, so in the end I used a
plain jquery post and parsed the html response:

                $("form[name='ClearanceReport3ListForm']").each(function() {
                        $(this).submit(function(event) {
                                event.preventDefault(); 
                                var inputData = $(this).serialize();
                                var tr = $(this).parent();
                                tr.css("background", "lightgray");
                        $.post(
                                
"<@ofbizUrl>InsurerClearedUpdate3Ajax</@ofbizUrl>", 
                                inputData,
                                function(data){
                                if (data.search(/name="loginform"/) > 0) {      
        
                                                jAlert(
                                                        "Your session has timed 
out out, please<br/>" +
                                                        "click the following 
link to  /myapp/control/login re-login
<br/>" +
                                                        "then return to this 
page to continue."
                                                        );
                                        } else {
                                                jAlert(data, 'Info');
                                                if (data.search(/Details 
saved/) > 0) {
                                                        tr.css("background",  
"#99FF99");
                                                } else {
                                                        tr.css("background", 
"#FF9999");
                                                }                               
                                        }
                        }
                        );                      
                });

It's clunky, but it did the job!

Cheers,

Chris


Jacques Le Roux-2 wrote:
> 
> From: "snowch" <sno...@coralms.com>
>> Hi Forum,
>> 
>> I would like to ajaxify some of my custom forms to make them more
>> interactive.  The services being executed by the forms require
>> authentication.  If I soap enable the services, will the soap web service
>> require a separate authentication step to authenticate the user?  
> 
> No authentication is done at the controller level. But what is the
> relation with Ajax ?
> 
>>Are there
>> any examples of this in the ofbiz modules?
> 
> Look at testSoap service and have a look for soap into wiki FAQ
> 
> Jacques
> 
>> Many thanks,
>> 
>> Chris
>> -- 
>> View this message in context:
>> http://www.nabble.com/Ajax-service-calls-with-authorization-tp24789183p24789183.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Ajax-service-calls-with-authorization-tp24789183p25092283.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply via email to