Code Comments
Programming Forum and web based access to our favorite programming groups.Hello All, Here is the link for the document which will be helpful for the beginners to get ready for working in Ofbiz. http://docs.ofbiz.org/display/OFBIZ...ice+Application Thanks to everybody involved directly or indirectly in the creation of this document. We will try to improve this document as soon as time permits. Improvement suggestions are more then welcome and looking for the positive contribution from community members to make it much better document. -- Thanks & Regards -- Pranay Pandey Indore, India
Post Follow-up to this messageHello Pranay,
great work :)
Perfect for beginners like myself.
As I'm trying to write my first service, implemented with java, maybe
you could add a few words about that in your tutorial.
Maybe someone could answer a question about that:
how do I call services which need authentication (e.g.
createPartyEmailAddress from framework/party/services)?
What I'm doing:
my service requires already authentication, which works, creating
persons is no problem at all (createPerson has auth="false", which i
don't get why today, but i'm sure that's because of my limited knowledge
of ofbiz)
calling createPartyEmailAddress throws:
[ ServiceDispatcher.java:522:ERROR] Error in Service
[partyContactMechPermissionCheck]: You must be logged in to complete the
[Party contact mech permission logic] process.
a snipped of my code is below.
Thanks again for this tutorial and thanks for any answers,
Roland
--- code ---
[...]
Map createPartyEmailAddressMap = UtilMisc.toMap(
"emailAddress", context.get("emailAddress"),
"contactMechPurposeTypeId", "PRIMARY_EMAIL",
"login.username", context.get("login.username"),
"login.password", context.get("login.password"));
[...]
// create Person
Map createPersonResult = dispatcher.runSync("createPerson",
createPersonMap);
if (ServiceUtil.isError(createPersonResult)) {
return createPersonResult;
}
// create EmailAddress
createPartyEmailAddressMap.put("partyId",
createPersonResult.get("partyId"));
Map createPartyEmailAddressResult =
dispatcher.runSync("createPartyEmailAddress", createPartyEmailAddressMap);
if (ServiceUtil.isError(createPartyEmailAddressResult)) {
return createPartyEmailAddressResult;
}
Post Follow-up to this messagecreatePerson has auth set to false so that new users can create
themselves. It's an exception to the standard practice.
-Adrian
RolandH wrote:
> Hello Pranay,
>
> great work :)
> Perfect for beginners like myself.
>
> As I'm trying to write my first service, implemented with java, maybe
> you could add a few words about that in your tutorial.
>
> Maybe someone could answer a question about that:
> how do I call services which need authentication (e.g.
> createPartyEmailAddress from framework/party/services)?
> What I'm doing:
> my service requires already authentication, which works, creating
> persons is no problem at all (createPerson has auth="false", which i
> don't get why today, but i'm sure that's because of my limited knowledge
> of ofbiz)
> calling createPartyEmailAddress throws:
> [ ServiceDispatcher.java:522:ERROR] Error in Service
> [partyContactMechPermissionCheck]: You must be logged in to complete the
> [Party contact mech permission logic] process.
> a snipped of my code is below.
>
> Thanks again for this tutorial and thanks for any answers,
>
> Roland
>
> --- code ---
> [...]
> Map createPartyEmailAddressMap = UtilMisc.toMap(
> "emailAddress", context.get("emailAddress"),
> "contactMechPurposeTypeId", "PRIMARY_EMAIL",
> "login.username", context.get("login.username"),
> "login.password", context.get("login.password"));
> [...]
>
> // create Person
> Map createPersonResult = dispatcher.runSync("createPerson",
> createPersonMap);
> if (ServiceUtil.isError(createPersonResult)) {
> return createPersonResult;
> }
>
> // create EmailAddress
> createPartyEmailAddressMap.put("partyId",
> createPersonResult.get("partyId"));
> Map createPartyEmailAddressResult =
> dispatcher.runSync("createPartyEmailAddress", createPartyEmailAddressMap);
> if (ServiceUtil.isError(createPartyEmailAddressResult)) {
> return createPartyEmailAddressResult;
> }
>
>
Post Follow-up to this messagethanks for the effort Pranay Pandey sent the following on 6/5/2008 8:22 AM: > Hello All, > > Here is the link for the document which will be helpful for the beginners to > get ready for working in Ofbiz. > http://docs.ofbiz.org/display/OFBIZ...ice+Application > > Thanks to everybody involved directly or indirectly in the creation of thi s > document. > We will try to improve this document as soon as time permits. > Improvement suggestions are more then welcome and looking for the positive > contribution from community members to make it much better document. >
Post Follow-up to this messagePranay , Thanks for putting this document on the Ofbiz Confluence . -- Ashish On Thu, Jun 5, 2008 at 2:41 PM, BJ Freeman <bjfree@free-man.net> wrote: > thanks for the effort > > Pranay Pandey sent the following on 6/5/2008 8:22 AM: > to > http://docs.ofbiz.org/display/OFBIZ...ice+Application > this > positive > >
Post Follow-up to this messageHello Ronald,
I hope this will be of help.
The service you are calling is createPartyEmailAddress requires
authentication so you need to send the userLogin value to it.
Something like this:
// perform actions as the system user
GenericValue userLogin =
delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId",
"system"));
input = UtilMisc.toMap("userLogin", userLogin, "emailAddress",
email, "partyId", "_NA_", "fromDate", fromDate, "contactMechPurposeTypeId",
"OTHER_EMAIL");
Map serviceResults =
dispatcher.runSync("createPartyEmailAddress", input);
if (ServiceUtil.isError(serviceResults)) {
throw new
GenericServiceException(ServiceUtil.getErrorMessage(serviceResults));
}
Thanks & Regrads
--
Pranay Pandey
On Thu, Jun 5, 2008 at 9:38 PM, RolandH <roland-ml@redvision.de> wrote:
> Hello Pranay,
>
> great work :)
> Perfect for beginners like myself.
>
> As I'm trying to write my first service, implemented with java, maybe you
> could add a few words about that in your tutorial.
>
> Maybe someone could answer a question about that:
> how do I call services which need authentication (e.g.
> createPartyEmailAddress from framework/party/services)?
> What I'm doing:
> my service requires already authentication, which works, creating persons
> is no problem at all (createPerson has auth="false", which i don't get why
> today, but i'm sure that's because of my limited knowledge of ofbiz)
> calling createPartyEmailAddress throws:
> [ ServiceDispatcher.java:522:ERROR] Error in Service
> [partyContactMechPermissionCheck]: You must be logged in to complete the
> [Party contact mech permission logic] process.
> a snipped of my code is below.
>
> Thanks again for this tutorial and thanks for any answers,
>
> Roland
>
> --- code ---
> [...]
> Map createPartyEmailAddressMap = UtilMisc.toMap(
> "emailAddress", context.get("emailAddress"),
> "contactMechPurposeTypeId", "PRIMARY_EMAIL",
> "login.username", context.get("login.username"),
> "login.password", context.get("login.password"));
> [...]
>
> // create Person
> Map createPersonResult = dispatcher.runSync("createPerson",
> createPersonMap);
> if (ServiceUtil.isError(createPersonResult)) {
> return createPersonResult;
> }
>
> // create EmailAddress
> createPartyEmailAddressMap.put("partyId",
> createPersonResult.get("partyId"));
> Map createPartyEmailAddressResult =
> dispatcher.runSync("createPartyEmailAddress", createPartyEmailAddressMap);
> if (ServiceUtil.isError(createPartyEmailAddressResult)) {
> return createPartyEmailAddressResult;
> }
>
>
Post Follow-up to this messageThanks for this clarification, Adrian --Roland Adrian Crum wrote: > createPerson has auth set to false so that new users can create > themselves. It's an exception to the standard practice. > > -Adrian
Post Follow-up to this messageHi Pranay,
thanks for your answer, after this mail i found my real solution:
Map createPartyEmailAddressMap =
UtilMisc.toMap(
"emailAddress", context.get("emailAddress"),
"contactMechPurposeTypeId", "PRIMARY_EMAIL",
"userLogin", context.get("userLogin")
);
userLogin holds the actual user, if I read existing code correctly.
Thanks for your help,
Roland
Pranay Pandey wrote:
> I hope this will be of help.
> The service you are calling is createPartyEmailAddress requires
> authentication so you need to send the userLogin value to it.
> Something like this:
>
> // perform actions as the system user
> GenericValue userLogin =
> delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId",
> "system"));
>
> input = UtilMisc.toMap("userLogin", userLogin, "emailAddress",
> email, "partyId", "_NA_", "fromDate", fromDate, "contactMechPurposeTypeId"
,
> "OTHER_EMAIL");
> Map serviceResults =
> dispatcher.runSync("createPartyEmailAddress", input);
> if (ServiceUtil.isError(serviceResults)) {
> throw new
> GenericServiceException(ServiceUtil.getErrorMessage(serviceResults));
> }
>
Post Follow-up to this messagethnx by effort but i have a problem i follow the steps in
"Creating the web app on the back end" but when i try charge aplication i
cant see nothing only especial characters :
somebody have same result?
regards
Edson
2008/6/6 RolandH <roland-ml@redvision.de>:
> Hi Pranay,
>
> thanks for your answer, after this mail i found my real solution:
>
> Map createPartyEmailAddressMap =
> UtilMisc.toMap(
> "emailAddress", context.get("emailAddress"),
> "contactMechPurposeTypeId", "PRIMARY_EMAIL",
> "userLogin", context.get("userLogin")
> );
> userLogin holds the actual user, if I read existing code correctly.
>
> Thanks for your help,
> Roland
>
>
> Pranay Pandey wrote:
>
>
Post Follow-up to this messageHi Edson,
Your question is not clear. Please be verbose when you are asking questions.
BTW there is one zip file of source is also attached with this you can take
a reference from that.
Thanks & Regards
--
Pranay Pandey
On Wed, Jun 11, 2008 at 3:38 AM, Edson Chavez <edsonchavez@gmail.com> wrote:
> thnx by effort but i have a problem i follow the steps in
>
> "Creating the web app on the back end" but when i try charge aplication i
> cant see nothing only especial characters :
>
> somebody have same result?
>
> regards
>
> Edson
>
> 2008/6/6 RolandH <roland-ml@redvision.de>:
>
> UtilMisc.toMap("userLoginId",
> "emailAddress",
>
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.