AnsweredAssumed Answered

issues in setting parameters of NikuDataBus object for any read Request

Question asked by vivek_g on Oct 19, 2011
Latest reply on Nov 25, 2011 by ddeneer
I am trying to consume "Resources" web service to call "readResource" method .

I am able to login successfully using the service but for calling read resource we need to pass two parameters of type Auth and NikuDataBus. Plz help on how to set these parameters.

code being used by me -

Auth auth = new Auth();

NikuDataBus ndb = new NikuDataBus();

File file = new File("C:\\Users\\vivek_gupta27\\Warm_up\\try_resource\\src\\mypack\\read.xml");

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
InputStream is;

is = new FileInputStream(file);

Document doc = dbf.newDocumentBuilder().parse(is);

Object any_obj = doc;


NikuDataBus result = port.readResource(ndb, auth);

read.xml file being used is -

<?xml version="1.0" encoding="UTF-8" ?>
<NikuDataBus xmlns:xsi="" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">

<Header version="6.0.13" action="read" objectType="resource" externalSource="NIKU">
<args name="include_contact" value="true" />
<args name="include_management" value="true" />
<args name="include_custom" value="true" />
<args name="include_financial" value="true" />
<Filter name="primaryRoleID" criteria="EQUALS">Developer</Filter>
<Filter name="isActive" criteria="EQUALS">true</Filter>
<Filter name="resourceType" criteria="OR">Labor</Filter>
<Filter name="resourceID" criteria="OR">wayneHill</Filter>

error message -

Oct 18, 2011 11:18:30 AM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Interceptor for {}ResourcesService#{}ReadResource has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Marshalling Error: A DOM document "class" is found but an element is needed. Use Document.getDocumentElement() and set that object instead.
at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(
at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(
at org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
at org.apache.cxf.endpoint.ClientImpl.invoke(
at org.apache.cxf.endpoint.ClientImpl.invoke(
at org.apache.cxf.endpoint.ClientImpl.invoke(
at org.apache.cxf.frontend.ClientProxy.invokeSync(
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(
at $Proxy32.readResource(Unknown Source)
at mypack.Resource_Check.main(
Caused by: javax.xml.bind.MarshalException

Please check where have i went wrong in setting up parameters of Auth or NikuDataBus before making the call. If possible , provide with the sample code on client of web service.