cancel
Showing results for 
Search instead for 
Did you mean: 

Setting RFC import structure

Former Member
0 Kudos

Hello Everyone.

What would be the proper way to set an import value for a WSDL RFC call using a model node (not attribute) that has a 0...1 cardinality? I have tried every method to no avail.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Trent,

You can try this.

Request_<> objRequest = new Request_<>();

//Bind it here to the context if neeed

<node class> objNode = new <node class>();

objNode.set<...>(...);

objRequest.set<node>(objNode);

try {

objReqest.execute();

} catch (Exception e) ....

Hope this helps.

Nirav

Former Member
0 Kudos

I am specifically trying to call the HRWPC_GET_NAV_SUBTREE RFC. The ComplexType_HRROOTOB model object has two attributes of "oBJID" and "oTYPE".

Here is a snippet of my code:

public void wdDoInit(){

...

Request_HRWPC_GET_NAV_SUBTREEPortType_HRWPC_GET_NAV_SUBTREE subtree_request = new Request_HRWPC_GET_NAV_SUBTREEPortType_HRWPC_GET_NAV_SUBTREE();

ComplexType_HRWPC_GET_NAV_SUBTREE subtree_parameters = new ComplexType_HRWPC_GET_NAV_SUBTREE();

ComplexType_HRWPC_S_KEYOBJEC subtree_objects = new

ComplexType_HRWPC_S_KEYOBJEC();

ComplexType_HRWPC_S_KEYSTRUC subtree_struct = new

ComplexType_HRWPC_S_KEYSTRUC();

ComplexType_HRROOTOB subtree_root = new ComplexType_HRROOTOB();

subtree_parameters.addRESULT_OBJEC(subtree_objects);

subtree_parameters.addRESULT_STRUC(subtree_struct);

subtree_request.setROOT(subtree_root);

subtree_request.setParameters(subtree_parameters);

wdContext.nodeRequest_HRWPC_GET_NAV_SUBTREE().bind(subtree_request);

wdThis.executeGetNavSubtree();

...

}

public void executeGetNavSubtree( )

{

...

String objid = "50000113";

String otype = "O";

if(wdContext.nodeRESULT_OBJEC().currentRESULT_OBJECElement() != null){

objid = wdContext.nodeRESULT_OBJEC().currentRESULT_OBJECElement().getOBJID();

otype = wdContext.nodeRESULT_OBJEC().currentRESULT_OBJECElement().getOTYPE();

}

//******************************

Here is the part where (I assume) the import parameters for the ROOT property need to be set (ComplexType_HRROOTOB), Do you know how specifically do I do this? It is a model node with cardinality 0...1

I have tried something along the lines of this to no avail. It look as if for some reason, the setting of the values to the model node do not work correctly.

ComplexType_HRROOTOB new_root = new ComplexTypeHRROOTOB();

new_root.setOBJID(objid);

new_root.setOTYPE(otype);

OR

wdContext.nodeROOT().currentROOTElement().setOBJID(objid);

wdContext.nodeROOT().currentROOTElement().setOTYPE(otype);

//******************************

wdContext.nodeSUBTREE_parameters().currentSUBTREE_parametersElement().

setNAVTYPE(navType);

//$$begin Service Controller(-901424175)

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try{

wdContext.currentRequest_HRWPC_GET_NAV_SUBTREEElement().modelObject().execute();

wdContext.nodeSUBTREE_Response().invalidate();

wdContext.nodeSUBTREE_Result().invalidate();

wdContext.nodeSUBTREE_RESPONSE_rESULT_STRUC().invalidate();

wdContext.nodeSUBTREE_RESPONSE_rESULT_OBJEC().invalidate();

} catch(Exception ce) {

manager.reportException(ce.getMessage(), false);

}

//@@end

}

Message was edited by: Trent Taylor

Former Member
0 Kudos

Hi Trent,

What you have done here is correct for adding a structure (i.e. 0..1 cardinality node):

ComplexType_HRROOTOB new_root = new ComplexTypeHRROOTOB();

new_root.setOBJID(objid);

new_root.setOTYPE(otype);

subtree_request.setROOT(new_root);

Former Member
0 Kudos

Thats the thing.

It doesnt work. I still get this error:

"Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.XmlMarshalException: XML Serialization Error. Property [ROOT] of class [com.epiuse.us.recruitment.navsubtreemodel.proxies.types.HRWPC_GET_NAV_SUBTREE] must exist and can not be null. This is required by schema description"

Former Member
0 Kudos

Hi Trent,

You have created objects for all node and also bound properly. But, i guess you have not initialized vlues for all required input parameters.

In schema of webservices, these parameteres should be defined as mandatory, so you need to specify some values to all such input parameters.

you can set values using following code:

wdcontext.current<node name>element().set<sttribute>(<value>);

Regards,

Bhavik

Answers (1)

Answers (1)

Former Member
0 Kudos

Has anyone ever used a web services model to call and RFC that used an 0..1 cardinality import structure as one of the parameters?

--

Trent