cancel
Showing results for 
Search instead for 
Did you mean: 

Web Service error

david_fryda2
Participant
0 Kudos

Hi everyone,

When I execute my web service, I get the following error.

<b>

Array Property [Item] in class [none] must not have NULL elements. This is restricted by schema description.

</b>

I do not understand it, because I filled up all the data.

Can someone help me with that problem ?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

first check out if the web service that u r trying to connect is enabled in ur portal server. else it wont work.

theja.

david_fryda2
Participant
0 Kudos

Hi,

This web service is in fact an RFC written in ABAP.

I got it's wsdl file.

I test it with the Web Services Navigator and it works properly.

The problem here is that I should be initializing a field.

If I am mistaking, please let me know.

Here is a part of the wsdl file.

<b>

- <xsd:element name="_-ILG_-BAPI_SUI_MIDDLE_CREATE">

- <xsd:complexType>

- <xsd:all>

- <xsd:element name="ET_MESSAGETABLE">

- <xsd:complexType>

- <xsd:sequence>

<xsd:element name=<u>"item"</u> minOccurs="0" maxOccurs="unbounded" type="s0:BAPIRET2" />

</xsd:sequence>

</xsd:complexType>

</xsd:element>

<xsd:element name="I_SUI_MIDDLE_CREATE" type="s0:_-ILG_-BAPI_SUI_MIDDLE_CREATE" />

- <xsd:element name="I_TEST" minOccurs="0">

- <xsd:simpleType>

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="1" />

</xsd:restriction>

</xsd:simpleType>

</xsd:element>

</xsd:all>

</xsd:complexType>

</xsd:element>

- <xsd:element name="_-ILG_-BAPI_SUI_MIDDLE_CREATE.Response">

- <xsd:complexType>

- <xsd:all>

- <xsd:element name="ET_MESSAGETABLE">

- <xsd:complexType>

- <xsd:sequence>

<xsd:element name=<u>"item"</u> minOccurs="0" maxOccurs="unbounded" type="s0:BAPIRET2" />

</xsd:sequence>

</xsd:complexType>

</xsd:element>

- <xsd:element name="E_MIDNUM">

- <xsd:simpleType>

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="12" />

<xsd:pattern value="\d*" />

</xsd:restriction>

</xsd:simpleType>

</xsd:element>

- <xsd:element name="E_SUCCESS">

- <xsd:simpleType>

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="1" />

</xsd:restriction>

</xsd:simpleType>

</xsd:element>

</xsd:all>

</xsd:complexType>

</xsd:element

</b>

Please notice the "Item"s underlined.

Thanks.

Message was edited by: David Fryda

Former Member
0 Kudos

Hi David,

There are 2 things.

1. When u tested from web service navigator/browser, there will be default values like for integer fields it will be 0 and for string variables empty values will be there. Thus at any point of time, null values will not be passed and web service runs fine.

2. Secondly, when u run from webdynpro and if you don't pass any values to string variables -- null value will be passed instead of empty value. Thus your web service is failing saying that null values are not allowed.

So, to run your web service from webdynpro, pass emtpy values for input variables or else control null values in ABAP side .

Hope this helps you.

Regards,

Shiva Kumar

david_fryda2
Participant
0 Kudos

Hi Shiva,

Thanks for your reply.

I filled up all the fields that have to get values.

Now I need to pass to a method object BAPIRET2 as an array.

So, I wrote :


BAPIRET2 []bapiret2 = new BAPIRET2[1];
ilgInner.setET_MESSAGETABLE(bapiret2);

Everything compiles.

Should I need to filled up values in that []bapiret2 ?

This is what I did :


	bapiret2[0].setFIELD("");
	bapiret2[0].setID("");
	bapiret2[0].setLOG_MSG_NO("");
	bapiret2[0].setLOG_NO("");
	bapiret2[0].setMESSAGE("");
	bapiret2[0].setMESSAGE_V1("");
	bapiret2[0].setMESSAGE_V2("");
	bapiret2[0].setMESSAGE_V3("");
	bapiret2[0].setMESSAGE_V4("");
	bapiret2[0].setNUMBER("");
	bapiret2[0].setPARAMETER("");
	bapiret2[0].setROW(1);
	bapiret2[0].setSYSTEM("");
	bapiret2[0].setTYPE("");

The problem is that bapiret2[0] is null so I get a null pointer exception.

Do you think I need to filled up every field...it seems strange, doesn't it ?

Thanks for your help.

sridhar_k2
Active Contributor
0 Kudos

Hi David Fryda,

bapiret2[0] is giving null. Because the 0-th object it self null. Ensure if(bapiret2[0] != null) before assigning any value to it.

It is sometimes necessary to pass null values to webserive, when you are not passing any values. Moreover it is the best practice, passing null values.

Thanks,

Sridhar

david_fryda2
Participant
0 Kudos

Hi Sridhar,

If I ensure that bapiret2[0] != null, I have the same problem than in my first post.

I do not know what to do...I filled up all the fields.

Thanks

sridhar_k2
Active Contributor
0 Kudos

Hi David Fryda,

Try with this code. Hope now you don't get NullPointerException.

BAPIRET2 []bapiret2 = new BAPIRET2[1];

if(bapiret2 != null){

bapiret2[0]= new BAPIRET2();

}

if(bapiret2[0] != null)

{

bapiret2[0].setFIELD("");

bapiret2[0].setID("");

all your entries...

}

Cheers,

Sridhar

david_fryda2
Participant
0 Kudos

Hi Sridhar,

You solved the problem.

My error was that I didn't initialize the bapiret[0].

Thanks a lot a nice day.

Former Member
0 Kudos

What are these checks against null good for?

Armin

sridhar_k2
Active Contributor
0 Kudos

Hi Armin,

That checking against null is to avoid Null Pointer Exception. That is a fatal error.

We follow that way. Can you please tell me, is it a good practice or not?

Regards,

Sridhar

Answers (0)