cancel
Showing results for 
Search instead for 
Did you mean: 

WebService exception...

david_fryda2
Participant
0 Kudos

Hi,

I am trying to call a web service.

I am getting the following exception :

<b>Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.XmlMarshalException: XML Serialization Error. Property [DATE_RANGE] of class [com.model.proxies.types.BAPI_FLIGHT_GETLIST] must exist and can not be null. This is required by schema description.

</b>

How do we initialize and where ?

I am misunderstanding the different classes like the Complex.... and Request....

Thanks a lot for the help.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

For my knowledge CompelxTypes are not supported in webservices. I am not sure but you can try with changing the response type to simple and verify

Regards, Anilkumar

david_fryda2
Participant
0 Kudos

I aggree with you Anilkumar.

So what can we do ?

Does it mean that we cannot call a BAPI web service with WebDynPro ?

Former Member
0 Kudos

Hi David,

If your complex type is structure or a table which in turn contains many fields of simple type.You can do the following.

make one Java Class in which you can define all fields we are returned from the BAPI and generate setter and getter methods of it.This java class must implement serializable interface.

Now, from method of the webservice which needs to return complex type like table, return object of this java class.

Before reutrning assign output values to this object and return back.If requires then use array of this object, which solves returning of the table.

I hope you are finding for this thing only.

Let me know.

Bhavik

david_fryda2
Participant
0 Kudos

Hi Bhavik,

I am still trying to call the same BAPI.

Here is the relevant code in the controller :

<b>

public void wdDoInit()

{

//@@begin wdDoInit()

Request_BAPI_USER_GETLISTPortType_BAPI_USER_GETLIST input = new Request_BAPI_USER_GETLISTPortType_BAPI_USER_GETLIST();

wdContext.nodeRequest_BAPI_USER_GETLISTPortType_BAPI_USER_GETLIST().bind(input);

//@@end

}

public void executeRFC( )

{

//@@begin executeRFC()

wdContext.currentRequest_BAPI_USER_GETLISTPortType_BAPI_USER_GETLISTElement().modelObject()._setUser("015462229");

wdContext.currentRequest_BAPI_USER_GETLISTPortType_BAPI_USER_GETLISTElement().modelObject()._setPassword("789789");

BAPI_USER_GETLIST importParams = new BAPI_USER_GETLIST();

ArrayList list = new ArrayList();

BAPIUSNAME structure = new BAPIUSNAME();

structure.setUSERNAME(new String());

structure.setFIRSTNAME(new String());

structure.setLASTNAME(new String());

structure.setFULLNAME(new String());

list.add(structure);

BAPIUSNAME[] rows = new BAPIUSNAME[list.size()];

list.toArray(rows);

importParams.setUSERLIST(rows);

importParams.setWITH_USERNAME("X");

try {

wdContext.currentRequest_BAPI_USER_GETLISTPortType_BAPI_USER_GETLISTElement()

.modelObject().execute();

}catch(Exception e) {

wdContext.currentContextElement().setException(e.getMessage());

}

wdContext.nodeResponse().invalidate();

//@@end

}

</b>

I succeed calling this web service with a Portal Component like a DynPage.

In order to make the web service more simple, I removed all the tables that I am not interested in.

Whan I run my webdynpro application, I get an exception caught in the executeRFC method :

<b>

Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.XmlUnmarshalException: XML Deserialization Error. XML is not valid. Node <ROWS> child of <ns1:BAPI_USER_GETLIST.Response> not described in Schema

</b>

Do you understand what I have to do ?

Thanks a lot.

Former Member
0 Kudos

Hi David,

Did you modified your webservice after importing into webdynpro?

If yes, then you have to delete the associated model and create the same once again.It is due to inconsistancy between structure what you have in model and structure described in XML which you get as result from R/3.

So, create the same model once again.

Regards,

Bhavik

david_fryda2
Participant
0 Kudos

Hi Bhavik,

I did changes before importing into webdynpro.

The Model is OK.

What do you think about the code...am I on the right way...or not ?

Thanks.

Former Member
0 Kudos

Hi david,

Your code seems ok.

But i think problem in the structure of the response node of your model.

so, better thing is to delete the model and create it once again.

Regards,

Bhavik

Former Member
0 Kudos

Do you have the Property "DATE_RANGE" in the Model ??

regards, Anilkumar

david_fryda2
Participant
0 Kudos

Yes I have it in the Model...

The DATE_RANGE is in the ComplexType_BAPI_FLIGHT_GETLIST class and in the ComplexType_BAPI_FLIGHT_GETLISTResponse class.

I have only selected the Request_BAPI_FLIGHT_GETLISTPortType_BAPI_FLIGHT_GETLIST classes : so I bound my controller to this.

Do I have to initialize each table even if I do not use them ? I just want to diplay as a result the FLIGHT_LIST table.

Thanks.

Former Member
0 Kudos

Hi,

Request_XXX Ob=new Request_XXX();

wdContext.NodeXXX().bind(Ob);

Regards, Anilkumar

david_fryda2
Participant
0 Kudos

Hi,

This is what I did.

But at execution time, the WebDynPro throws me the exception taht I posted in my first post.

Here is what I wrote :

<b>

public void wdDoInit()

{

//@@begin wdDoInit()

Request_BAPI_FLIGHT_GETLISTPortType_BAPI_FLIGHT_GETLIST input = new

Request_BAPI_FLIGHT_GETLISTPortType_BAPI_FLIGHT_GETLIST();

wdContext.nodeRequest_BAPI_FLIGHT_GETLISTPortType_BAPI_FLIGHT_GETLIST().bind(input);

//@@end

}

</b>

Thanks.

Former Member
0 Kudos

Hi David,

I think there would be some input parameters that are not initialied properly.

In init method you have initialized main node. But in this, Is there any parameters that requires some structure? and if yes then you have to initialize those also in init method.

Regards,

Bhavik

Former Member
0 Kudos

Looks like there is a difference btn the Model that you have in the project and the actual webservice .

Please check once again.

Regards, Anilkumar

david_fryda2
Participant
0 Kudos

In fact I did not do any initialization like I used to do when calling a BAPI and not a web service.

In the wdDoInit() method, what must I write ?

Thanks.