Hello
I'm trying to create Java clases from an wsdl file using Axis 1.4
and WSDL2Java tool. I should use this wsdl to create the methods to
access, and an xsd file to create few nested object wich the webservice
uses in order to pass data to the server. The problem is that I also
have to create a webservice to allow the other server to connect to me
and pass me data with the same classes.
When I connect the other server I pass the nested objects with no
problem, but when the other server tries to connect me, my server throws
this exception:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server.userException</faultcode>
<faultstring>org.xml.sax.SAXException: SimpleDeserializer encountered a
child element, which is NOT expected, in something it was trying to
deserialize.</faultstring>
<detail>
<ns1:hostname
xmlns:ns1="http://xml.apache.org/axis/">amsterdam</ns1:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
where "amsterdam" is my server's hostname.
From this error I guess that one of the nested objects wasn't correctly
created (and, by the way, this object is only used when the server has
to call me...). This is the xsd file I'm using in order to create the
nested classes:
.
.
.
<simpleType name="ConfirmationType">
<restriction base="string">
<enumeration value="Renewal"/>
<enumeration value="Resignation"/>
<enumeration value="Signing"/>
</restriction>
</simpleType>
<complexType name="AsynchronousRSComplexType">
<complexContent>
<extension base="tns:RegistrationServerRAComplexType"/>
</complexContent>
</complexType>
<complexType name="RMSS_CallbackRequestComplexType">
<complexContent>
<extension base="tns:RegistrationServerRAResponseComplexType">
<sequence>
<element name="responseType"
type="tns:NotificationCallbackType"/>
<element name="base64Pkcs10" type="string"
minOccurs="0"/>
</sequence>
</extension>
</complexContent>
</complexType>
<simpleType name="NotificationCallbackType">
<restriction base="string">
<enumeration value="PKCS10"/>
<enumeration value="SignedRenovationRequest"/>
<enumeration value="SignedRevocationRequest"/>
</restriction>
</simpleType>
<simpleType name="NotificationType">
<restriction base="string">
<enumeration value="Renewal"/>
<enumeration value="Fresh"/>
<enumeration value="Revocation"/>
<enumeration value="Blocked"/>
<enumeration value="Active"/>
</restriction>
</simpleType>
....
Concretly, the object I guess I making me problems is
NotificationCallbackType (wich is nested by
RMSS_CallbackRequestComplexType). When I use WSDL2Java in order to
create this I get:
public class NotificationCallbackType implements java.io.Serializable {
private java.lang.String _value_;
private static java.util.HashMap _table_ = new java.util.HashMap();
// Constructor
protected NotificationCallbackType(java.lang.String value) {
_value_ = value;
_table_.put(_value_,this);
}
public static final java.lang.String _PKCS10 = "PKCS10";
public static final java.lang.String _SignedRenovationRequest =
"SignedRenovationRequest";
public static final java.lang.String _SignedRevocationRequest =
"SignedRevocationRequest";
public static final NotificationCallbackType PKCS10 = new
NotificationCallbackType(_PKCS10);
public static final NotificationCallbackType SignedRenovationRequest
= new NotificationCallbackType(_SignedRenovationRequest);
public static final NotificationCallbackType SignedRevocationRequest
= new NotificationCallbackType(_SignedRevocationRequest);
public java.lang.String getValue() { return _value_;}
public static NotificationCallbackType fromValue(java.lang.String value)
throws java.lang.IllegalArgumentException {
NotificationCallbackType enumeration = (NotificationCallbackType)
_table_.get(value);
if (enumeration==null) throw new
java.lang.IllegalArgumentException();
return enumeration;
}
public static NotificationCallbackType fromString(java.lang.String
value)
throws java.lang.IllegalArgumentException {
return fromValue(value);
}
public boolean equals(java.lang.Object obj) {return (obj == this);}
public int hashCode() { return toString().hashCode();}
public java.lang.String toString() { return _value_;}
public java.lang.Object readResolve() throws
java.io.ObjectStreamException { return fromValue(_value_);}
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumSerializer(
_javaType, _xmlType);
}
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumDeserializer(
_javaType, _xmlType);
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new
org.apache.axis.description.TypeDesc(NotificationCallbackType.class);
static {
typeDesc.setXmlType(new
javax.xml.namespace.QName("http://rs.valimo.com/facade/soap/ra/schema/v3_0/",
"NotificationCallbackType"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
Wich doesn't look really as a string, but I think is OK because it still
is an String wich only can have those three values... Now if i deploy my
service, i get exactly the same as in the xsd in the wsdl file of the
deployed service. Now is when the problem comes... if I use WSDL2Java
again with the wsdl of my deployed service (the one wich has to be
called by the other server), the RMSS_CallbackRequestComplexType class
wich nests the NotificationCallbackType class , is not the same anymore.
The RMSS_CallbackRequestComplexType class now has an string
variable instead of the NotificationCallbackType class variable!!.
What's more, If I try to call my own webservice locally with those
clients I just created, I get this:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.IllegalArgumentException: argument type mismatch
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:LosAngeles
java.lang.IllegalArgumentException: argument type mismatch
at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at
org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at
org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
at
org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at
org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
and this from the tomcat log:
ERROR - Could not convert java.lang.String to bean field 'responseType',
type com.valimo.rs.facade.soap.ra.schema.v3_0.NotificationCallbackType
Do you know wich could be the problem? I've tried to modify the
server-config.wsdd file in almost every way.. but i didn't get anything...
Please let me know if you don't understand something of my explanation
(cause my english is in progress :D), and i'll try to explain it in
other way
Thank you very much.
--
Un saludo,
Tomás Tormo Franco
Indenova, S.L.
Tels.: +34 963 81 99 47
http://www.indenova.com
mailto:[EMAIL PROTECTED]