cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI Web Service problem...

david_fryda2
Participant
0 Kudos

Hi everyone,

I do not success executing a simple BAPI like BAPI_COMPANYCODE_GETLIST.

In my Controller : I connect the controller to the model and "drag and drop" the Request_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLIST context.

In the wdDoInit() method, I wrote :

Request_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLIST req =

new Request_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLIST();

wdContext.nodeRequest_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLIST().bind(req);

No need to initialize a parameter because the BAPI doesn't required.

I created a method for the execution:

public void executeWS( )

{

//@@begin executeWS()

try {

wdContext.currentRequest_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLISTElement().modelObject().execute();

wdContext.nodeResponse().invalidate();

} catch(Exception e) {

}

//@@end

}

I the logical port located in the model, I did not change anything. But something is strange. The target address is, lets say, : http://<server>:<port>/sap/bc/soap/rfc.

If I copy and past this URL to my internet browser, I get: "The page cannot be displayed".

Can someone help me ?

Thank you in advance.

Accepted Solutions (1)

Accepted Solutions (1)

former_member188556
Active Contributor
0 Kudos

Hi David...

from the querry, its not clear that you have established a connection to <b><u>view</u></b> part from the controller part.

did u get any sort of output or is it just an error page... can u be bit more specific on ur problem.

david_fryda2
Participant
0 Kudos

Hi Bobu,

I made several BAPI connection and everything worked.

What I am trying to do now is to retrieve results from a web service that I downloaded from the web server of the SAP/R3. I got an xml file.

In my WebDynPro, I created a StartView which call the Controller. In my Controller, I created a method that executes the WebService.

In my ResultView, I created a Table UI that displays the Response.

I do not get any answer. No error page.

When I wrote that I get an error page is when I try to get to the URL specified in my first post.

Of course the StartView and the ResultView are connected to the Controller.

I created a context in ResultView that is mapped to the Controller. This context is bound to my Table UI.

I hope I gave more precisions about the problem.

If you need other information, please let me know.

Thanks in advance.

Former Member
0 Kudos

Hi david

Well i presume u got a WSDL file. What model are you importing. Import a WebService model and then give the URL of this wsdl. By the way does this wsdl require a username and password as you are using a third party webservice right.

Refer to this link. It will be useful.

http://help.sap.com/saphelp_nw04/helpdata/en/f4/abe4107f46334bb8640a090e5806fc/frameset.htm

see if that helps.

regards

ravi

david_fryda2
Participant
0 Kudos

Hi Ravi,

I got the wsdl file from the service navigator of SAP/R3.

I downloaded the file and of course imported it to my WebDynPro application.

The web service points to BAPI_COMPANYCODE_GETLIST.

I think maybe I have to authenticate my self. Maybe I should pass my username and password...but where ?

I will look at the URL you gave me.

Thanks.

Former Member
0 Kudos

Hi David,

As you said, when you are giving URL, got from logical port of the model, in browser. You get page can not be displayed, right?

Means, there is problem in link to your WSDL file location.

And for setting username and password, don following.

before executing your model set your username and password.

wdContext.currentRequest_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLISTElement()._setUsername("<user name>");

wdContext.currentRequest_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLISTElement()._setPassword("<password>");

if you want to check that url then type following:

http://<server>:<port>/sap/bc/soap/rfc?wsdl

Let me know the status,

Regards,

Bhavik

wdco

Message was edited by: Bhavik Devisha

david_fryda2
Participant
0 Kudos

Hi Bhavik,

I will check it next week because I am not at work.

I will update you.

Thanks a lot...and I do not forget the points...

Bye

david_fryda2
Participant
0 Kudos

Hi Bhavik,

I do not have the option to set a username or a password with the wdContext.currentRequest_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLISTElement.

Do you know why ?

Thanks

Former Member
0 Kudos

Hi David,

It was my mistake.

Little bit change in that two line of code.

Use following one:

wdContext.currentRequest_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLISTElement().modelobject()._setUsername("");

wdContext.currentRequest_BAPI_COMPANYCODE_GETLISTPortType_BAPI_COMPANYCODE_GETLISTElement().modelobject()._setPassword("");

Check out and let me know,

Regards,

Bhavik

david_fryda2
Participant
0 Kudos

Hi Bhavik,

It is much better now.

I created a simple BAPI that gets a string and return a string.

I did success calling the web service with the webdynpro using the way you told me about the credentials.

So now I know that I have connectivity between webdynpro and web service.

Thanks...

Now I just have to understand how to pass and get tables/structures to the Web Service.

Thanks Bhavik..

If I still have problem to pass tables....I let you know.

Answers (0)