cancel
Showing results for 
Search instead for 
Did you mean: 

Binding the value to the context of the webservice Model

Former Member
0 Kudos

Hi All,

I am facing the problem of setting the values of the context of the webservices model.

I have one webservice model , I have mapped it to custom controller and then to the view.

I am setting the value of the model node from the context of the same view.

But when i trying to set the value, its giving me the null pointer exception.

I have not set the value of the node to null anywhere in my code.

So if anybody knows the solution , please help me.

Thanks and Regards,

Shruti

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Adi,

I have the problem with initialization only.

as my context node structure is as follows..

ContextNode

-RequestNode

- createNode

- value attributes.

So if i create the instance for the Request node..

I cant acces the value attributes of the last node using the created instance...

And i cant create the instance of the createNode....

So how to access the attributes for the create node....

RequestNode n1 = new RequestNode();

But

I cant use n1 to access the context attribute.....

Former Member
0 Kudos

Hi Shruti,,

Are you using AdpativeWebServiceModel ??

DO the following in the init() method.

1. <<ModelClassName>> model=new <<ModelClassName()>>

2. Create instance of "createNode" (inner node)

Set the attributes on this

ex : InnerNode x=new InnerNode(model);

x.setXXX();

3. Request_createNode node=new Request_createNode(model)

node.setXXX(x);

4. wdCOntext.nodeRequestNode().bind(node);

Regards, ANilkumar

Former Member
0 Kudos

Hi Anil,

Thanks for the fast rsponse.....

I tried creating the object of the inner node..

But its giving me the error that the object of the inner node cannot be instantiated..

So i cant access the context variables....

So please help me with that...

Thanks and Regards,

Shruti.

Former Member
0 Kudos

Hi Shruti,

I don't completely understand what are you trying to do.

Is the inner node the response node?

if so, why are you trying to create an instance of it?

Is it after or before the execution of the web service?

please check that the cardinality of your request model node is 1..1.

Did you use the tutorial for web services?

Here is the link:

https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/46bae990-0201-0010-bc98-d2fecedfaf32

If it doesn't help please provide a more detailed information (code and context).

Adi

Former Member
0 Kudos

Hi Anil,

I have already initialize it in my init method .

but still it is giving me the null pointer exception..

my node structure is like this.

Context

-Request_Model_node

-oneNode

-context_aatribute

I have initialized the parent node in my init method.

I am not getting any error at comiple time ,but still am not able to set the value.

Former Member
0 Kudos

Hi Shruti,

Please post the initialization code.

There many not be any errors in designtime but there could be some problems the way you initialize.

Regards, Anilkumar

Former Member
0 Kudos

Hi Shruti,

Please check if this is the way you init the input node:

In the wdDoInit of the <b>component controller</b>:

// create a new instance of the Web Service ModelClass

Request_SendEmailPortType_sendEmail req =

new Request_SendEmailPortType_sendEmail();

// bind new instance of the Web Service ModelClass to the

// independent Model Node &#8242;WebServiceEmail&#8242;

wdContext.nodeWebServiceEmail().bind(req);

In the View controller in the action for executing the Web Service:

// Call the Web Service and update dependent model node &#8242;Response&#8242;

wdContext.currentWebServiceEmailElement().modelObject().execute();

wdContext.nodeResponse().invalidate();

Adi.

Former Member
0 Kudos

Hi Shruthi,

Please post your code once.

Makesure in the Init methods you are initilizing the inputModelclasses correctly.

Regards,Anilkumar