Skip to Content
0
Former Member
Nov 11, 2010 at 06:21 AM

Consume Webservice from PI Box

30 Views

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.