Skip to Content
avatar image
Former Member

Consume the webservice in PI Box

Dear Experts,

I have created a Java Class that calls a webservice deployed in PI 7.1. Below is the java code

private String sendingDataToPISystem(String userName, String password, String endPointReference, String nameSpace, String serviceName, String localPart, Object inputData)

{

String returnValue = null;

try

{

QName serviceQName = new QName(nameSpace, serviceName);

QName portQName = new QName(nameSpace, localPart);

Service service = Service.create(new URL(endPointReference), serviceQName);

Map map = ((BindingProvider)service.getPort(portQName, serviceQName.getClass())).getRequestContext();

map.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPointReference);

map.put(BindingProvider.USERNAME_PROPERTY, userName);

map.put(BindingProvider.PASSWORD_PROPERTY, password);

service.addPort(portQName, HTTPBinding.HTTP_BINDING, new URI(endPointReference).toString());

Dispatch<Object> dispatch = service.createDispatch(portQName, Object.class, Service.Mode.PAYLOAD);

dispatch.invoke(inputData);

returnValue = "SUCCESS";

}catch(Exception exception)

{

returnValue = "FAILURE";

exception.printStackTrace();

}finally

{

return returnValue;

}

}

This code is not throwing any error but at the same time unable to make a call to webservice in PI box

Note: I am using NWDS CE 7.1 SP 10PAT0001

Please Advice what should be done, inorder to make my Java class work.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Nov 11, 2010 at 07:20 AM

    Hi,

    Did you check whether the webservice has been published in the registry. TRy to access the web service from other tools like XMLSpy

    Regards,

    Tiny

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Exception is because of this line

      Map map = ((BindingProvider)service.getPort(portQName, serviceQName.getClass())).getRequestContext();

      Please let me know what should be done now