cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

java.lang.NullPointerException after binding web service model

0 Likes
554

Hello, I was trying to make a web dynpro that use a web to display data, but after I do the binding in the DoInit of the model controller I got a error when I run the dynpro.

this is the error:

java.lang.NullPointerException

at com.sap.tc.webdynpro.model.webservice.base.model.BaseGenericModelClass.retrieveTargetRoleInfo(BaseGenericModelClass.java:91)

at com.sap.tc.webdynpro.model.webservice.base.model.BaseGenericModelClass.getRelatedModelObject(BaseGenericModelClass.java:388)

at com.sap.tc.webdynpro.model.webservice.gci.WSTypedModelClass.getRelatedModelObject(WSTypedModelClass.java:65)

at com.muck.demos.wsdemo3.model.BAPI_FLIGHT_GETLIST_Request.getDESTINATION_FROM(BAPI_FLIGHT_GETLIST_Request.java:60)

at com.muck.demos.wsdemo3.wdp.IPublicWSDemo3$IDESTINATION_FROMNode.doSupplyElements(IPublicWSDemo3.java:880)

This is the component controller context [http://img194.imageshack.us/img194/2293/componentcontroller.png]

the search view context [http://img193.imageshack.us/img193/5646/searchview.png]

and the results view context [http://img299.imageshack.us/img299/4567/resultsview.png]

finaly this is the code:


  public void wdDoInit()
  {
  
    FlightData model = new FlightData(); 
    Request_BAPI_FLIGHT_GETLIST list = new Request_BAPI_FLIGHT_GETLIST(model);
    BAPI_FLIGHT_GETLIST_Request request = new BAPI_FLIGHT_GETLIST_Request(model);
    list.setBAPI_FLIGHT_GETLIST(request);
    wdContext.nodeRequest_BAPI_FLIGHT_GETLIST().bind(list);
  
 } 

I hope that someone can help me, thank you.

View Entire Topic
Former Member
0 Likes

HI,

I assume that this code is in Component controller or view controller. In case you want the elements to populate data from view then these two lines should suffice. I dont understand why you need to model instance and bind it.

Request_BAPI_FLIGHT_GETLIST list = new Request_BAPI_FLIGHT_GETLIST();

wdContext.nodeRequest_BAPI_FLIGHT_GETLIST().bind(list);

Regards

Srini

0 Likes

That doesn't work either, if I put those lines in wdDoInit of the component controller the dynpro shows up, but the input field for the search is disabled, anyway I clicked the search button and this is the response I got 😕

com.sap.tc.webdynpro.model.webservice.base.exception.BaseModelRuntimeException: No object for mandatory target role 'FLIGHT_LIST' of model class 'BAPI_FLIGHT_GETLIST_Response' with cardinality 'ONE' maintained

at com.sap.tc.webdynpro.model.webservice.base.model.BaseGenericModelClass.getRelatedModelObject(BaseGenericModelClass.java:392)

at com.sap.tc.webdynpro.model.webservice.gci.WSTypedModelClass.getRelatedModelObject(WSTypedModelClass.java:65)

at com.muck.demos.wsdemo3.model.BAPI_FLIGHT_GETLIST_Response.getFLIGHT_LIST(BAPI_FLIGHT_GETLIST_Response.java:88)

at com.muck.demos.wsdemo3.wdp.IPublicWSDemo3$IFLIGHT_LISTNode.doSupplyElements(IPublicWSDemo3.java:1668)

at com.sap.tc.webdynpro.progmodel.context.DataNode.supplyElements(DataNode.java:100)