User Management with axis

52 views
Skip to first unread message

Antoine Blanchard

unread,
Jun 23, 2009, 6:48:31 AM6/23/09
to Adobe LiveCycle Developers
Hello everyone,

I've a problem with axis, accessing the AuthenticationManagerService
of Adobe LiveCycle.

Trying to call the "authenticate" method, I was told that a
deserializer for MyArrayOf_xsd_anyType, WHICH IS STRANGE BECAUSE NONE
OF THE CLASSES USED BY THE AUTHENTICATE METHOD HAVE A
MyArrayOf_xsd_anyType (=Object[]).

Anyway I did this deserializer with registerTypeMapping and I get this
exception "org.xml.sax.SAXException: Unable to create JavaBean of type
[Ljava.lang.Object;"

I already had this kind of error using ReaderExtension and
PdfGenerator. It was because the web service wanted as input, a BLOB
where binary data were in a String; and in the output it gave a BLOB
where binary data were in a byte[]. (I still don't know why). I was
lucky to figure it out this time and I changed my classes to make it
work. Reading Adobe's documentation it was supposed to be a byte[]

http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/wwhelp/wwhimpl/common/html/wwhelp.htm?context=sdkHelp&file=invokingSOAP.27.1.html
Here, adobe says that MyArrayOf_xsd_anyType should be a java.util.List
but the classes generated by axis are using java.lang.Object[].

To register the deserializer I use
registerTypeMapping(java.lang.Class javaType, QName xmlType,
SerializerFactory sf, DeserializerFactory df)
if I don't have Object[].class as javaType, Axis doesn't recognize the
deserializer
sf is null
In df, I tried to register other deserializer(ArrayList, String[],
List) without success

So right now I don't have anymore ideas.

Here are some relevant parts of the code, I hope someone will be able
to help me

#########################################################
WSDL:
Code :


- <wsdl:operation name="authenticate">
<wsdl:input message="impl:authenticateRequest"
name="authenticateRequest" />
<wsdl:output message="impl:authenticateResponse"
name="authenticateResponse" />
<wsdl:fault message="impl:UMException" name="UMException" />
</wsdl:operation>

- <element name="authenticateResponse">
- <complexType>
- <sequence>
<element name="result" type="impl:AuthResult" />
</sequence>
</complexType>
</element>

- <wsdl:message name="authenticateRequest">
<wsdl:part element="impl:authenticate" name="parameters"/>
</wsdl:message>

- <element name="authenticate">
- <complexType>
- <sequence>
<element maxOccurs="1" minOccurs="0" name="username"
type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="password"
type="xsd:base64Binary"/>
</sequence>
</complexType>
</element>

- <complexType name="MyArrayOf_xsd_anyType">
- <sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item"
type="xsd:anyType" />
</sequence>
</complexType>


#########################################################
The POJO that tests the User management
Code :

public void testUserManagement(username,password) {

final Service service = new Service();
Call call;
try {
//call the web service
call = (Call) service.createCall();
call.setTargetEndpointAddress(SERVEUR_ADRESS);
call.setUsername(USER_NAME);
call.setPassword(PWD);

byte[] passwordbytes = password.getBytes();

/***************************************************/
//set the operation
call.setOperationStyle(Style.WRAPPED);
call.setOperationName("authenticate");

//set the parameters
call.addParameter(new QName("http://adobe.com/idp/services",
"username"),
Constants.XSD_STRING, ParameterMode.IN);
call.addParameter(new QName("http://adobe.com/idp/services",
"password"),
new QName("http://www.w3.org/2001/XMLSchema",
"base64Binary"),ParameterMode.IN);

//set the return type
call.setReturnType(new QName("http://adobe.com/idp/services",
"AuthResult"));

//Deserializer that does not seem to work
call.registerTypeMapping(java.lang.Object[].class, new QName("http://
adobe.com/idp/services", "MyArrayOf_xsd_anyType"), null,
new BeanDeserializerFactory(java.lang.Object[].class, new QName
("http://adobe.com/idp/services", "MyArrayOf_xsd_anyType")));

//Deserializer of AuthResult (seems to work)
call.registerTypeMapping(AuthResult.class, new QName("http://
adobe.com/idp/services", "AuthResult"), null,
new BeanDeserializerFactory(AuthResult.class, new QName("http://
adobe.com/idp/services", "AuthResult")));

//Invoke the method. Problem is raised here
Object obj = call.invoke(new Object[] { username,passwordbytes });


} catch (Exception e) {
e.printStackTrace();
}
}

#########################################################
Here is a copy of the stack trace

Code :


Exception:
org.xml.sax.SAXException: Unable to create JavaBean of type
[Ljava.lang.Object;. Missing default constructor? Error was:
java.lang.InstantiationException: [Ljava.lang.Object;.
at org.apache.axis.encoding.ser.BeanDeserializer.startElement
(BeanDeserializer.java:147)
at org.apache.axis.encoding.DeserializationContext.startElement
(DeserializationContext.java:1048)
at org.apache.axis.message.SAX2EventRecorder.replay
(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler
(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:
236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at de.pcware.adobe.MainClass.main(MainClass.java:54)
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}
Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: Unable to create JavaBean of
type [Ljava.lang.Object;. Missing default constructor? Error was:
java.lang.InstantiationException: [Ljava.lang.Object;.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException:
Unable to create JavaBean of type [Ljava.lang.Object;. Missing
default constructor? Error was: java.lang.InstantiationException:
[Ljava.lang.Object;.
at org.apache.axis.encoding.ser.BeanDeserializer.startElement
(BeanDeserializer.java:147)
at org.apache.axis.encoding.DeserializationContext.startElement
(DeserializationContext.java:1048)
at org.apache.axis.message.SAX2EventRecorder.replay
(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler
(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:
236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at de.pcware.adobe.MainClass.main(MainClass.java:54)

{http://xml.apache.org/axis/}hostname:DE003005ACC0B2

org.xml.sax.SAXException: Unable to create JavaBean of type
[Ljava.lang.Object;. Missing default constructor? Error was:
java.lang.InstantiationException: [Ljava.lang.Object;.
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.client.Call.invoke(Call.java:2470)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at de.pcware.adobe.MainClass.main(MainClass.java:54)
Caused by: org.xml.sax.SAXException: Unable to create JavaBean of type
[Ljava.lang.Object;. Missing default constructor? Error was:
java.lang.InstantiationException: [Ljava.lang.Object;.
at org.apache.axis.encoding.ser.BeanDeserializer.startElement
(BeanDeserializer.java:147)
at org.apache.axis.encoding.DeserializationContext.startElement
(DeserializationContext.java:1048)
at org.apache.axis.message.SAX2EventRecorder.replay
(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler
(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:
236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
... 3 more



#########################################################
I found this in the generated files
As you can see, it's an array mapping and not a type mapping as all
other entries. I don't know if that can be helpful.

Code :

<typeMapping
xmlns:ns="http://adobe.com/idp/services"
qname="ns:>authenticate"
type="java:com.adobe.idp.services.Authenticate"

serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"

deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
encodingStyle=""
/>
<arrayMapping
xmlns:ns="http://adobe.com/idp/services"
qname="ns:MyArrayOf_xsd_anyType"
type="java:java.lang.Object[]"
innerType="cmp-ns:anyType" xmlns:cmp-ns="http://www.w3.org/
2001/XMLSchema"
encodingStyle=""
/>

Antoine Blanchard

unread,
Jun 23, 2009, 7:16:03 AM6/23/09
to Adobe LiveCycle Developers
a small edit:
I did find where is this Object[] used.
AuthResult has a User object which extends a Principal class who has 4
Object[]

But that does not solve the problem of the deserializer.

Antoine Blanchard

unread,
Jun 23, 2009, 9:20:59 AM6/23/09
to Adobe LiveCycle Developers
FYI problem solved with

call.registerTypeMapping(java.lang.Object[].class, new
javax.xml.namespace.QName("http://adobe.com/idp/services",
"MyArrayOf_xsd_anyType"),
new org.apache.axis.encoding.ser.ArraySerializerFactory(
new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
"anyType"),
new javax.xml.namespace.QName("http://adobe.com/idp/services",
"item"))),
new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
Reply all
Reply to author
Forward
0 new messages