Skip to Content
avatar image
Former Member

How to call PI directory API?

Hello,

I have a question regarding how to call PI directory API in Java. It's basically a question of consuming web service in NWDS CE. I've searched in SDN, found many posts, however they all seem for old version, not the one (CE) I want to use.

What I did to call directory API in NWDS CE:

1) Create a java project

2) import wsdl of the web service (Tried with communicationchannel service) using url, (not downloaded wsdl)

3) generate web service client based on the imported wsdl

4) write java class to call the generated ws client.

my question is how to code the step 4 --> call the generated ws client. For my example of communiction channel change service, I coded:

CommunicationChannelServiceVi ccService = new HTTPBasicAuthBindingStub();

CommunicationChannelCreateChangeIn changeReq = new CommunicationChannelCreateChangeIn();

CommunicationChannelRestricted changeRestricted = new CommunicationChannelRestricted();

changeRestricted.setCommunicationChannelID(new CommunicationChannelID("", "BC_File","CC_Test_SOAP_Sender"));

CommunicationChannelRestricted channels[] = new CommunicationChannelRestricted[1];

channels[0] = changeRestricted;

changeReq.setCommunicationChannel(channels);

ccService.change(changeReq);

I know I didn't provide all mandatory fileds, I would expect application error like mandatory field missing. However, instead, I got error;

AxisFault

faultCode: Server.NoEndpoint

faultSubcode:

faultString: No endpoint

faultActor:

faultNode:

faultDetail:

exceptionName:org.apache.axis.NoEndPointException

stackTrace:No endpoint

at CommunicationChannelServiceWsd.HTTPBasicAuthBindingStub.change(HTTPBasicAuthBindingStub.java:526)

at com.forces.pi.transport.AdaptPIObjects.execute(AdaptPIObjects.java:35)

at com.forces.pi.transport.AdaptPIObjects.main(AdaptPIObjects.java:22)

hostname:OTG-IMG-W258300

No endpoint

at CommunicationChannelServiceWsd.HTTPBasicAuthBindingStub.change(HTTPBasicAuthBindingStub.java:526)

at com.forces.pi.transport.AdaptPIObjects.execute(AdaptPIObjects.java:35)

at com.forces.pi.transport.AdaptPIObjects.main(AdaptPIObjects.java:22)

My question is:

1) How can I set user name / password in the web service call

2) Endpoint is already contained in the wsdl, why no endpoint error?

Thanks

Jayson

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jan 14, 2009 at 03:10 PM

    According to SAP help:

    CurrencyExchangePortType pt = service.getCurrencyExchangePort()

    javax.xml.ws.BindingProvider bp = (javax.xml.ws.BindingProvider)pt;

    Map<String,Object> context = bp.getRequestContext();

    context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://new.endpoint.example");

    context.put(BindingProvider.USERNAME_PROPERTY,"userName");

    context.put(BindingProvider.PASSWORD_PROPERTY,"pass");

    However in my example there is not portType class generated. Why?

    Add comment
    10|10000 characters needed characters exceeded