cancel
Showing results for 
Search instead for 
Did you mean: 

Why are webservice results not displayed in Web Dynpro application?

Former Member
0 Kudos

Hello Gurus,

I've got a method of a webservice named GetVersionInformation that returns a String.

In order to use it in my Web Dynpro application I created a new model through "Import Adaptive Web Service Model".

In the context of my test View I added a new Model Node. Through "Edit Model Binding" on that Model Node I selected GetVersionInformationResponse on my model. On the next screen I selected the response for the binding.

The problem I have is that the value that my webservice returns doesn't end up in the TextEdit fo my test View, but there aren't any exceptions displayed either.

What could be wrong? Can it be that my application can't access the webservice?

Thank you for your time and kind regards,

Florian

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

after you invoke the model, u need to call the invalidate() method to refresh the data.

Message was edited by:

Armin Reichert

Answers (5)

Answers (5)

Former Member
0 Kudos

Hello Manoj,

I've written the following code :

try {

wdContext

.currentRequest_GetVersionInformationElement()

.modelObject()

.execute();

} catch (CMIException cx) {

}

to the wdDoInit() of my custom controller.

Any ideas?

Regards,

Florian

Former Member
0 Kudos

hi,

Where are the other lines of code which Gita has provided to you. The code which you have written is fine if your request node does not take any parameter. If Request node takes some parameter then you have to set those parameters first and then you bind it to the request node.

Try this:

1. create the model object:

TestModel modelObj = new TestModel();

2. create the Request object:

Request_GetVersionInformation reqObj = new Request_GetVersionInformation(modelObj);

If there are any child nodes of your req node, then create the object of your child nodes as well in the same way as in step 2. Then use:

reqObj.set<child node name>

3.Bind the req object:

wdContext.nodeRequest_GetVersionInformation().bind(reqObj);

4. Execute

wdContext

.currentRequest_GetVersionInformationElement()

.modelObject()

.execute();

Anyhow your code is there in the cust. controller. then you have to map the same nodes to your view also and bind the same node to the textEdit.

Check these things first and then tell me. Please send me the entire model node structure.

Manoj

Former Member
0 Kudos

Hi Florian,

Write the code what gita has provided u. Apart from that u can do this.

create a method same like this:

public void traceWSInvocation( com.sap.tc.webdynpro.model.webservice.gci.WSTypedModelClassExecutable requestModel, java.lang.Exception ex )

{

//@@begin traceWSInvocation()

logger.traceThrowableT(

Severity.ERROR,

wdComponentAPI.getApplication().getDeployableObjectPart().getName(),

ex);

//if (logger.beDebug()) {

logger.fatalT(requestModel.wdGetRequestLog());

logger.fatalT(requestModel.wdGetResponseLog());

logger.fatalT(requestModel.associatedModelClassInfo().getModelInfo().toString());

logger.fatalT(requestModel.toString());

//@@end

}

then for ur request model in ur execute method u have to do something like this

reqModel.wdSetInvocationLogEnabled(true);

here reqModel is ur request model

then in ur catch block, call the traceWSInvocation() method like this

wdThis.traceWSInvocation(reqModel,e);

then u can get the complete trace in ur server log file . it will give u complete trace for ur webservice execution.

in case u r not able to understand the trace, just post that in this thread. we can try to find the problem

P.S. don't leave the catch block empty, otherwise u can't find the problem ,if there is any.

regards

Sumit

Former Member
0 Kudos

Hi Florian,

If ur problem is solved, close the thread.

regards

Sumit

Former Member
0 Kudos

Hello Sumit,

I've done what you said.

I'm trying to consume an abap web service from a SAP ABAP stack 6.4 so without WSIL.

And I get this erre:


Exception on execution of web service with WSDL URL 'http://mycompany.com:1080/sap/bc/soap/wsdl11?services=Z_WS' with operation 'Z_WS' in interface '{urn:sap-com:document:sap:rfc:functions}Z_WSPortType'

I've added the traceWSInvocation function but nothing is logged as logger.beDebug() is never true.

You can I set logger.beDebug() to true to be ablte to troubleshoot from logs what's going on?

Thanks for your insight,

Tanguy Mezzano

Former Member
0 Kudos

Hello Manoj and everybody else,

I've done now as you told me.

My textEdit's value property is set to Request_GetVersionInformation.Response.GetVersionInformationResponse.Response but it still doesn't display anything. Is this correct?

Any other ideas?

Kind regards, Florian

Former Member
0 Kudos

hi,

Is the server on which the web-service is deployed is running. You can try and test your web-service on the WS-navigator. If it does not give the output there, then there is a problem with the web-service.

Otherwise i don't find any problem, if you have written the proper code as told.

Where you have written the code to execute the request node?

Regards,

Manoj

Former Member
0 Kudos

Hello Sumit and Manoj,

Thank you for your fast responses.

This is what I've done:

Edit model binding -> Context -> new -> Model node (name: Test). Then I drag 'Test' To the right onto Request_GetversionInformation -> Response (Response_GetVersionInformation) -> UserRoleModel -> Response_GetVersionInformation -> GetVersionInformationResponse (GetVersionInformationResponse) -> GetVersionInformationResponse. On the next screen, I ticked 'Test'. But now there is an arrow from 'Test' to UserRoleModel -> GetVersionInformationResponse.

It still doesn't work.

Also, I think the program can't access the webservice. Where can I set the password that is used for accessing the webservice?

Best regards,

Florian

Former Member
0 Kudos

The following code needs to be added inside the wdinit() method of your controller.

<Model Name> model_var = new <Model Name>();

<Name of the model node (The Request class)> req_modelnode = new <Name of the model node>(model_var);

<Name of the Sub-node for Input> min = new <Name of the Sub-node for Input>(model_var);

req_modelnode .set<Name of the Sub-node for Input>(min);

wdContext.node<Name of the model node(The Request class)>().bind(req_modelnode );

please tell me if it works.

All the Best!!

Former Member
0 Kudos

Hi,

Apart from the code which Gita has sent you, Add the following to it:

wdContext.current<model node name>Element().modelObject().execute();

And map your textEdit's value property to the required model attribute.

thanks & regards,

Manoj

Former Member
0 Kudos

Hi Florian,

Code is already provided by gita & manoj. For ur webservice password problem, u have to give in visual admin. Go to server->services->Web Services Security->web service clients -> sap.com-> DynamicWSProxies. (Hope u have created the logical destinations for ur webservice) .select the proxy for ur service. on the right side u have to give the url for ur webservice,what u can get from wsnavigator on ur server.

In the Logon data, u have to select the authentication as basic (for standalone app) or logon ticket (for portal access). If u select the logon data, u can specify the user/pwd.

regards

Sumit

Former Member
0 Kudos

Hi,

Only one problem i could see in your explanation is that you have selected response model node for binding. It should be request node that you have to select.

thanks & regards,

Manoj

Former Member
0 Kudos

Hello Anant, Gurus,

I've now added an invalidate() to the view.

//@@begin javadoc:onPlugIN2(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onPlugIN2(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onPlugIN2(ServerEvent)

this.wdContext.nodeWSInfo().invalidate();

//@@end

}

It still doesn't work.

There isn't any exception either.

Now I suspect that the webservice can't be accessed because the password/username aren't set. Where can I do that?

Best regards,

Florian

Former Member
0 Kudos

Hi Florian,

U need to invalidate just after execute method on in event handler what u r doing currently.

Apart from that can u send the code u have written ?? are u passing all the mandatory input parameters (if there is any) to the webservice??

have u written ur code inside try catch block??if yes in catch block are u printing the stack trace?

U r taking GetVersionInformationResponse node, if u want to execute the webservice, u need to take request node.

regards

Sumit

Message was edited by:

Sumit Malhotra

Message was edited by:

Sumit Malhotra