on 2007 Mar 23 2:40 PM
Hello!
When testing my Java Class based WebService with the web servie navigator, I get an error message:
"Deserializing fails. Nested message: XML Deserialization Error. Result class [myClass] does not have property [somePropertyName] of type [aTypeName]. It is required to load XML."
I found some hints pointing to Java as well as to SAP NetWeaver problems, but none of these shed any light on the problem. The class "myClass" does have a public property "somePropertyName" with type "aTypeName", the class does have an empty constructor without parameters, getter and setter methods are available for this property and there are no underscores anywhere around the whole webservice. Any hints ?
Hi Michael,
The deserializations errors normally comes when you are using complex data types in your web service.
And the requirements for sending objects are-
Class should have empty default structure which you are saying its already there.
second is every property name should have getters and setters method for the property.
Can you please post your java class code and also tell how you are trying to access that web service?
Regards,
Piyush
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The error does no longer occur once I renamed the "rb7sofort" attribute to "sofortRb7". There might have been a conflict with the "rb7" attribute in the same class.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Further , These are the complete requirements for complex type object---->
J2SE SDK Classes
JAX-RPC supports the following J2SE SDK classes:
java.lang.Boolean
java.lang.Byte
java.lang.Double
java.lang.Float
java.lang.Integer
java.lang.Long
java.lang.Short
java.lang.String
java.math.BigDecimal
java.math.BigInteger
java.net.URI
java.util.Calendar
java.util.Date
Primitives
JAX-RPC supports the following primitive types of the Java programming language:
boolean
byte
double
float
int
long
short
Arrays
JAX-RPC also supports arrays that have members of supported JAX-RPC types. Examples of supported arrays are int[] and String[]. Multidimensional arrays, such as BigDecimal[][], are also supported.
<b>Value Types
A value type is a class whose state can be passed between a client and a remote service as a method parameter or return value. For example, in an application for a university library, a client might call a remote procedure with a value type parameter named Book, a class that contains the fields Title, Author, and Publisher.
To be supported by JAX-RPC, a value type must conform to the following rules:
It must have a public default constructor.
It must not implement (either directly or indirectly) the java.rmi.Remote interface.
Its fields must be supported JAX-RPC types.
The value type can contain public, private, or protected fields. The field of a value type must meet these requirements:
A public field cannot be final or transient.
A nonpublic field must have corresponding getter and setter methods</b>
Hope this helps.
Regards,
Piyush
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is a snippet of the code I'm having the problem with. The method "zustaendigkeit" is the web service function that is being called via SAP WSNavigator. It's only primitive booleans involved, all implemented as public attributes.
Any idea?
import java.util.*;
import java.io.*;
public class EcmZuServiceWrapper
{
// Method has some more arguments (all complex types), but error occurs with this argument only, too
public ZustaendigkeitResult zustaendigkeit(RequiredData required)
{
ZustaendigkeitResult response = new ZustaendigkeitResult();
return response;
}
}
public class RequiredData implements Serializable
{
public boolean einnahmedez7 = false;
public boolean leistungdez7 = false;
public boolean paragraf67 = false;
public boolean hochschulhilfe = false;
public boolean kof = false;
// The following attribute is shown as causing the error
public boolean rb7sofort = false;
public boolean rb7 = false;
// Empty default constructor is implemented
// Error occurs regardless of its presence.
public GesuchteZustaendigkeiten()
{}
// Getter and Setter methods are present for all attributes.
// Error occurs regardless of their presence.
public boolean isRb7sofort() {
return rb7sofort;
}
public void setRb7sofort(boolean b) {
rb7sofort = b;
}
}
Hi Michael,
1)
ur class name is "<b>RequiredData</b>" but constructor name is ' <b>GesuchteZustaendigkeiten()'</b>
Constructor name shud be same as class name.
2) get method shud be started with 'get' keyword, urs is starting with 'is'.
Relace it to <b>'getRb7sofort()'</b> instead of <b>'isRb7sofort()</b> .
Make the above two changes and check result.
Hope it will be done.
Please reply in case it still gives error.
Regards,
Piyush
Hi!
No, actually the constructor is named exactly as the class is. For international readablility, I wanted to refactor class names in the posting but failed miserably My fault.
The getter and setter methods have been generated by NetWeaver Developer Studio ! AFAIK, it's quite usual to have getters for boolean values named "is...", but anyway. Changing them to "get..." doesn't change a bit.
Hi everybody!
Finally, I got it solved (although I do not understand the reason behind this).
In the class <b>RequiredData</b> , I implemented two attributes <b>rb7sofort</b> and <b>rb7</b> of type boolean. <b>rb7sofort</b> is reported missing in the error message. When I change <b>rb7sofort</b> to something different, say <b>sofortRb7</b>, everything works fine.
Some hints on why this might fail ?
Hi!
No way to get the message, sorry! The original class that failed is
public class GesuchteZustaendigkeit implements Serializable
{
public boolean einnahmedez7 = false;
public boolean leistungdez7 = false;
public boolean paragraf67 = false;
public boolean hochschulhilfe = false;
public boolean kof = false;
public boolean rb7sofort = false;
public boolean rb7 = false;
public GesuchteZustaendigkeit()
{}
public boolean isRb7sofort() {
return rb7sofort;
}
public void setRb7sofort(boolean b) {
rb7sofort = b;
}
}
Hi!
I cannot find any error message except
"Deserializing fails. Nested message: XML Deserialization Error. Result class [RequiredData] does not have property [Rb7Sofort] of type [java.lang.Bool]. It is required to load XML."
Since the WSDL is about 20k (the Service is a lot larger that the part causing th eproblem), sorry, no possibility to post the complete one. The type definition for the <b>RequiredData</b> class is
<xs:complexType name="RequiredData">
<xs:sequence>
<xs:element name="einnahmedez7" type="xs:boolean"/>
<xs:element name="hochschulhilfe" type="xs:boolean"/>
<xs:element name="kof" type="xs:boolean"/>
<xs:element name="leistungdez7" type="xs:boolean"/>
<xs:element name="paragraf67" type="xs:boolean"/>
<xs:element name="rb7" type="xs:boolean"/>
<xs:element name="rb7sofort" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
But as you may have noticed, the problem is solved (at least we found a workaround). We renamed the <b>rb7sofort</b> attribute to <b>sofortRb7</b>; the error does no longer occur. I'll mark the question as solved. Your input was very helpful, thanks!
User | Count |
---|---|
72 | |
10 | |
10 | |
10 | |
10 | |
8 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.