cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a webservice with a complex data type within the code

Former Member
0 Kudos

Hi,

I am writing a WebDynpro application for a web service created from the SAP-System. I am calling the service in the code. This is working fine with normal parameters, but my service has complex parameters and I get the following error message:

Fehler java.rmi.RemoteException: Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.XmlMarshalException: XML Serialization Error. Property [ORDER_HEADER_IN] of class [gg.proxies.types.BAPI_SALESORDER_CREATEFROMDAT1] must exist and can not be null. This is required by schema description.

Could there anything be wrong with my code or is there something else I have to do?

Thank you

Julia

My code:

ComplexType_BAPI_SALESORDER_CREATEFROMDAT1 param = new ComplexType_BAPI_SALESORDER_CREATEFROMDAT1();

ComplexType_BAPISDHEAD bapishead = new ComplexType_BAPISDHEAD();

bapishead.setBILL_BLOCK("");

bapishead.setCD_CU_ISO1("");

...

param.setORDER_HEADER_IN(bapishead);

msgMgr.reportSuccess("orderHeadersin"+param.getORDER_HEADER_IN());

BAPIITEMIN bapiin[] = new BAPIITEMIN[1];

bapiin[0] = new BAPIITEMIN();

bapiin[0].setALTERN_BOM("");

bapiin[0].setASSORT_MOD("");

...

param.setORDER_ITEMS_IN(bapiin);

BAPIPARTNR bapipartner[] = new BAPIPARTNR[1];

bapipartner[0] = new BAPIPARTNR();

bapipartner[0].setADDR_LINK("");

bapipartner[0].setADDR_ORIG("");

...

param.setORDER_PARTNERS(bapipartner);

wdContext.currentRequest_Z_SalesorderCreateFromDat1_BAPI_SALESORDER_CREATEFROMDAT1Element().modelObject().setParameters(param);

wdContext.createORDER_HEADER_INElement(bapishead);

wdContext.currentRequest_Z_SalesorderCreateFromDat1_BAPI_SALESORDER_CREATEFROMDAT1Element().modelObject().execute();

wdContext.nodeRequest_Z_SalesorderCreateFromDat1_BAPI_SALESORDER_CREATEFROMDAT1().invalidate();

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

thank you for the answer, but this does not solve my problem. I still get the same mistake.

To initialize the request my code is:

Request_Z_SalesorderCreateFromDat1_BAPI_SALESORDER_CREATEFROMDAT1 req2 = new Request_Z_SalesorderCreateFromDat1_BAPI_SALESORDER_CREATEFROMDAT1();

wdContext.nodeRequest_Z_SalesorderCreateFromDat1_BAPI_SALESORDER_CREATEFROMDAT1().bind(req2);

Can this be wrong?

Thank you!

Julia

Former Member
0 Kudos

Hello Julia,

Try replacing

wdContext.createORDER_HEADER_INElement(bapishead);

with

param.setORDER_HEADER_IN(bapishead);

Also try removing the following lines of code.

wdContext.currentRequest_Z_SalesorderCreateFromDat1_BAPI_SALESORDER_CREATEFROMDAT1Element()
.modelObject().setParameters(param);
wdContext.nodeRequest_Z_SalesorderCreateFromDat1_BAPI_SALESORDER_CREATEFROMDAT1()
.invalidate();

This should solve your problem.

Please reward approproiate points.

Bala