cancel
Showing results for 
Search instead for 
Did you mean: 

Call Web service from Webdynpro

Former Member
0 Kudos

Hi,

I have created a Webservice via EJB - I have tested it via Web Services Navigator.

This is a simple Webservice only with one method ->

testmethod -> input as strin and output as string

Now i'd like to use this webservice in my Web Dynpro App. Therefor I imported the Webservice as model: I get this structure:

MyModel

- Model Classes

- input

- inputResponse

- Request_input

- input

- Response

- Response_Checkuser

- inputResponse

No I use Applay Template in the CustomControllers - therefore I choose Request_input and there I choose all childnodes.

After that following code is the result:

wdoinit---

MyModel model = new MyModel();

wdContext.nodeRequest_Inout().bind(new Request_Input(model));

execute---

wdContext.currentRequest_InputElement().modelObject().execute();

wdContext.nodeResponse().invalidate();

wdContext.nodeInputResponse().invalidate();

->>>> but method execute is undefined for the type Request_input

I don't know, where is the mistake - can anyone help me.

Thanks Stefan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Stefan,

In controller wdoinit() you have to write the following code:

<b>wdoinit</b>---

//Bind the Webservice model to the corresponding context node.

MyModel model = new MyModel();

wdContext.nodeMyModel().bind(input);

<b>execute</b>

wdContext.currentMyModelElement().modelObject().execute();

now invalidate the node in which you are getting the result.

Regards,

Jhansi

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

thanks, but I think it cann't solve the problem because my Model Classes have already an error after generating by NWDS. I think the error is not in the Custom controler.

Stefan

Former Member
0 Kudos

Hi,

folowing errors in the model:

---

MyModel extends com.sap.tc.webdynpro.model.webservice.gci.WSTypedModel

-> com.sap.tc.webdynpro.model cannot be resolved or it is not a valid superclass

Request_Input extends com.sap.tc.webdynpro.model.webservice.gci.WSTypedModelClassExecutable

-> com.sap.tc.webdynpro.model cannot be resolved or it is not a valid superclass

Can anyone help me?

Former Member
0 Kudos

Hai,

Try this

//wdoinit---

Request_MyModel_inputMethod req=new Request_MyModel_Input();

wdContext.nodeRequestMyModel().bind(req);

//execute

wdContext.currentMyModelElement().setInput(inputStr);

wdContext.currentMyModelElement().modelObject().execute();

wdContext.nodeResponseMyModel.invalidate();

Regards,

Former Member
0 Kudos

Are there any generation errors in your modelClasses ??

Goto Request_Input model class and check.This class should extends com.sap.tc.webdynpro.model.webservice.gci.WSTypedModelClassExecutable which has execute() method.

Regards,Anilkumar