cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot execute modelObject in Webdynpro for java

0 Kudos

Hi Experts,

I Have created a model type (Adaptive webserivce Model) which is the WSDL file of the PI interface. The model import was successful and I can find the classes inside the model object.

I have mapped the same From MODEL to COMP CONTROLLER and from COMP CONTROLLER to VIEW. The problem is when am trying to execute the model, am not getting the method execute(). Also the initialization of the model class throws error saying "The constructor is undefined". Can anyone help me in this? How can I resolve this issue?

Thanks,

Mahendran B.

Accepted Solutions (1)

Accepted Solutions (1)

p330068
Active Contributor
0 Kudos

Dear Mahendran,

Can you please paste the code for model execution here:

You need to first create the object for model name (for (Adaptive webserivce Model) ) created.

<Model Name> XYZ = new <Model Name>();

Then create object of web service node with model object.


Request_<Webservice Context node> ABC = new Request_<Webservice Context node>(XYZ );
---  --- ---
---  --- ---
---  --- ---
wdContext.nodeRequest_<Webservice Context node>().bind(ABC);		
wdContext.nodeRequest_<Webservice Context node>.currentnodeRequest_<Webservice Context node>Element().modelObject().execute();	

Hope it will helps

Best Regards

Arun Jaiswal

0 Kudos

Hi Arun,

Thanks for your reply, and I am able to solve the undifiened constructor issue. But I noticed a strange thing, that the class inside the model (request_<Webservice Name>) contains many error in its implementation part. The first line of the program itself with error

I just double clicked the class with webservice name in the model folder and navigated to implementation part. I saw error in the line mentioned below.

public final class Request_<Webservice name> extends com.sap.tc.webdynpro.model.webservice.gci.WSTypedModelClassExecutable -

The error thrown is "com.sap.tc.webdynpro.model cannot be resolved or is not a valid superclass". There are many errors because of this.

Due to this I cant execute the model object still.

Thanks,

Mahe

p330068
Active Contributor
0 Kudos

Dear Mahendran

The error should not come the model class. You need to rectify befor proceeding for model execution.

Please try to rebuild the project and do the sync dc and sync used dc. Also close the project and opend it again.

Hope it will helps

Best Regards

Arun Jaiswal

0 Kudos

Hi Arun,

I did all the process you have mentioned but still the result is same. When I try to import the package com.sap.tc.webdynpro.model, it seems like the JAR is unavailable. But when I check in the Plugin folder of NWDS 7.0 eclipse, the jar is there. I dont know how to proceed further. Do I need to add the JAR in external Library?

Thanks,

Mahendran B.

p330068
Active Contributor
0 Kudos

Hi Mahendran,

You can check it and add if it JAR is missing. Also check the JRE_LIB and JRE_SRC already there or not.

Best Regards

Arun Jaiswal

0 Kudos

Hi Arun,

All the exceptions has been rectified after adding the JAR to the external Library. My model structure is like the one below

- request_<Webservice Name>

- MT_<Messagetype>

- <setclass>

- Attribute1 (For which I need to set value and execute the model).

How can I set the value for the Attribute 1 and which model I need to execute it.

Thanks,

Mahendran B.

p330068
Active Contributor
0 Kudos

Hi Mahendran,

You can create the object of Immediate parent node with model object and set the attribute and then add them to Immediate parent context node.

You can verify the web service model object node (Open the compoent controller >> Context > Right Side your custom webservice model will appears >> check the respective node which you want to execute i.e request node, you need to create the object till Immediate parent node of the attribute)

Like you you have create XYZMODEL using "create model"


XYZMODEL XYZ = new XYZMODEL();
Request_<Webservice Name>  reqObject = new Request_<Webservice Name>(XYZ);

MT_<Messagetype>  mtObject = new MT_<Messagetype>(XYZ);
mtObject.set<Attribute>("VAULE");

reqObject.setMT_<Messagetype>(mtObject);

wdContext.nodeRequest_<Webservice Name>().bind(requestObject);
wdContext.nodeRequest_<Webservice Name>().currentRequest_<Webservice Name>Element().modelObject().execute();

Hope it will helps

Best Regards

Arun Jaiswal

0 Kudos

Hi Arun,

The coding helped me a lot and I am able to solve from the coding perspective. But when I try to execute the model object, the connection is not reaching the PI server. I see an error in Portal logs & Traces. I have created the JCo connections just how we create for communicating to the RFC in the backend. But Do we need to create with any special settings for consuming the webservice? Kindly help me in this.

Thanks,

Mahendran B.

p330068
Active Contributor
0 Kudos

Dear Mahendran

Thanks. If you are using logical destination then you need to create in the visual administration.

If you are dynamically using webservice URL with KM using properties file for dev or qa or prod. then no need to create.

Please check the /wsnavigator and test the webservice and have a look

Best Regards

Arun Jaiswal

0 Kudos

Hi Arun,

I hope it is wise to create logical destination, rather than maintaining the switching of servers in coding. Since I need to move the development to other environments.

While creating the Logical destination in Visual admin do we need to provide the server URL or WSDL url?

Is there any step by step procedure available to do this?

Do we need to create any JCo connection to achive this?

If yes, How can we relate the JCo with the Webservice call or destination URL?

Thanks,

Mahendran B.

0 Kudos

Hi,

I am closing this thread since the model execution has been solved. And for the connectivity issue I am going to open a new thread

Thanks,

Mahendran B.

Answers (0)