You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Sharan-F <sh...@gmail.com> on 2008/08/20 23:50:13 UTC

Error on Tax Authorities & Global GL Settings Screens

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.


Re: Error in CategoryWorker.java

Posted by Jacek Wagner <ja...@berkeley.edu>.
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 <ja...@berkeley.edu>:
>   
>> Jacques Le Roux wrote:
>>     
>>> What makes you believe that ? Did you see any issues in result ?
>>>
>>> Jacques
>>>
>>> From: "Jacek Wagner" <ja...@berkeley.edu>
>>>       
>>>> 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

Re: Error in CategoryWorker.java

Posted by Scott Gray <le...@gmail.com>.
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 <ja...@berkeley.edu>:
> Jacques Le Roux wrote:
>>
>> What makes you believe that ? Did you see any issues in result ?
>>
>> Jacques
>>
>> From: "Jacek Wagner" <ja...@berkeley.edu>
>>>
>>> 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
>

Re: Error in CategoryWorker.java

Posted by Jacek Wagner <ja...@berkeley.edu>.
Jacques Le Roux wrote:
> What makes you believe that ? Did you see any issues in result ?
>
> Jacques
>
> From: "Jacek Wagner" <ja...@berkeley.edu>
>> 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

Re: Error in CategoryWorker.java

Posted by Jacques Le Roux <ja...@les7arts.com>.
What makes you believe that ? 
Did you see any issues in result ?

Jacques

From: "Jacek Wagner" <ja...@berkeley.edu>
>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
>

Error in CategoryWorker.java

Posted by Jacek Wagner <ja...@berkeley.edu>.
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

Re: Error on Tax Authorities & Global GL Settings Screens

Posted by Scott Gray <le...@gmail.com>.
Thanks Sharan, should be fixed in rev. 687578

Regards
Scott

2008/8/21 Sharan-F <sh...@gmail.com>:
>
> 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.
>
>

Re: Form Widget question

Posted by Jacques Le Roux <ja...@les7arts.com>.
Could you elaborate a bit more please ?
Which table are you talking about, an entity ?

For <text default-value=.../>  you can use the ${} syntax to have dynamic data filling in (and what is entry-name mechanizm ?)

Jacques

From: "Jacek Wagner" <ja...@berkeley.edu>
> All,
> 
> Is it possible to prepopulate a field with the table content and be able 
> to override it if necessary in the Form Widget?
> 
> Note that <text default-value=.../> cannot get data thru entry-name 
> mechanizm.
> 
> Jacek
>

Form Widget question

Posted by Jacek Wagner <ja...@berkeley.edu>.
All,

Is it possible to prepopulate a field with the table content and be able 
to override it if necessary in the Form Widget?

Note that <text default-value=.../> cannot get data thru entry-name 
mechanizm.

Jacek

Re: variables reset

Posted by Jacek Wagner <ja...@berkeley.edu>.
I buld an apps that has 15 screen widgets and a number of screen forms 
and ftls. In the third screen widget in the logic sequence, 
BirthdayPartyConfirmation  I <set field="partyId" 
from-field="parameters.partyId" to-scope="user"/>  see below screen

    <screen name="BirthdayPartyConfirmation">    
        <section>
            <actions>
                <set field="titleProperty" value="Birthday Party 
Confirmation"/>
                 <set field="partyId" from-field="parameters.partyId" 
to-scope="user"/>                
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" 
location="component://registration/widget/CommonScreens.xml">
                    <decorator-section name="body">
                        <container><label 
style="head1">${uiLabelMap.${titleProperty}}</label></container>                                              

                        <include-form name="BirthdayPartyConfirmation" 
location="component://registration/webapp/registration/customer/RegistrationForms.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

The problem is to reset partyId to null at the very end. The only way I 
was able to do it was by creating the very last screen widget just  to 
reset partyId. I could not do it in java written service and bsh service 
either.

    <screen name="BirthdayPartyCompleted">    
        <section>
            <actions>
                <set field="titleProperty" value="Birthday Party 
Completed"/>       
                <set field="orderId" value="" 
to-scope="user"/>                                         
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" 
location="component://registration/widget/CommonScreens.xml">
                    <decorator-section name="body">
                        <container><label 
style="head1">${uiLabelMap.${titleProperty}} 
</label></container>                                             
                        <include-form name="BirthdayPartyCompleted" 
location="component://registration/webapp/registration/customer/RegistrationForms.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>


Adrian Crum wrote:
> We're going to need more information. Please provide some code 
> snippets or something.
>
> -Adrian
>
> Jacek Wagner wrote:
>> All,
>>
>> What would be the best way to reset variables in ofbiz.
>>
>> I wrote apps that helps selling LHS services. The key problem I am 
>> having is to reset some of the used variables to be sure  they do not 
>> affect the next sales cycle.
>>
>> Jacek
>>
>>


Re: variables reset

Posted by Adrian Crum <ad...@hlmksw.com>.
We're going to need more information. Please provide some code snippets 
or something.

-Adrian

Jacek Wagner wrote:
> All,
> 
> What would be the best way to reset variables in ofbiz.
> 
> I wrote apps that helps selling LHS services. The key problem I am 
> having is to reset some of the used variables to be sure  they do not 
> affect the next sales cycle.
> 
> Jacek
> 
> 

variables reset

Posted by Jacek Wagner <ja...@berkeley.edu>.
All,

What would be the best way to reset variables in ofbiz.

I wrote apps that helps selling LHS services. The key problem I am 
having is to reset some of the used variables to be sure  they do not 
affect the next sales cycle.

Jacek


Re: SOAP - ofbiz wrapper

Posted by Jacek Wagner <ja...@berkeley.edu>.
Thank you very much for your help. Yes I did

{responseMessage=success, 
userLogin=[GenericEntity:UserLogin][createdStamp,2008-07-14 
09:00:22.0(java.sql.Timestamp)][createdTxStamp,2008-07-14 
09:00:21.0(java.sql.Timestamp)][currentPassword,47ca69ebb4bdc9ae0adec130880165d2cc05db1a(java.lang.String)][disabledDateTime,null()][enabled,Y(java.lang.String)][hasLoggedOut,N(java.lang.String)][isSystem,null()][lastCurrencyUom,null()][lastLocale,null()][lastUpdatedStamp,2008-08-28 
12:20:41.0(java.sql.Timestamp)][lastUpdatedTxStamp,2008-08-28 
12:20:41.0(java.sql.Timestamp)][partyId,admin(java.lang.String)][passwordHint,null()][successiveFailedLogins,0(java.lang.Long)][userLoginId,admin(java.lang.String)]}

BJ Freeman wrote:
> 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());
>>>>        }
>>>>    }
>>>>
>>>>
>>>>
>>>>
>>>>     
>>>>         
>>>   
>>>       
>>
>>
>>     
>
>   


Re: SOAP - ofbiz wrapper

Posted by BJ Freeman <bj...@free-man.net>.
I believe you want someone to help you code you wrapper.
I hope you find someone to do that for you on the list.

Jacek Wagner sent the following on 9/5/2008 10:57 AM:
> It is my fault I did not communicate well enough what i wanted. Here is
> my final attempt.
> 
> This is what i want : add new product utilizing remote access via SOAP
> 
> This is what i have: ofbiz has service "createProduct" that requires
> auth="true"
> 
> This is what i know: ofbiz services are not Web_services
> 
> You suggested in previous exchange  to created a wrapper in ofbiz (ofbiz
> wrapper will call createProduct service ) that can be called using soap.
> 
> I created ofbiz wrapper and when i test thru the webtools (used login
> admin/ofbiz) it let me add new product, but when i call from the remote
> client i am getting a message that i have to login to complete transaction.
> The question is how to login within ofbiz wrapper before calling
> createProduct implementation.
> 
> Below the code that logins successfully, but does not pass credentials
> to the service
> 
> public static Map createLHSProduct(DispatchContext dctx, Map context) {
>       GenericDelegator delegator = dctx.getDelegator();
> 
>  try {
>     String loginuser;
>     String loginpassword;
>     String productType;
>     String productName;
> 
>   // get the input parameter
> 
>   loginuser = (String) context.get("loginuser");
>   Debug.logInfo("loginuser = " + loginuser, module);    loginpassword =
> (String) context.get("loginpassword");
>   Debug.logInfo("loginpassword = " + loginpassword,module);    
> productType = (String) context.get("productTypeId");
>   Debug.logInfo("productTypeId = " + productType,module);    productName
> = (String) context.get("internalName");
>   Debug.logInfo("internalName = " + productName,module);
> // login
>     context.put("login.username", loginuser);
>     context.put("login.password", loginpassword);
>     Map loginresult = LoginServices.userLogin(dctx, context);
>     Debug.logInfo("loginresult = " + loginresult,module);
> //create new product
>      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) {
>         return ServiceUtil.returnError(ex.getMessage());
>   } catch (Exception ex) {
>      return ServiceUtil.returnError(ex.getMessage());
>       }
>   }
> 
> 
> 
> BJ Freeman wrote:
>> there is code already that you can follow the flow.
>> it save me having to explain what is already used.
>> you can follow the flow of that code to write you wrapper.
>>
>> for instance you are trying to deal with a product.
>> so if you follow the code flow that creates a product in ofbiz
>> you will have a template on how to do this in your wrapper.
>>
>>
>> Jacek Wagner sent the following on 9/4/2008 5:41 PM:
>>  
>>> I  am not sure I follow. All what I want from this ofbiz wrapper to
>>> obtain credential in order to complete adding new  product.
>>> This ofbiz wrapper is being called thru soap and has to be able to login
>>> and process new product.
>>>
>>> BJ Freeman wrote:
>>>    
>>>> I am assuming that you have read code that already does this operations
>>>> to pick up what you not doing.
>>>>
>>>>
>>>> BJ Freeman sent the following on 9/4/2008 5:05 PM:
>>>>  
>>>>      
>>>>> 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());
>>>>>>>>        }
>>>>>>>>    }
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                             
>>>>>>>                       
>>>>>>                 
>>>>>             
>>>>         
>>>
>>>
>>>     
>>
>>   
> 
> 
> 
> 


Re: SOAP - ofbiz wrapper

Posted by BJ Freeman <bj...@free-man.net>.
oops replied to wrong  eamil.

BJ Freeman sent the following on 9/5/2008 11:57 AM:
> there is supporting code for the xml that also has to be introduced.
> not sure it will work in 4.0.
> if you want Trunk features it is best to use the Trunk.
> 
> 
> Jacek Wagner sent the following on 9/5/2008 10:57 AM:
>> It is my fault I did not communicate well enough what i wanted. Here is
>> my final attempt.
>>
>> This is what i want : add new product utilizing remote access via SOAP
>>
>> This is what i have: ofbiz has service "createProduct" that requires
>> auth="true"
>>
>> This is what i know: ofbiz services are not Web_services
>>
>> You suggested in previous exchange  to created a wrapper in ofbiz (ofbiz
>> wrapper will call createProduct service ) that can be called using soap.
>>
>> I created ofbiz wrapper and when i test thru the webtools (used login
>> admin/ofbiz) it let me add new product, but when i call from the remote
>> client i am getting a message that i have to login to complete transaction.
>> The question is how to login within ofbiz wrapper before calling
>> createProduct implementation.
>>
>> Below the code that logins successfully, but does not pass credentials
>> to the service
>>
>> public static Map createLHSProduct(DispatchContext dctx, Map context) {
>>       GenericDelegator delegator = dctx.getDelegator();
>>
>>  try {
>>     String loginuser;
>>     String loginpassword;
>>     String productType;
>>     String productName;
>>
>>   // get the input parameter
>>
>>   loginuser = (String) context.get("loginuser");
>>   Debug.logInfo("loginuser = " + loginuser, module);    loginpassword =
>> (String) context.get("loginpassword");
>>   Debug.logInfo("loginpassword = " + loginpassword,module);    
>> productType = (String) context.get("productTypeId");
>>   Debug.logInfo("productTypeId = " + productType,module);    productName
>> = (String) context.get("internalName");
>>   Debug.logInfo("internalName = " + productName,module);
>> // login
>>     context.put("login.username", loginuser);
>>     context.put("login.password", loginpassword);
>>     Map loginresult = LoginServices.userLogin(dctx, context);
>>     Debug.logInfo("loginresult = " + loginresult,module);
>> //create new product
>>      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) {
>>         return ServiceUtil.returnError(ex.getMessage());
>>   } catch (Exception ex) {
>>      return ServiceUtil.returnError(ex.getMessage());
>>       }
>>   }
>>
>>
>>
>> BJ Freeman wrote:
>>> there is code already that you can follow the flow.
>>> it save me having to explain what is already used.
>>> you can follow the flow of that code to write you wrapper.
>>>
>>> for instance you are trying to deal with a product.
>>> so if you follow the code flow that creates a product in ofbiz
>>> you will have a template on how to do this in your wrapper.
>>>
>>>
>>> Jacek Wagner sent the following on 9/4/2008 5:41 PM:
>>>  
>>>> I  am not sure I follow. All what I want from this ofbiz wrapper to
>>>> obtain credential in order to complete adding new  product.
>>>> This ofbiz wrapper is being called thru soap and has to be able to login
>>>> and process new product.
>>>>
>>>> BJ Freeman wrote:
>>>>    
>>>>> I am assuming that you have read code that already does this operations
>>>>> to pick up what you not doing.
>>>>>
>>>>>
>>>>> BJ Freeman sent the following on 9/4/2008 5:05 PM:
>>>>>  
>>>>>      
>>>>>> 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());
>>>>>>>>>        }
>>>>>>>>>    }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                             
>>>>>>>>                       
>>>>>>>                 
>>>>>>             
>>>>>         
>>>>
>>>>     
>>>   
>>
>>
>>
> 
> 
> 
> 


Re: SOAP - ofbiz wrapper

Posted by BJ Freeman <bj...@free-man.net>.
there is supporting code for the xml that also has to be introduced.
not sure it will work in 4.0.
if you want Trunk features it is best to use the Trunk.


Jacek Wagner sent the following on 9/5/2008 10:57 AM:
> It is my fault I did not communicate well enough what i wanted. Here is
> my final attempt.
> 
> This is what i want : add new product utilizing remote access via SOAP
> 
> This is what i have: ofbiz has service "createProduct" that requires
> auth="true"
> 
> This is what i know: ofbiz services are not Web_services
> 
> You suggested in previous exchange  to created a wrapper in ofbiz (ofbiz
> wrapper will call createProduct service ) that can be called using soap.
> 
> I created ofbiz wrapper and when i test thru the webtools (used login
> admin/ofbiz) it let me add new product, but when i call from the remote
> client i am getting a message that i have to login to complete transaction.
> The question is how to login within ofbiz wrapper before calling
> createProduct implementation.
> 
> Below the code that logins successfully, but does not pass credentials
> to the service
> 
> public static Map createLHSProduct(DispatchContext dctx, Map context) {
>       GenericDelegator delegator = dctx.getDelegator();
> 
>  try {
>     String loginuser;
>     String loginpassword;
>     String productType;
>     String productName;
> 
>   // get the input parameter
> 
>   loginuser = (String) context.get("loginuser");
>   Debug.logInfo("loginuser = " + loginuser, module);    loginpassword =
> (String) context.get("loginpassword");
>   Debug.logInfo("loginpassword = " + loginpassword,module);    
> productType = (String) context.get("productTypeId");
>   Debug.logInfo("productTypeId = " + productType,module);    productName
> = (String) context.get("internalName");
>   Debug.logInfo("internalName = " + productName,module);
> // login
>     context.put("login.username", loginuser);
>     context.put("login.password", loginpassword);
>     Map loginresult = LoginServices.userLogin(dctx, context);
>     Debug.logInfo("loginresult = " + loginresult,module);
> //create new product
>      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) {
>         return ServiceUtil.returnError(ex.getMessage());
>   } catch (Exception ex) {
>      return ServiceUtil.returnError(ex.getMessage());
>       }
>   }
> 
> 
> 
> BJ Freeman wrote:
>> there is code already that you can follow the flow.
>> it save me having to explain what is already used.
>> you can follow the flow of that code to write you wrapper.
>>
>> for instance you are trying to deal with a product.
>> so if you follow the code flow that creates a product in ofbiz
>> you will have a template on how to do this in your wrapper.
>>
>>
>> Jacek Wagner sent the following on 9/4/2008 5:41 PM:
>>  
>>> I  am not sure I follow. All what I want from this ofbiz wrapper to
>>> obtain credential in order to complete adding new  product.
>>> This ofbiz wrapper is being called thru soap and has to be able to login
>>> and process new product.
>>>
>>> BJ Freeman wrote:
>>>    
>>>> I am assuming that you have read code that already does this operations
>>>> to pick up what you not doing.
>>>>
>>>>
>>>> BJ Freeman sent the following on 9/4/2008 5:05 PM:
>>>>  
>>>>      
>>>>> 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());
>>>>>>>>        }
>>>>>>>>    }
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                             
>>>>>>>                       
>>>>>>                 
>>>>>             
>>>>         
>>>
>>>
>>>     
>>
>>   
> 
> 
> 
> 


Re: SOAP - ofbiz wrapper

Posted by Jacek Wagner <ja...@berkeley.edu>.
It is my fault I did not communicate well enough what i wanted. Here is 
my final attempt.

This is what i want : add new product utilizing remote access via SOAP

This is what i have: ofbiz has service "createProduct" that requires 
auth="true"

This is what i know: ofbiz services are not Web_services

You suggested in previous exchange  to created a wrapper in ofbiz (ofbiz 
wrapper will call createProduct service ) that can be called using soap.

I created ofbiz wrapper and when i test thru the webtools (used login 
admin/ofbiz) it let me add new product, but when i call from the remote 
client i am getting a message that i have to login to complete transaction.
The question is how to login within ofbiz wrapper before calling 
createProduct implementation.
 
Below the code that logins successfully, but does not pass credentials 
to the service

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

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

   // get the input parameter

   loginuser = (String) context.get("loginuser");
   Debug.logInfo("loginuser = " + loginuser, module);  
   loginpassword = (String) context.get("loginpassword");
   Debug.logInfo("loginpassword = " + loginpassword,module);   
   productType = (String) context.get("productTypeId");
   Debug.logInfo("productTypeId = " + productType,module);  
   productName = (String) context.get("internalName");
   Debug.logInfo("internalName = " + productName,module); 

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

//create new product
      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) {
         return ServiceUtil.returnError(ex.getMessage());
   } catch (Exception ex) {
	 return ServiceUtil.returnError(ex.getMessage());
       }
   }



BJ Freeman wrote:
> there is code already that you can follow the flow.
> it save me having to explain what is already used.
> you can follow the flow of that code to write you wrapper.
>
> for instance you are trying to deal with a product.
> so if you follow the code flow that creates a product in ofbiz
> you will have a template on how to do this in your wrapper.
>
>
> Jacek Wagner sent the following on 9/4/2008 5:41 PM:
>   
>> I  am not sure I follow. All what I want from this ofbiz wrapper to
>> obtain credential in order to complete adding new  product.
>> This ofbiz wrapper is being called thru soap and has to be able to login
>> and process new product.
>>
>> BJ Freeman wrote:
>>     
>>> I am assuming that you have read code that already does this operations
>>> to pick up what you not doing.
>>>
>>>
>>> BJ Freeman sent the following on 9/4/2008 5:05 PM:
>>>  
>>>       
>>>> 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());
>>>>>>>        }
>>>>>>>    }
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>>>               
>>>>>>           
>>>>>>             
>>>>>       
>>>>>           
>>>>     
>>>>         
>>>   
>>>       
>>
>>
>>     
>
>   


Re: SOAP - ofbiz wrapper

Posted by BJ Freeman <bj...@free-man.net>.
there is code already that you can follow the flow.
it save me having to explain what is already used.
you can follow the flow of that code to write you wrapper.

for instance you are trying to deal with a product.
so if you follow the code flow that creates a product in ofbiz
you will have a template on how to do this in your wrapper.


Jacek Wagner sent the following on 9/4/2008 5:41 PM:
> I  am not sure I follow. All what I want from this ofbiz wrapper to
> obtain credential in order to complete adding new  product.
> This ofbiz wrapper is being called thru soap and has to be able to login
> and process new product.
> 
> BJ Freeman wrote:
>> I am assuming that you have read code that already does this operations
>> to pick up what you not doing.
>>
>>
>> BJ Freeman sent the following on 9/4/2008 5:05 PM:
>>  
>>> 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());
>>>>>>        }
>>>>>>    }
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>               
>>>>>           
>>>>
>>>>       
>>>
>>>
>>>     
>>
>>   
> 
> 
> 
> 


Re: SOAP - ofbiz wrapper

Posted by Jacek Wagner <ja...@berkeley.edu>.
I  am not sure I follow. All what I want from this ofbiz wrapper to 
obtain credential in order to complete adding new  product.
This ofbiz wrapper is being called thru soap and has to be able to login 
and process new product.

BJ Freeman wrote:
> I am assuming that you have read code that already does this operations
> to pick up what you not doing.
>
>
> BJ Freeman sent the following on 9/4/2008 5:05 PM:
>   
>> 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());
>>>>>        }
>>>>>    }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>     
>>>>>           
>>>>   
>>>>         
>>>
>>>       
>>
>>
>>     
>
>   


Re: SOAP - ofbiz wrapper

Posted by BJ Freeman <bj...@free-man.net>.
I am assuming that you have read code that already does this operations
to pick up what you not doing.


BJ Freeman sent the following on 9/4/2008 5:05 PM:
> 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());
>>>>        }
>>>>    }
>>>>
>>>>
>>>>
>>>>
>>>>     
>>>   
>>
>>
>>
> 
> 
> 
> 


Re: SOAP - ofbiz wrapper

Posted by BJ Freeman <bj...@free-man.net>.
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());
>>>        }
>>>    }
>>>
>>>
>>>
>>>
>>>     
>>
>>   
> 
> 
> 
> 


Re: SOAP - ofbiz wrapper

Posted by Jacek Wagner <ja...@berkeley.edu>.
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());
>>        }
>>    }
>>
>>
>>
>>
>>     
>
>   


Re: SOAP - ofbiz wrapper

Posted by BJ Freeman <bj...@free-man.net>.
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());
>        }
>    }
> 
> 
> 
> 


SOAP - ofbiz wrapper

Posted by Jacek Wagner <ja...@berkeley.edu>.
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());
        }
    }


Re: OFBiz implementing remote access via SOAP

Posted by BJ Freeman <bj...@free-man.net>.
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
> 
> 
> 
> 


Re: OFBiz implementing remote access via SOAP

Posted by Jacek Wagner <ja...@berkeley.edu>.
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


Re: OFBiz implementing remote access via SOAP

Posted by Jacek Wagner <ja...@berkeley.edu>.
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

Re: OFBiz implementing remote access via SOAP

Posted by Florin Popa <fl...@gmail.com>.
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
>>
>>
>>
>>     
>
>
>   


Re: OFBiz implementing remote access via SOAP

Posted by Jacek Wagner <ja...@berkeley.edu>.
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

Re: OFBiz implementing remote access via SOAP

Posted by BJ Freeman <bj...@free-man.net>.
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
> 
> 
> 


Re: OFBiz implementing remote access via SOAP

Posted by Jacek Wagner <ja...@berkeley.edu>.
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

Re: OFBiz implementing remote access via SOAP

Posted by BJ Freeman <bj...@free-man.net>.
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
> 
> 
> 


OFBiz implementing remote access via SOAP

Posted by Jacek Wagner <ja...@berkeley.edu>.
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