You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Alexander1893 <al...@familie-schweizer.net> on 2010/01/28 21:37:10 UTC

Problems calling "addAdditionalViewForProduct"

Hi all,

I'm trying to use the service "addAdditionalViewForProduct" and I'm havin
some problems.

I have the following form in the front-end:

	<form type="upload" name="singleFileUpload"
target="performSingleFileUpload">
		<field  name="uploadedFile" title="chose file">
			<file/>
		</field>
		<field name="submitButton" title="${uiLabelMap.CommonAdd}"
			widget-style="smallSubmit">
			<submit button-type="button" />
		</field>
	</form>

After submitting I do some other things necessary (calling some services
etc.).

Than I prepare the Input-Map for the service "addAdditionalViewForProduct":

        <set field="addAdditionalViewForProduct.userLogin"
from-field="userLogin.userLogin"/>
        <set field="addAdditionalViewForProduct.productId"
from-field="productRoleAttributes.productId"/>
        
		<set field="addAdditionalViewForProduct.productContentTypeId"
value="DIGITAL_DOWNLOAD"/>
		<set field="addAdditionalViewForProduct.uploadedFile"
from-field="parameters.uploadedFile"/>

And then I call the service:

<call-service service-name="addAdditionalViewForProduct"
in-map-name="addAdditionalViewForProduct"/>    

When I do that, I don't get any errors in the log - but nothing really
happens (the file is not associated with the product...)
I debugged the "ProductServices.java" in Eclipse - and obviously "the
imageData" ist "Null" in after this Line:

        ByteBuffer imageData = (ByteBuffer) context.get("uploadedFile");

Can anyone help?

Thanks a lot!
Alexander
		




-- 
View this message in context: http://n4.nabble.com/Problems-calling-addAdditionalViewForProduct-tp1397293p1397293.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Problems calling "addAdditionalViewForProduct"

Posted by Mridul Pathak <mr...@hotwaxmedia.com>.
Hi Alexander,

    You don't need to add these parameters to your form.  This is the job of
ServiceEventHandler to put the uploaded file related information in the
parameters that are being passed to the service, refer
ServiceEventHandler.java (line 151 - 227).
    You said you are writing custom logic around the OOTB
"addAdditionalViewForProduct"
service.  If that's true it would be easier for you if your custom logic is
written as a service and the service def implements "uploadFileInterface"
service interface.

-- 
Thanks & Regards
Mridul Pathak
Hotwax Media
http://www.hotwaxmedia.com
mridul.pathak@hotwaxmedia.com
-------------------------------------------------
direct: +91 - 942.592.6892

On Thu, Jan 28, 2010 at 2:16 PM, Alexander1893 <
alexander@familie-schweizer.net> wrote:

>
> Hi Midrul,
>
> first of all - it's not "my service" I'm calling.
>
> You said that this is missing:
>
> <set
> field="addAdditionalViewForProduct._uploadedFile_fileName"
> from-field="parameters._uploadedFile_fileName"/>
>
> <set
> field="addAdditionalViewForProduct._uploadedFile_contentType"
> from-field="parameters._uploadedFile_contentType"/>
>
> First: Actualy I'dont understand why I should have this parameters in the
> form, if they are optional in the service-dev... If optional meens, that
> the
> service doesn't work - than the service-def is useless.
> I have only one field in the form - which is a input type "file". Where
> should the "fileName" and "contentType" come from?
>
> Thanks a lot for futher help!
> Alexander
> --
> View this message in context:
> http://n4.nabble.com/Problems-calling-addAdditionalViewForProduct-tp1397293p1400053.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>

Re: Problems calling "addAdditionalViewForProduct"

Posted by Alexander1893 <al...@familie-schweizer.net>.
Hi Midrul,

first of all - it's not "my service" I'm calling.

You said that this is missing:

<set
field="addAdditionalViewForProduct._uploadedFile_fileName"
from-field="parameters._uploadedFile_fileName"/>

<set
field="addAdditionalViewForProduct._uploadedFile_contentType"
from-field="parameters._uploadedFile_contentType"/> 

First: Actualy I'dont understand why I should have this parameters in the
form, if they are optional in the service-dev... If optional meens, that the
service doesn't work - than the service-def is useless.
I have only one field in the form - which is a input type "file". Where
should the "fileName" and "contentType" come from?

Thanks a lot for futher help!
Alexander
-- 
View this message in context: http://n4.nabble.com/Problems-calling-addAdditionalViewForProduct-tp1397293p1400053.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Problems calling "addAdditionalViewForProduct"

Posted by Mridul Pathak <mr...@hotwaxmedia.com>.
The first thing that you need to make sure is that your servicedef
implements uploadFileInterface, add following line to your servicedef:

<implements service="uploadFileInterface"/>


The next thing you will need to do is to pass in the following input
parameters (comes from uploadFileInterface) to addAdditionalViewForProduct
service:

<set
field="addAdditionalViewForProduct.uploadedFile"
from-field="parameters.uploadedFile"/>
(you already have this one)

<set
field="addAdditionalViewForProduct._uploadedFile_fileName"
from-field="parameters._uploadedFile_fileName"/>

<set
field="addAdditionalViewForProduct._uploadedFile_contentType"
from-field="parameters._uploadedFile_contentType"/>


Once this is done your service should work.


-- 
Thanks & Regards
Mridul Pathak
Hotwax Media
http://www.hotwaxmedia.com
mridul.pathak@hotwaxmedia.com
-------------------------------------------------
direct: +91 - 942.592.6892

On Thu, Jan 28, 2010 at 1:37 PM, Alexander1893 <
alexander@familie-schweizer.net> wrote:

>
> Hi all,
>
> I'm trying to use the service "addAdditionalViewForProduct" and I'm havin
> some problems.
>
> I have the following form in the front-end:
>
>        <form type="upload" name="singleFileUpload"
> target="performSingleFileUpload">
>                <field  name="uploadedFile" title="chose file">
>                        <file/>
>                </field>
>                <field name="submitButton" title="${uiLabelMap.CommonAdd}"
>                        widget-style="smallSubmit">
>                        <submit button-type="button" />
>                </field>
>        </form>
>
> After submitting I do some other things necessary (calling some services
> etc.).
>
> Than I prepare the Input-Map for the service "addAdditionalViewForProduct":
>
>        <set field="addAdditionalViewForProduct.userLogin"
> from-field="userLogin.userLogin"/>
>        <set field="addAdditionalViewForProduct.productId"
> from-field="productRoleAttributes.productId"/>
>
>                <set
> field="addAdditionalViewForProduct.productContentTypeId"
> value="DIGITAL_DOWNLOAD"/>
>                <set field="addAdditionalViewForProduct.uploadedFile"
> from-field="parameters.uploadedFile"/>
>
> And then I call the service:
>
> <call-service service-name="addAdditionalViewForProduct"
> in-map-name="addAdditionalViewForProduct"/>
>
> When I do that, I don't get any errors in the log - but nothing really
> happens (the file is not associated with the product...)
> I debugged the "ProductServices.java" in Eclipse - and obviously "the
> imageData" ist "Null" in after this Line:
>
>        ByteBuffer imageData = (ByteBuffer) context.get("uploadedFile");
>
> Can anyone help?
>
> Thanks a lot!
> Alexander
>
>
>
>
>
> --
> View this message in context:
> http://n4.nabble.com/Problems-calling-addAdditionalViewForProduct-tp1397293p1397293.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>