on 07-24-2008 8:15 AM
Hi all
I try to consume a webservice over the adaptive web service model and webdnypro. My scenario is similiar to the tutorial on the sdn about "sending an email over webservices with webdynpro".
My request has the following structure:
[Request_AddNewActivity]
[AddNewActivity]
[ActivityData]
ActivityType - int
Description - string
DoneBy - string
FromDate - date
Subject - string
ToDate - date
ServiceCallId - int
[AddNewActivity_Response]
[AddNewActivityResponse]
The webservice has a void return value, therefor there is no field in the response part. I have created a model binding in the context of the component controller and an associated mapping in the view context. Additionally I generated a form by applying the form template to the view and the ActivityData.
In the wdDoInit method of the component controller I initialize the Request_AddNewActivity and bind it to the context:
scServiceModel = new SCServiceModel();
Request_AddNewActivity request = new Request_AddNewActivity(scServiceModel);
AddNewActivityRequest addNewActivityRequest = new AddNewActivityRequest(scServiceModel);
Activity activitiy = new Activity(scServiceModel);
addNewActivityRequest.setActivity(activitiy);
request.setAddNewActivity(addNewActivityRequest);
wdContext.nodeRequest_AddNewActivity().bind(request);
When I now open the view, I get a NullPointerException:
java.lang.NullPointerException
at com.sap.tc.webdynpro.model.webservice.gci.WSTypedModelClass.getAttributeValueAsInt(WSTypedModelClass.java:162)
at .....netweaver.model.scservice.Activity.getActivityType(Activity.java:47)
at ...netweaver.viewemployeeservicecalls.wdp.IPublicViewEmployeeServiceCalls$IActivityDataElement.wdGetObject(IPublicViewEmployeeServiceCalls.java:5948)
at com.sap.tc.webdynpro.progmodel.context.MappedNodeElement.wdGetObject(MappedNodeElement.java:55)
at com.sap.tc.webdynpro.progmodel.context.AttributePointer.getObject(AttributePointer.java:324)
... 104 more
I can avoid the NullPointerException by removing the Activity = new Activity(...) and the addNewActivityRequest.setActivity(...) lines from the wdDoInit Method. Unfortunately the input fields are then disabled in the browser and no data can be entered. What am I doing wrong?
Thanks for your help,
Thierry
Hi,
Your error shows that there is an error with ActivityType attribute which is "int". what is the value in the backend and is it a import parameter? what you are passing to this attribute or how you are getting this variable?
error is there in .getActivityType(). while getting the integer value.
The error is around this attribute only. check this once again.
PradeeP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just try to display an input field on the view, where the int can be entered. I can see that there is an error with this int, but this is strange.
Hmm... I added two more lines in the wdDoInit method in the component controller where i put the int fields of the model to 0. And now it works. This is a very strange behaviour or better say this is a bug. An int field is a primitive type which should be 0 initialized anyway... Has anyone came accross the same problem?
Thierry
Hi Thierry,
I just ran into this problem too. Restarting the server did not help, so I have used your workaround, initializing each integer value.
Did you by any chance find out if there is a fix for this bug?
Thanks,
René
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I came across a similar problem to the one above. Again it became a NullPointerException when setting an int field in a model. I figured out that the problem in this case was the server or the deployment. I reimported the model before and it looked like the developer studio didn't completly redeploy the new model and therefor the server didn't know the new field. After restarting the server, the application worked as expected.
So can anyone tell me please, where one can report bugs?
Greetings Thierry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Inorder to take Adaptive web service model you should to take Webservice model (deprecated last one) and then it will work.
let me know
Thanks,
Tulasi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi can you tell me what type of Webservice ?
i mean R/3 or java webservice
Thanks,
Tulasi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.