on 05-19-2005 4:53 PM
Hello,
In the controller's context I have some model
nodes and attributes (this structure is mapped
into another structure in the data layer).
I want to set the values of these model attributes
from Java code. I am seting the value the
following way:
int docId = 5;
wdThis.wdGetDocumentController().wdGetContext().nodeRequest_DocumentsSoap_updateDoc1().nodeChanges().nodeUpdateDoc1Dinfo().currentUpdateDoc1DinfoElement().setDocId(docId);
This compiles and runs without any errors, but
when I check if the value has been set, it appears
that it is null. I am checking the current value
of the model attribute this way:
wdThis.wdGetDocumentController().wdGetContext().nodeRequest_DocumentsSoap_updateDoc1().nodeChanges().nodeUpdateDoc1Dinfo().currentUpdateDoc1DinfoElement().getDocId();
So it seems that even though the model nodes/attributes
appear in the mapping editor, at runtime they do not
exist. Why?
Thanks a lot in advance for any help.
Greetings,
Tomek.
hi
please check if you have any wdcontxt.node<nodename>.invalidate() before you check the content of the attribute you have set.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sometimes (in earlier versions of WD) after re-generation of model mapping between model attributes / context attributes becomes inconsistent.
Check <b>referencedProperty</b> for corresponding attribute in context node -- it should populated, otherwise edit model binding of context.
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well,
Then 2 things make me wonder:
1. In your original question you say that you are assigning <b>int <i>5</i></b>, but get <b>null <i>reference</i></b>??? Do your model class attribute getter and setter compatible to each other???
2. What type of model are you using? Once I had used JavaBean model and make silly error: I simply forgot to save value passed in setter in instance field. Probably you have same kind of error in your model class?
VS
Hi Valery,
the model I use is a web service's data model
(created with "Create Model" >> "Import Web
Sevices Model").
The reason I wrote I am getting a null reference
is that when I run the application, and come to
a point when the web service is called, I get
the following error:
"Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.XmlMarshalException: XML Serialization Error. Property [Dinfo] of class [pl.prokom.infos.document.metrykaplustresc.proxies.types.Doc] must exist and can not be null. This is required by schema description."
I set the value in the context this way:
wdThis.wdGetDocumentController().wdGetContext().nodeRequest_DocumentsSoap_updateDoc1().nodeChanges().nodeUpdateDoc1Dinfo().currentUpdateDoc1DinfoElement().setDocId(docId);
(where docId is of type int), and read the value (to see
if it has been actually set) this way:
displayMessage(">> docId is " + wdThis.wdGetDocumentController().wdGetContext().nodeRequest_DocumentsSoap_updateDoc1().nodeChanges().nodeUpdateDoc1Dinfo().currentUpdateDoc1DinfoElement().getDocId());
When I display the above message, the docId value reported
is 0, but then there is that error message which
indicates it is null.
Greetings,
Tomek.
Hello,
I have noticed one more thing... The structure in the
controller's context I have to fill in is quite complex.
The root model node contains both other model nodes
as well as model attributes. The problem I described
in my previous posts regards only those model attri-
butes which are nested deeply in the hierarchy (i.e.
that are not direct children of the root model node).
For example, if the context structure is:
Context
ModelNode1
ModelNode11
modelAttribute111
modelAttribute112
modelAttributeA
modelAttributeB
I can set the values of modelAttributeA and
modelAttributeB (direct children of the
ModelNode1 root node). But if I try to set
the value of modelAttribute111, it doesn't
get set.
Thanks for any help.
Greetings,
Tomek.
Hello,
I have noticed one more thing... The structure in the
controller's context I have to fill in is quite complex.
The root model node contains both other model nodes
as well as model attributes. The problem I described
in my previous posts regards only those model attri-
butes which are nested deeply in the hierarchy (i.e.
that are not direct children of the root model node).
For example, if the context structure is:
->Context
-->>ModelNode1
-
>>ModelNode11
-
>>modelAttribute111
-
>>modelAttribute112
-
>>modelAttributeA
-
>>modelAttributeB
I can set the values of modelAttributeA and
modelAttributeB (direct children of the
ModelNode1 root node). But if I try to set
the value of modelAttribute111, it doesn't
get set.
Thanks for any help.
Greetings,
Tomek.
I am not sure but this might help you I did it this way (I got the idea from one of the tutorials)
My context structure is
ValueNode - ValueNode - ValueAttributes
eg
StockOverview
PlantStorageLocationDetails <-- These are nodes
StorageName <-- These are attributes
StorageAddress
In my code I have the following
IPublicCntlr_StockOverview.IStockOverviewElement soElement = wdContext.createStockOverviewElement();
//The creation of a new inner node element instance requires
// the existance of a parent node element already bound to the
// parent node. So call method addElement() before.
wdContext.nodeStockOverview().addElement(soElement);
Collection col = storageOverview.values();
for(Iterator soValues = col.iterator(); soValues != null && soValues.hasNext();){
StockOverviewBO soBOF = (StockOverviewBO)soValues.next();
IPublicCntlr_StockOverview.IPlantStorageLocationDetailsElement pslElement = wdContext.createPlantStorageLocationDetailsElement();
pslElement.setStorageName(soBOF.getStorageName());
pslElement.setStorageAddress(soBOF.getStorageAddress());
wdContext.nodePlantStorageLocationDetails().addElement(pslElement);
}
Hope this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Devlin,
I have tried to create the node "manually"
as you suggested, but it did not help.
I think the problem is elsewhere...
The attributes in the context I have problem
with are mapped into web service's model.
In the same project I also call other web
services, and with them this problem does
not appear.
Greetings,
Tomek.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.