Error on Tax Authorities & Global GL Settings Screens

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

Error on Tax Authorities & Global GL Settings Screens

Sharan-F
Hi All

On the Hotwax demo I've found the same error a couple of places:

Accounting / Tax Authorities
Accounting / Global GL Settings

The following error message is displayed:

org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen [component://common/widget/CommonScreens.xml#GlobalDecorator]: java.lang.ClassCastException: javolution.util.FastList (javolution.util.FastList)

Thanks
Sharan
Reply | Threaded
Open this post in threaded view
|

Re: Error on Tax Authorities & Global GL Settings Screens

Scott Gray
Thanks Sharan, should be fixed in rev. 687578

Regards
Scott

2008/8/21 Sharan-F <[hidden email]>:

>
> Hi All
>
> On the Hotwax demo I've found the same error a couple of places:
>
> Accounting / Tax Authorities
> Accounting / Global GL Settings
>
> The following error message is displayed:
>
> org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen
> [component://common/widget/CommonScreens.xml#GlobalDecorator]:
> java.lang.ClassCastException: javolution.util.FastList
> (javolution.util.FastList)
>
> Thanks
> Sharan
>
> --
> View this message in context: http://www.nabble.com/Error-on-Tax-Authorities---Global-GL-Settings-Screens-tp19078743p19078743.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>
Reply | Threaded
Open this post in threaded view
|

Error in CategoryWorker.java

Jacek Wagner
I have noticed while working with Catalog-Categories that the list of
top categories (parent category is null) is incorrect.

I believe that CategoryWorker.java (producing the list of top
categories) has an error;

in line 105 "CurrentProductCategoryRollup" should be replaced with
"PrimaryParentCategoryId"

Jacek
Reply | Threaded
Open this post in threaded view
|

Re: Error in CategoryWorker.java

Jacques Le Roux
Administrator
What makes you believe that ?
Did you see any issues in result ?

Jacques

From: "Jacek Wagner" <[hidden email]>

>I have noticed while working with Catalog-Categories that the list of
> top categories (parent category is null) is incorrect.
>
> I believe that CategoryWorker.java (producing the list of top
> categories) has an error;
>
> in line 105 "CurrentProductCategoryRollup" should be replaced with
> "PrimaryParentCategoryId"
>
> Jacek
>
Reply | Threaded
Open this post in threaded view
|

Re: Error in CategoryWorker.java

Jacek Wagner
Jacques Le Roux wrote:

> What makes you believe that ? Did you see any issues in result ?
>
> Jacques
>
> From: "Jacek Wagner" <[hidden email]>
>> I have noticed while working with Catalog-Categories that the list of
>> top categories (parent category is null) is incorrect.
>>
>> I believe that CategoryWorker.java (producing the list of top
>> categories) has an error;
>>
>> in line 105 "CurrentProductCategoryRollup" should be replaced with
>> "PrimaryParentCategoryId"
>>
>> Jacek
>>
I created a top category using UI, I checked db and found in the
ProductCategory table my newly created category with
PrimaryParentCategoryId = null as expected.
Then I created a sub-category using UI and checked db again and found in
the ProductCategory table my sub-category with PrimaryParentCategoryId
pointing to top category as expected.
After that selecting Choose Top Categories from the UI (webtools/menu
catalog/Browse Categories) I would expect to see my top category only,
but I have seen top category along with sub-category instead).

Jacek
Reply | Threaded
Open this post in threaded view
|

Re: Error in CategoryWorker.java

Scott Gray
Hi Jacek

You must assign the parent category using the category rollup screen,
it is not enough to just assign the primaryParentCategoryId.

Regards
Scott

2008/8/23 Jacek Wagner <[hidden email]>:

> Jacques Le Roux wrote:
>>
>> What makes you believe that ? Did you see any issues in result ?
>>
>> Jacques
>>
>> From: "Jacek Wagner" <[hidden email]>
>>>
>>> I have noticed while working with Catalog-Categories that the list of top
>>> categories (parent category is null) is incorrect.
>>>
>>> I believe that CategoryWorker.java (producing the list of top categories)
>>> has an error;
>>>
>>> in line 105 "CurrentProductCategoryRollup" should be replaced with
>>> "PrimaryParentCategoryId"
>>>
>>> Jacek
>>>
> I created a top category using UI, I checked db and found in the
> ProductCategory table my newly created category with PrimaryParentCategoryId
> = null as expected.
> Then I created a sub-category using UI and checked db again and found in the
> ProductCategory table my sub-category with PrimaryParentCategoryId pointing
> to top category as expected.
> After that selecting Choose Top Categories from the UI (webtools/menu
> catalog/Browse Categories) I would expect to see my top category only, but I
> have seen top category along with sub-category instead).
>
> Jacek
>
Reply | Threaded
Open this post in threaded view
|

Re: Error in CategoryWorker.java

Jacek Wagner
Scott Gray wrote:

> Hi Jacek
>
> You must assign the parent category using the category rollup screen,
> it is not enough to just assign the primaryParentCategoryId.
>
> Regards
> Scott
>
> 2008/8/23 Jacek Wagner <[hidden email]>:
>  
>> Jacques Le Roux wrote:
>>    
>>> What makes you believe that ? Did you see any issues in result ?
>>>
>>> Jacques
>>>
>>> From: "Jacek Wagner" <[hidden email]>
>>>      
>>>> I have noticed while working with Catalog-Categories that the list of top
>>>> categories (parent category is null) is incorrect.
>>>>
>>>> I believe that CategoryWorker.java (producing the list of top categories)
>>>> has an error;
>>>>
>>>> in line 105 "CurrentProductCategoryRollup" should be replaced with
>>>> "PrimaryParentCategoryId"
>>>>
>>>> Jacek
>>>>
>>>>        
>> I created a top category using UI, I checked db and found in the
>> ProductCategory table my newly created category with PrimaryParentCategoryId
>> = null as expected.
>> Then I created a sub-category using UI and checked db again and found in the
>> ProductCategory table my sub-category with PrimaryParentCategoryId pointing
>> to top category as expected.
>> After that selecting Choose Top Categories from the UI (webtools/menu
>> catalog/Browse Categories) I would expect to see my top category only, but I
>> have seen top category along with sub-category instead).
>>
>> Jacek
>>
>>    
Thank you. Works perfectly.

Jacek
Reply | Threaded
Open this post in threaded view
|

OFBiz implementing remote access via SOAP

Jacek Wagner
In reply to this post by Sharan-F
All,

I successfully implemented  and utilized "Sample OFBiz application
implenting remote access via SOAP".
The problem I am having now is to run services (eg add new product) that
require auth. I have tried countless approaches that probably most of
them did make any sense and wondering if anybody may have any idea(s)
which way to go.

Jacek
Reply | Threaded
Open this post in threaded view
|

Re: OFBiz implementing remote access via SOAP

BJ Freeman
also look at
framework/service/src/org/ofbiz/service/engine/SOAPClientEngine.java

Jacek Wagner sent the following on 8/29/2008 11:55 AM:

> All,
>
> I successfully implemented  and utilized "Sample OFBiz application
> implenting remote access via SOAP".
> The problem I am having now is to run services (eg add new product) that
> require auth. I have tried countless approaches that probably most of
> them did make any sense and wondering if anybody may have any idea(s)
> which way to go.
>
> Jacek
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: OFBiz implementing remote access via SOAP

Jacek Wagner
BJ Freeman wrote:

> also look at
> framework/service/src/org/ofbiz/service/engine/SOAPClientEngine.java
>
> Jacek Wagner sent the following on 8/29/2008 11:55 AM:
>  
>> All,
>>
>> I successfully implemented  and utilized "Sample OFBiz application
>> implenting remote access via SOAP".
>> The problem I am having now is to run services (eg add new product) that
>> require auth. I have tried countless approaches that probably most of
>> them did make any sense and wondering if anybody may have any idea(s)
>> which way to go.
>>
>> Jacek
>>
>>
>>
>>    
>
>  
Every service in ofbiz is being called with DispatchContext passed as a
parameter. The service I am creating will be called thru the soap not
from ofbiz. How can I acquire the DispatchContext needed to call
LoginServices and other services? Jacek
Reply | Threaded
Open this post in threaded view
|

Re: OFBiz implementing remote access via SOAP

BJ Freeman
guess you missed the point of the other emails.
Services in ofbiz are not Web_services.
you must create a wrapper in ofbiz then call it using SOAP.
The wrapper then will talk to ofbiz.


Jacek Wagner sent the following on 9/2/2008 2:12 PM:

> BJ Freeman wrote:
>> also look at
>> framework/service/src/org/ofbiz/service/engine/SOAPClientEngine.java
>>
>> Jacek Wagner sent the following on 8/29/2008 11:55 AM:
>>  
>>> All,
>>>
>>> I successfully implemented  and utilized "Sample OFBiz application
>>> implenting remote access via SOAP".
>>> The problem I am having now is to run services (eg add new product) that
>>> require auth. I have tried countless approaches that probably most of
>>> them did make any sense and wondering if anybody may have any idea(s)
>>> which way to go.
>>>
>>> Jacek
>>>
>>>
>>>
>>>    
>>
>>  
> Every service in ofbiz is being called with DispatchContext passed as a
> parameter. The service I am creating will be called thru the soap not
> from ofbiz. How can I acquire the DispatchContext needed to call
> LoginServices and other services? Jacek
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: OFBiz implementing remote access via SOAP

Jacek Wagner
BJ Freeman wrote:

> guess you missed the point of the other emails.
> Services in ofbiz are not Web_services.
> you must create a wrapper in ofbiz then call it using SOAP.
> The wrapper then will talk to ofbiz.
>
>
> Jacek Wagner sent the following on 9/2/2008 2:12 PM:
>  
>> BJ Freeman wrote:
>>    
>>> also look at
>>> framework/service/src/org/ofbiz/service/engine/SOAPClientEngine.java
>>>
>>> Jacek Wagner sent the following on 8/29/2008 11:55 AM:
>>>  
>>>      
>>>> All,
>>>>
>>>> I successfully implemented  and utilized "Sample OFBiz application
>>>> implenting remote access via SOAP".
>>>> The problem I am having now is to run services (eg add new product) that
>>>> require auth. I have tried countless approaches that probably most of
>>>> them did make any sense and wondering if anybody may have any idea(s)
>>>> which way to go.
>>>>
>>>> Jacek
>>>>
>>>>
>>>>
>>>>    
>>>>        
>>>  
>>>      
>> Every service in ofbiz is being called with DispatchContext passed as a
>> parameter. The service I am creating will be called thru the soap not
>> from ofbiz. How can I acquire the DispatchContext needed to call
>> LoginServices and other services? Jacek
>>
>>
>>
>>    
>
>  
I was not clear; I am building a wrapper, but the wrapper has to be able
to call any ofbiz service. J
Reply | Threaded
Open this post in threaded view
|

Re: OFBiz implementing remote access via SOAP

Florin Popa
In reply to this post by BJ Freeman
Hello,

I am also interested in more details regarding this topic. Please let us
know what such a wrapper would actually mean?
The way I temporary solved it by now is not very nice...real axis based
web service are hosted within a separate tomcat accessing directly the
database

best regards,
 Flopa

> guess you missed the point of the other emails.
> Services in ofbiz are not Web_services.
> you must create a wrapper in ofbiz then call it using SOAP.
> The wrapper then will talk to ofbiz.
>
>
> Jacek Wagner sent the following on 9/2/2008 2:12 PM:
>  
>> BJ Freeman wrote:
>>    
>>> also look at
>>> framework/service/src/org/ofbiz/service/engine/SOAPClientEngine.java
>>>
>>> Jacek Wagner sent the following on 8/29/2008 11:55 AM:
>>>  
>>>      
>>>> All,
>>>>
>>>> I successfully implemented  and utilized "Sample OFBiz application
>>>> implenting remote access via SOAP".
>>>> The problem I am having now is to run services (eg add new product) that
>>>> require auth. I have tried countless approaches that probably most of
>>>> them did make any sense and wondering if anybody may have any idea(s)
>>>> which way to go.
>>>>
>>>> Jacek
>>>>
>>>>
>>>>
>>>>    
>>>>        
>>>  
>>>      
>> Every service in ofbiz is being called with DispatchContext passed as a
>> parameter. The service I am creating will be called thru the soap not
>> from ofbiz. How can I acquire the DispatchContext needed to call
>> LoginServices and other services? Jacek
>>
>>
>>
>>    
>
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: OFBiz implementing remote access via SOAP

Jacek Wagner
Florin Popa wrote:

> Hello,
>
> I am also interested in more details regarding this topic. Please let
> us know what such a wrapper would actually mean?
> The way I temporary solved it by now is not very nice...real axis
> based web service are hosted within a separate tomcat accessing
> directly the database
>
> best regards,
> Flopa
>> guess you missed the point of the other emails.
>> Services in ofbiz are not Web_services.
>> you must create a wrapper in ofbiz then call it using SOAP.
>> The wrapper then will talk to ofbiz.
>>
>>
>> Jacek Wagner sent the following on 9/2/2008 2:12 PM:
>>  
>>> BJ Freeman wrote:
>>>    
>>>> also look at
>>>> framework/service/src/org/ofbiz/service/engine/SOAPClientEngine.java
>>>>
>>>> Jacek Wagner sent the following on 8/29/2008 11:55 AM:
>>>>  
>>>>      
>>>>> All,
>>>>>
>>>>> I successfully implemented  and utilized "Sample OFBiz application
>>>>> implenting remote access via SOAP".
>>>>> The problem I am having now is to run services (eg add new
>>>>> product) that
>>>>> require auth. I have tried countless approaches that probably most of
>>>>> them did make any sense and wondering if anybody may have any idea(s)
>>>>> which way to go.
>>>>>
>>>>> Jacek
>>>>>
>>>>>
>>>>>
>>>>>            
>>>>        
>>> Every service in ofbiz is being called with DispatchContext passed as a
>>> parameter. The service I am creating will be called thru the soap not
>>> from ofbiz. How can I acquire the DispatchContext needed to call
>>> LoginServices and other services? Jacek
>>>
>>>
>>>
>>>    
>>
>>
>>  
>
>
Ofbiz wrapper is an ofbiz service capable to call any of ofbiz
service(s), but not being initiated or called from ofbiz framework or
application.

Jacek
Reply | Threaded
Open this post in threaded view
|

Re: OFBiz implementing remote access via SOAP

Jacek Wagner
In reply to this post by BJ Freeman
BJ Freeman wrote:

> guess you missed the point of the other emails.
> Services in ofbiz are not Web_services.
> you must create a wrapper in ofbiz then call it using SOAP.
> The wrapper then will talk to ofbiz.
>
>
> Jacek Wagner sent the following on 9/2/2008 2:12 PM:
>  
>> BJ Freeman wrote:
>>    
>>> also look at
>>> framework/service/src/org/ofbiz/service/engine/SOAPClientEngine.java
>>>
>>> Jacek Wagner sent the following on 8/29/2008 11:55 AM:
>>>  
>>>      
>>>> All,
>>>>
>>>> I successfully implemented  and utilized "Sample OFBiz application
>>>> implenting remote access via SOAP".
>>>> The problem I am having now is to run services (eg add new product) that
>>>> require auth. I have tried countless approaches that probably most of
>>>> them did make any sense and wondering if anybody may have any idea(s)
>>>> which way to go.
>>>>
>>>> Jacek
>>>>
>>>>
>>>>
>>>>    
>>>>        
>>>  
>>>      
>> Every service in ofbiz is being called with DispatchContext passed as a
>> parameter. The service I am creating will be called thru the soap not
>> from ofbiz. How can I acquire the DispatchContext needed to call
>> LoginServices and other services? Jacek
>>
>>
>>
>>    
>
> Can you point me to any example of the ofbiz wrapper written in java?
Jacek

Reply | Threaded
Open this post in threaded view
|

Re: OFBiz implementing remote access via SOAP

BJ Freeman
do a google search
ofbiz Soap
there is a tutorial out there


Jacek Wagner sent the following on 9/3/2008 8:52 AM:

> BJ Freeman wrote:
>> guess you missed the point of the other emails.
>> Services in ofbiz are not Web_services.
>> you must create a wrapper in ofbiz then call it using SOAP.
>> The wrapper then will talk to ofbiz.
>>
>>
>> Jacek Wagner sent the following on 9/2/2008 2:12 PM:
>>  
>>> BJ Freeman wrote:
>>>    
>>>> also look at
>>>> framework/service/src/org/ofbiz/service/engine/SOAPClientEngine.java
>>>>
>>>> Jacek Wagner sent the following on 8/29/2008 11:55 AM:
>>>>  
>>>>      
>>>>> All,
>>>>>
>>>>> I successfully implemented  and utilized "Sample OFBiz application
>>>>> implenting remote access via SOAP".
>>>>> The problem I am having now is to run services (eg add new product)
>>>>> that
>>>>> require auth. I have tried countless approaches that probably most of
>>>>> them did make any sense and wondering if anybody may have any idea(s)
>>>>> which way to go.
>>>>>
>>>>> Jacek
>>>>>
>>>>>
>>>>>
>>>>>            
>>>>        
>>> Every service in ofbiz is being called with DispatchContext passed as a
>>> parameter. The service I am creating will be called thru the soap not
>>> from ofbiz. How can I acquire the DispatchContext needed to call
>>> LoginServices and other services? Jacek
>>>
>>>
>>>
>>>    
>>
>> Can you point me to any example of the ofbiz wrapper written in java?
> Jacek
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

SOAP - ofbiz wrapper

Jacek Wagner
The following is an ofbiz wrapper that performs three tasks: login, get
description for a given product, create new product

When run from webtools (performs successfully all three tasks. when
called as a soap performs successfully login & get descriptions for a
given product. It also run thru create new product, but does not create
new product neither throw any exception(s).

Wondering Jacek
 

public static Map createLHSProduct(DispatchContext dctx, Map context) {
        GenericDelegator delegator = dctx.getDelegator();

        try {
            String productId;
            String loginuser;
            String loginpassword;
            String productType;
            String productName;

            // get the input parameter

            productId = (String) context.get("productId");
            Debug.logInfo("productId = " + productId, module);      
            loginuser = (String) context.get("loginuser");
            Debug.logInfo("loginuser = " + loginuser,
module);                    //prints to the console or console.log
            loginpassword = (String) context.get("loginpassword");
            Debug.logInfo("loginpassword = " + loginpassword,
module);            //prints to the console or console.log
            productType = (String) context.get("productTypeId");
            Debug.logInfo("productTypeId = " + productType,
module);      //prints to the console or console.log
            productName = (String) context.get("internalName");
            Debug.logInfo("internalName = " + productName, module);      
//prints to the console or console.log

// login
            context.put("login.username", loginuser);
            context.put("login.password", loginpassword);
            Map loginresult = LoginServices.userLogin(dctx, context);
            Debug.logInfo("loginresult = " + loginresult, module);      
//prints to the console or console.log

//get description for a given product
            Map queryResult = delegator.findByPrimaryKey("Product",
UtilMisc.toMap("productId", productId));
            Map result = UtilMisc.toMap("description", productId);
            if (queryResult != null) {
                result.put("description", queryResult.get("description"));
            }

//create new product
            context.remove("productId");
            context.put("productTypeId", productType);
            context.put("internalName", productName);    
            Map productresult = SimpleMethod.runSimpleService(
                    "org/ofbiz/product/product/ProductServices.xml",
                    "createProduct", dctx, context);
 
            return result;

        } catch (GenericEntityException ex) {//required if you use
delegator in Java
            return ServiceUtil.returnError(ex.getMessage());
        } catch (Exception ex) {//required if you use delegator in Java
            return ServiceUtil.returnError(ex.getMessage());
        }
    }

Reply | Threaded
Open this post in threaded view
|

Re: SOAP - ofbiz wrapper

BJ Freeman
Simple services don't provide exceptions.
They do return a Map that has error messages in it.
https://demo.hotwaxmedia.com/webtools/control/availableServices?sel_service_name=createProduct
take a look at the Out parameters
Note this is for
org/ofbiz/product/product/ProductServices.xml
and uses a map and runsync

Jacek Wagner sent the following on 9/4/2008 9:55 AM:

> The following is an ofbiz wrapper that performs three tasks: login, get
> description for a given product, create new product
>
> When run from webtools (performs successfully all three tasks. when
> called as a soap performs successfully login & get descriptions for a
> given product. It also run thru create new product, but does not create
> new product neither throw any exception(s).
>
> Wondering Jacek
>  
>
> public static Map createLHSProduct(DispatchContext dctx, Map context) {
>        GenericDelegator delegator = dctx.getDelegator();
>
>        try {
>            String productId;
>            String loginuser;
>            String loginpassword;
>            String productType;
>            String productName;
>
>            // get the input parameter
>
>            productId = (String) context.get("productId");
>            Debug.logInfo("productId = " + productId, module);    
>            loginuser = (String) context.get("loginuser");
>            Debug.logInfo("loginuser = " + loginuser,
> module);                    //prints to the console or console.log
>            loginpassword = (String) context.get("loginpassword");
>            Debug.logInfo("loginpassword = " + loginpassword,
> module);            //prints to the console or console.log
>            productType = (String) context.get("productTypeId");
>            Debug.logInfo("productTypeId = " + productType, module);    
> //prints to the console or console.log
>            productName = (String) context.get("internalName");
>            Debug.logInfo("internalName = " + productName, module);    
> //prints to the console or console.log
>
> // login
>            context.put("login.username", loginuser);
>            context.put("login.password", loginpassword);
>            Map loginresult = LoginServices.userLogin(dctx, context);
>            Debug.logInfo("loginresult = " + loginresult, module);    
> //prints to the console or console.log
>
> //get description for a given product
>            Map queryResult = delegator.findByPrimaryKey("Product",
> UtilMisc.toMap("productId", productId));
>            Map result = UtilMisc.toMap("description", productId);
>            if (queryResult != null) {
>                result.put("description", queryResult.get("description"));
>            }
>
> //create new product
>            context.remove("productId");
>            context.put("productTypeId", productType);
>            context.put("internalName", productName);                Map
> productresult = SimpleMethod.runSimpleService(
>                    "org/ofbiz/product/product/ProductServices.xml",
>                    "createProduct", dctx, context);
>
>            return result;
>
>        } catch (GenericEntityException ex) {//required if you use
> delegator in Java
>            return ServiceUtil.returnError(ex.getMessage());
>        } catch (Exception ex) {//required if you use delegator in Java
>            return ServiceUtil.returnError(ex.getMessage());
>        }
>    }
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: SOAP - ofbiz wrapper

Jacek Wagner
Thank you for the tip. The return map includes  error "You must be
logged in to complete the Create an Product process." I hoped that by
calling LoginServices.userLogin.....with admin/ofbiz (second task)  I am
receiving all credentials I need to complete the task.
Jacek

BJ Freeman wrote:

> Simple services don't provide exceptions.
> They do return a Map that has error messages in it.
> https://demo.hotwaxmedia.com/webtools/control/availableServices?sel_service_name=createProduct
> take a look at the Out parameters
> Note this is for
> org/ofbiz/product/product/ProductServices.xml
> and uses a map and runsync
>
> Jacek Wagner sent the following on 9/4/2008 9:55 AM:
>  
>> The following is an ofbiz wrapper that performs three tasks: login, get
>> description for a given product, create new product
>>
>> When run from webtools (performs successfully all three tasks. when
>> called as a soap performs successfully login & get descriptions for a
>> given product. It also run thru create new product, but does not create
>> new product neither throw any exception(s).
>>
>> Wondering Jacek
>>  
>>
>> public static Map createLHSProduct(DispatchContext dctx, Map context) {
>>        GenericDelegator delegator = dctx.getDelegator();
>>
>>        try {
>>            String productId;
>>            String loginuser;
>>            String loginpassword;
>>            String productType;
>>            String productName;
>>
>>            // get the input parameter
>>
>>            productId = (String) context.get("productId");
>>            Debug.logInfo("productId = " + productId, module);    
>>            loginuser = (String) context.get("loginuser");
>>            Debug.logInfo("loginuser = " + loginuser,
>> module);                    //prints to the console or console.log
>>            loginpassword = (String) context.get("loginpassword");
>>            Debug.logInfo("loginpassword = " + loginpassword,
>> module);            //prints to the console or console.log
>>            productType = (String) context.get("productTypeId");
>>            Debug.logInfo("productTypeId = " + productType, module);    
>> //prints to the console or console.log
>>            productName = (String) context.get("internalName");
>>            Debug.logInfo("internalName = " + productName, module);    
>> //prints to the console or console.log
>>
>> // login
>>            context.put("login.username", loginuser);
>>            context.put("login.password", loginpassword);
>>            Map loginresult = LoginServices.userLogin(dctx, context);
>>            Debug.logInfo("loginresult = " + loginresult, module);    
>> //prints to the console or console.log
>>
>> //get description for a given product
>>            Map queryResult = delegator.findByPrimaryKey("Product",
>> UtilMisc.toMap("productId", productId));
>>            Map result = UtilMisc.toMap("description", productId);
>>            if (queryResult != null) {
>>                result.put("description", queryResult.get("description"));
>>            }
>>
>> //create new product
>>            context.remove("productId");
>>            context.put("productTypeId", productType);
>>            context.put("internalName", productName);                Map
>> productresult = SimpleMethod.runSimpleService(
>>                    "org/ofbiz/product/product/ProductServices.xml",
>>                    "createProduct", dctx, context);
>>
>>            return result;
>>
>>        } catch (GenericEntityException ex) {//required if you use
>> delegator in Java
>>            return ServiceUtil.returnError(ex.getMessage());
>>        } catch (Exception ex) {//required if you use delegator in Java
>>            return ServiceUtil.returnError(ex.getMessage());
>>        }
>>    }
>>
>>
>>
>>
>>    
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: SOAP - ofbiz wrapper

BJ Freeman
did you check each return Map to check for a "success" message

Jacek Wagner sent the following on 9/4/2008 3:01 PM:

> Thank you for the tip. The return map includes  error "You must be
> logged in to complete the Create an Product process." I hoped that by
> calling LoginServices.userLogin.....with admin/ofbiz (second task)  I am
> receiving all credentials I need to complete the task.
> Jacek
>
> BJ Freeman wrote:
>> Simple services don't provide exceptions.
>> They do return a Map that has error messages in it.
>> https://demo.hotwaxmedia.com/webtools/control/availableServices?sel_service_name=createProduct
>>
>> take a look at the Out parameters
>> Note this is for
>> org/ofbiz/product/product/ProductServices.xml
>> and uses a map and runsync
>>
>> Jacek Wagner sent the following on 9/4/2008 9:55 AM:
>>  
>>> The following is an ofbiz wrapper that performs three tasks: login, get
>>> description for a given product, create new product
>>>
>>> When run from webtools (performs successfully all three tasks. when
>>> called as a soap performs successfully login & get descriptions for a
>>> given product. It also run thru create new product, but does not create
>>> new product neither throw any exception(s).
>>>
>>> Wondering Jacek
>>>  
>>>
>>> public static Map createLHSProduct(DispatchContext dctx, Map context) {
>>>        GenericDelegator delegator = dctx.getDelegator();
>>>
>>>        try {
>>>            String productId;
>>>            String loginuser;
>>>            String loginpassword;
>>>            String productType;
>>>            String productName;
>>>
>>>            // get the input parameter
>>>
>>>            productId = (String) context.get("productId");
>>>            Debug.logInfo("productId = " + productId, module);    
>>>            loginuser = (String) context.get("loginuser");
>>>            Debug.logInfo("loginuser = " + loginuser,
>>> module);                    //prints to the console or console.log
>>>            loginpassword = (String) context.get("loginpassword");
>>>            Debug.logInfo("loginpassword = " + loginpassword,
>>> module);            //prints to the console or console.log
>>>            productType = (String) context.get("productTypeId");
>>>            Debug.logInfo("productTypeId = " + productType,
>>> module);     //prints to the console or console.log
>>>            productName = (String) context.get("internalName");
>>>            Debug.logInfo("internalName = " + productName,
>>> module);     //prints to the console or console.log
>>>
>>> // login
>>>            context.put("login.username", loginuser);
>>>            context.put("login.password", loginpassword);
>>>            Map loginresult = LoginServices.userLogin(dctx, context);
>>>            Debug.logInfo("loginresult = " + loginresult, module);    
>>> //prints to the console or console.log
>>>
>>> //get description for a given product
>>>            Map queryResult = delegator.findByPrimaryKey("Product",
>>> UtilMisc.toMap("productId", productId));
>>>            Map result = UtilMisc.toMap("description", productId);
>>>            if (queryResult != null) {
>>>                result.put("description",
>>> queryResult.get("description"));
>>>            }
>>>
>>> //create new product
>>>            context.remove("productId");
>>>            context.put("productTypeId", productType);
>>>            context.put("internalName", productName);                Map
>>> productresult = SimpleMethod.runSimpleService(
>>>                    "org/ofbiz/product/product/ProductServices.xml",
>>>                    "createProduct", dctx, context);
>>>
>>>            return result;
>>>
>>>        } catch (GenericEntityException ex) {//required if you use
>>> delegator in Java
>>>            return ServiceUtil.returnError(ex.getMessage());
>>>        } catch (Exception ex) {//required if you use delegator in Java
>>>            return ServiceUtil.returnError(ex.getMessage());
>>>        }
>>>    }
>>>
>>>
>>>
>>>
>>>    
>>
>>  
>
>
>
>

12