Ajax service calls with authorization

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

Ajax service calls with authorization

snowch
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?  Are there any examples of this in the ofbiz modules?

Many thanks,

Chris
Reply | Threaded
Open this post in threaded view
|

Re: Ajax service calls with authorization

Jacques Le Roux-2-2
From: "snowch" <[hidden email]>
> 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.
>
Reply | Threaded
Open this post in threaded view
|

Re: Ajax service calls with authorization

chris snow
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 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" <snowch@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.
>
Reply | Threaded
Open this post in threaded view
|

Re: Ajax service calls with authorization

Sumit Pandit-3
Hi Chris,

What kind of error you are getting from Ajax service calling, can you  
please paste the code here, You may find some example of Ajax request  
call in one page checkout process(ecommerce), also you can find some  
service call through Ajax in Accounting - https://localhost:8443/ap/control/FindPurchaseInvoices 
   Here, ajax is being used to calculate running total.

--
Hope this help,
Regards
Sumit Pandit

On 22-Aug-09, at 3:21 PM, snowc wrote:

>
> 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.
>
>
> Cheers,
>
> Chris
>
>
> Jacques Le Roux-2 wrote:
>>
>> From: "snowch" <[hidden email]>
>>> 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 | Threaded
Open this post in threaded view
|

Re: Ajax service calls with authorization

chris snow
Hi Sumit,

I wasn't getting any errors with the code I posted - it all worked ok.

The reason I created my own ajax solution with jquery was that I couldn't find any r4.0 ajax examples.

Cheers,

Chris

Sumit Pandit-3 wrote
Hi Chris,

What kind of error you are getting from Ajax service calling, can you  
please paste the code here, You may find some example of Ajax request  
call in one page checkout process(ecommerce), also you can find some  
service call through Ajax in Accounting - https://localhost:8443/ap/control/FindPurchaseInvoices 
   Here, ajax is being used to calculate running total.

--
Hope this help,
Regards
Sumit Pandit

On 22-Aug-09, at 3:21 PM, snowc wrote:

>
> 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.
>
>
> Cheers,
>
> Chris
>
>
> Jacques Le Roux-2 wrote:
>>
>> From: "snowch" <snowch@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.
>