cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in WebServices

0 Kudos

Hi,

I created an ejb webservice. I imported the webservice using adaptive webservice model. I have done model binded to the component controllers context. Now i have mapped it to the view. Now after deployment i found the input field ui element in disabled state. For this i have changed all the possibilities of cardinality for the model node. But still i am facing the same problem.

Kindly help me to solve this out.

Thanks,

Chaitanya.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Chaitanya Godavarthi ,

Try with the Service controller. I hope it will be helpfull to you.

Thanks

Siva

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Chaitanya,

Check out this thread.

https://forums.sdn.sap.com/click.jspa?searchID=-1&messageID=5203211

Regards,

Gopal

nikhil_bose
Active Contributor
0 Kudos

in wdDoInit() of view controller create an instance of the model class and bind to the context.

e.g:


MyModelClass input = new MyModelClass(); 
wdContext.node<Your_Node>().bind(input);

: if input fields are not enabled it is because of there is no run-time instance of corresponding node

nikhiL

0 Kudos

Hi Nikhil,

I tried this too but i could not code it properly. So it did not work. Can you please explain indetail.

Thanks,

Chaitanya.

nikhil_bose
Active Contributor
0 Kudos

For the created Model, we need to instantiate it. ( create an object ). And the object, we add to the node makes there is an active element to get the values from input elements.

Drill down Model you will find the model classes inside. You have to create object for that class ( for Request ). There will be listed all structures used in the model. You can go with Request class.

create object for the request class:

pattern will be like:


RequestModelClass new_obj = new RequestModelClass( new WSModel());

then, add to wdContext


wdContext.node<RequestModelClass>().bind(new_obj);

hope you understood

nikhiL

0 Kudos

Tried it same way but did not get the result.

Thanks ,

Chaitanya

nikhil_bose
Active Contributor
0 Kudos

not getting result means what?

not getting response from web service or not those input elements are enabled ?

do the last step in component controller

and in view controller

wdDoInit()


IPrivate<Your>View.IPrivate<Your_Node_Name>Element element = wdContext.create<Your_Node_Name>Element();
// this is input node
wdContext.node<Your_Node_Name>().addElement(element);

rename accordingly

will enable your input fields

nikhiL

0 Kudos

Hi,

I could not resolve the problem.

thanks,

Chaitanya.

nikhil_bose
Active Contributor
0 Kudos

tell me what you have done so far.

1) created model

2) bind model to component controller ( All nodes and structures)

3) map Request node to view controller

4) instantiated model object and bind to context node

5) created method to execute WS

try{

Element.modelObject().method();

}catch(.....

6) assign parameters to UI Elements

7) create context element to accept values

this works for sure. Please start from scratch

nikhiL

former_member201361
Active Contributor
0 Kudos

hi,

for using the web servies ur Application we have to instantiate the model classes.

for eg :

try{

FindAllEmployees model = new FindAllEmployees();

Request_FindEmployeeById req = new Request_FindEmployeeById(model);

FindEmployeeByIdReqMsg employee = new FindEmployeeByIdReqMsg(model);

req.setFindEmployeeByIdReqMsg(employee);

wdContext.nodeRequest_FindEmployeeById().bind(req);

wdContext.currentRequest_FindEmployeeByIdElement().modelObject().execute();

wdContext.nodeResponse().invalidate();

wdContext.nodeFindEmployeeByIdResMsg().invalidate();

wdContext.nodeEmployeeDetailsById().invalidate();

}catch(Exception e){

wdComponentAPI.getMessageManager().reportException(e);

}

After Instantiating the model class we have to invalidate the response node.

use messagemanager to verify whether the model is getting executed .as wdComponentApI.getMessageMnager().reportSuccess("initializing the model node");

i think this will help u to see where u r making mistake

Hope this will solve ur problem

thanks and regards

Fistae

nikhil_bose
Active Contributor
0 Kudos

try to fill the structure which takes the input for the web service and bind that to the context.

e.g:

+MyModel

|- Add

|- AddResponse

|- Req_Add

|- Resp_Add

Add new_stru = new Add( new MyModel() );

new_stru.setFnum (10);

new_stru.setSnum(20);

wdContext.nodeAdd().bind(new_stru);

nikhiL

Former Member
0 Kudos

Hi,

I think you have directly bound the input class of Model To Input field. You create a new context attribute and in init method instantiate it and add a Empty element "". this will enable the input field.

Then when the user enters, take the value and put it back in model class and execute it

Hope this helps.

-Shabir

0 Kudos

Hi Shabir,

I tried this too but i could not code it properly. So it did not work. Can you please explain indetail.

Thanks,

Chaitanya.

Former Member
0 Kudos

Hi Chaitanya,

Instantiate your web service in init method of Componennt Controller.Then input fields will be enabled.

Thanks n Regards,

Jhansi Miryala

0 Kudos

Hi,

I did not get you.

Can you kindly explain in detail?

Thanks,

Chaitanya.

Former Member
0 Kudos

Chaitanya,

If your context node name is "a" then instantiate the node.ie.,

<a> input = new <a>();

wdContext.node<a>.bind(input);

replace "a" with your node name.

and also refer to the following thread.

Thanks n Regards,

Jhansi Miryala

0 Kudos

Hi,

I have already done it but it did not work.

Thanks,

Chaitanya.