cancel
Showing results for 
Search instead for 
Did you mean: 

Need help on Integration Directory API

Former Member
0 Kudos

Hi All,

I am trying to create ID objects by Using NWDS by using the code as mentioned in below link ( Integration Directory API).

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a0336199-d3c7-2c10-c983-f8a945a45...

But while executing the program in NWDS i am getting the below error.

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -6

  at java.lang.String.substring(String.java:1937)

  at java.lang.String.substring(String.java:1904)

I have tracked the error. Exactly i am getting the error in below code:

// get port

BusinessSystemIn systemComp = service.getBusinessSystemInPort(); ( Note: NWDS is not allowinggetBusinessSystemInPort() instead of this i am using getBusinessSystemIn_Port())

// setup context and authorization

this.setupContext((javax.xml.ws.BindingProvider) systemComp,

DirectoryApiConfiguration.getUserid(), DirectoryApiConfiguration.getPassword());

String addressTailWithHostAndPort = endpointAddress.substring(endPointPrefix.length());

All these three steps are interlinked.

Could you please check it once and let me know your suggestions where i am doing mistake or where i have to change?

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hi,

The respective coding in the SDN article assumes that the WSDL contains an endpoint address for the wrong PI host and port and tries to exchange it with your host. However, the error indicates that the WSDL does not contain an endpoint address at all, most probably the respective fragment looks like this:

...

<wsdl:port xmlns:bprf="http://sap.com/xi/BASIS" binding="bprf:BusinessComponentInBinding" name="BusinessComponentInPort">

<soap:address location="/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>

</wsdl:port>

...

There are different solutions for this. If you do not want to re-generate your consumer proxy then you should set a hard-coded endpoint address instead.

So in the setupContext(BindingProvider bp, String user, String password) method, simply skip the String manipulation coding and set the address with

context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);

You can determine the endpoint adress in NWA -> Configuration -> Connectivity -> SingleServiceAdministration -> Service Definitions. Select the port type name of the Directory API service, in this example BusinessComponentIn (and NOT BusinessComponentVI, this is the PI 7.0 compatible Directory API service). Then select the "WSDLs" tab. Here you see a link like

http://<your_host>:<http_port>/BusinessComponentInService/BusinessComponentInImplBean?wsdl&mode=ws_policy

Remove the URL parameters and you have the endpoint address:

http://<your_host>:<http_port>/BusinessComponentInService/BusinessComponentInImplBean


If you don't mind re-generating the consumer proxy, then you can just download the WSDL zip file in this NWA page (button "ZIP Download"), extract the archive and create the proxy using the contained "main.wsdl" file.

It will always contain the correct WSDL port so that you do not have to modify the address in the request context at all.


One final recommendation: if you are using the Directory API for large update requests you can get issues with socket timeout. In this case it is advisable to increase the client timeout for your consumer proxy. You can do this by adding the following lines in the setupContext method:


....

import com.sap.engine.services.webservices.espbase.client.api.HTTPControlFactory;

import com.sap.engine.services.webservices.espbase.client.api.HTTPControlInterface;

.....


private final void setupContext(BindingProvider bindingProvider, String user, String password) {

....

    HTTPControlInterface httpInterface = HTTPControlFactory.getInterface(bindingProvider);

   httpInterface.setSocketTimeout(60000);

}

Timeout is specified in milliseconds, so in the example above we have 10 minutes.

Regards,

Frank

iaki_vila
Active Contributor
0 Kudos

Hi Srikanth,

What is your PI version?, are you sure that you are using the right NWDS?

Have you tried to set log to know what are the variables content in each code step?

Regards.

Former Member
0 Kudos

Hi Vila,

I am using PI 7.4 Dual Stack and NWDS 7.3.

I have tried to set the log to know variables content in each code step. In the changelist creation i am checking what are the values passing to variables by using Test variable.

public final ChangeListCreateOut createChangeList(String changeListName,

  String changeListDescription,

  String changeListDescriptionLanguageCode)

  {

  ChangeListInService service;

  try

  {

  service = new ChangeListInService();

  ChangeListIn comp = service.getChangeListIn_Port();

  System.out.println("Test::: "+comp);

  BindingProvider bindingProvider = (BindingProvider)comp;

  System.out.println("Test::: "+bindingProvider.toString());

------------------ }

0 Kudos

Hello, Did you find the solution?

Thanks.

Former Member
0 Kudos

i didn't find the solution. I have tried but no luck.

nitindeshpande
Active Contributor
0 Kudos

Hi Srikanth,

What is your SP of PI 7.4 system? And for PI 7.4 you need to use NWDS 7.31.

If your PI system is PI 7.4 SP 8, then you need to use NWDS 7.31 SP 13 (plus 5 compared to your SP of PI system). Please try with this, you can connect to the ID and created the objects successfully.

Regards,
Nitin

Former Member
0 Kudos

ok.. thanks nitin... i will check once and let you know.

peter_wallner2
Active Contributor
0 Kudos

Hello Srikanth,

Did you find a solution for this? Was it the NWDS version?

Thank you,

Peter