cancel
Showing results for 
Search instead for 
Did you mean: 

Passing parameters to Web service

former_member192766
Participant
0 Kudos

Hi,

How to pass a parameter to a Web Service?

I am working with hierarchical data, user choose a category from the first DropDown and when clicking the second DropDownList,

only data that belongs to that category should be retrieved. Example: "select subcategory from tablex where category = 'value first Dropdownlist'".

Thanks,

Ridouan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

There are many threads already discussed regarding dependent dropdowns go through some of the links below and regarding setting values to webservice, Which type of webservice you are using. If that webservice has input parameters then you can just set input context attributes

[]

[]

[]

[]

[]

Regards

Raghu

former_member192766
Participant
0 Kudos

Hi,

Thanks for your response, unfortunately I was not able to find a solution for my scenario.

I have two Context Nodes, one for the Core Category and one for the Sub Category.

The Web Service for the Sub Category expect an input parameter, the attribute arg0 is the input field in the Web Service.

I am using this code:

//@@begin onActionDoSomeThing(ServerEvent)

IReturnNode someNode = wdContext.nodeReturn(); // The node where the attribute SubCategory can be found

IReturnElement someEl = someNode.currentReturnElement(); // Attribute SubCategory contains a value from the first Web Service (like 001 (it's a string and not a number))

String subCategory = someEl.getSubCategory();

CoreModel model = new CoreModel();

Request_GetSubCategory request = new Request_GetSubCategory(model);

wdContext.nodeRequest_GetSubCategory().bind(request);

wdContext.nodeGetSubCategory().currentGetSubCategoryElement().setArg0("%" + subCategory);

try {

wdContext.currentRequest_GetSubCategoryElement().modelObject().execute();

wdContext.nodeResponseSub().invalidate();

} catch (Exception e) {

wdComponentAPI.getMessageManager().reportException(

e.getLocalizedMessage());

}

//@@end

I am getting a java.lang.NullPointerException

Please help!

Thanks,

Ridouan

Former Member
0 Kudos

Hi,

You need to instantiate an object of GetSubCategory as you did for Request_GetSubCategory , set the value for that object and add that object to the parent object (ie the Request_GetSubCategory object).

Regards,

Murtuza

former_member192766
Participant
0 Kudos

Hi,

Thanks for your help. I still receive the java.lang.NullPointerException.

I didn't mention that I using NWDS for SAP NetWeaver CE 7.1 SP6.

I have the following code in the wdDoInit of the Component Controller:

// Initialize CoreCategories Node

Request_GetCoreCategory categories = new Request_GetCoreCategory(model);

wdContext.nodeRequest_GetCoreCategory().bind(categories);

// Second Node

Request_GetSubCategory subcategories = new Request_GetSubCategory(model);

wdContext.nodeRequest_GetSubCategory().bind(subcategories);

// This is a sub node of Request_GetSubCategory

GetSubCategory subcat = new GetSubCategory(model);

subcat.setPCoreCategory(wdContext.currentReturnElement().getSubCategory() + "%");

Thanks again.

Ridouan

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Look out for the following links. They might help you :

http://help.sap.com/erp2005_ehp_03/helpdata/EN/9b/dad1ae3908ee44a5caf57e10918be9/frameset.htm

These are some of the useful links for Web Service.

I hope this helps you.

Thanx.