cancel
Showing results for 
Search instead for 
Did you mean: 

How to set input parameter for Web Service...

Former Member
0 Kudos

Hi

Scenario is:-

- I have 2 Input Fields (first name & last name) in a view and one button. When i click on button, it will show full name.

- i have a method in my Adaptive Web Service like: String Method1(fname String, lname String)

- Now i don't know how to set the input parameters of my WebService from my view. I need to write the following code in my view's button Action.

-


WS1Model m = new WS1Model();

Request_Method1 re = new Request_Method1(m);

wdContext.nodeRequest_Method1().bind(re);

try {

re.execute();

} catch (CMIException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

???? Setting Input is missing........

wdComponentAPI.getMessageManager().reportSuccess(wdContext.currentMethod1ResponseElement().getResponse());

-


Pls. Let me know how can i solve this issue.

Thanks....

Edited by: Harpal Singh on Sep 10, 2009 11:46 PM

Accepted Solutions (1)

Accepted Solutions (1)

former_member197348
Active Contributor
0 Kudos

Hi Harpal,

You can set the parameters like:

Request_Method1 re = new Request_Method1(m);
// set the parameters in request 
re.setFirstname(fname);
re.setLastname(lname);
wdContext.nodeRequest_Method1().bind(re);
try {
re.execute();
wdContext.nodeResponse().invalidate();
} catch (CMIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

Let me know if you get any issues in implementing it.

Regards,

Siva

Former Member
0 Kudos

Hi Siva

Actually the hierarchy of my View's Context is like as follows:

Context -> Request_Method1 -> Method1 -> Fname & Lname

Could u pls. tell me how will you change your previous mentioned code as per this context structure to set the input parameter fname, lname for the web service?

Thanks Boss....

former_member201361
Active Contributor
0 Kudos

Hi Harpal,

set the model attributes as shown below:

Request_Method1 -> Method1 -> Fname & Lname

Model model = new Model ();

Request_Method1 req = new Request_Method1(model);

Method1 method = new Method1(model);

method.setFname(fname);

method.setLname(lname);

req.setMethod1(method);

wdContext.nodeRequest_Method1().bind(req);

/// execute the model

try {

wdContext.nodeRequest_Method1().currentRequest_Method1Element().modelObject().execute();

wdContext.nodeResponse_Method1().invalidate();

}catch (WDWSModelException wdwsmee){

}

hope it helps,

Thanks and Regards

Former Member
0 Kudos

Thanks Fazal Bhaee, It solved my problem....

Answers (0)