I am trying to get Axis to talk to a web service written by a third
party which uses the 1999 Schema. I seem unable to convince Axis to use
the 1999 schema, or to turn off sending the xsi:type info, which is
causing a validation error at the other end.
This whole PROP_SEND_XSI/SEND_TYPE_ATTR issue seems to be almost
entirely undocumented, but there are more mailing list posts about it
than 'setSchemaVersion()' so I'm hoping someone might have had some success.
Trawling through the code, it appears to me that I should be doing:
_call.getMessageContext().setProperty(_call.SEND_TYPE_ATTR, Boolean.FALSE);
(in 'createCall' in a binding stub generated from WSDL[1])
However, I've also seen people try most of these variations:
// first one is in the 'TestXsiType' test case for Axis
// so should work!!
_call.getMessageContext().setProperty(Call.SEND_TYPE_ATTR, "false");
_call.setOption(Call.SEND_TYPE_ATTR,Boolean.FALSE);
_call.setProperty(Call.SEND_TYPE_ATTR,Boolean.FALSE);
_call.setScopedProperty(Call.SEND_TYPE_ATTR,Boolean.FALSE);
_call.setOption(AxisEngine.PROP_SEND_XSI,Boolean.FALSE);
_call.setProperty(AxisEngine.PROP_SEND_XSI,Boolean.FALSE);
_call.setScopedProperty(AxisEngine.PROP_SEND_XSI,Boolean.FALSE);
_call.getMessageContext().setProperty(AxisEngine.PROP_SEND_XSI,
Boolean.FALSE);
_call.getService().getAxisEngine().setOption(AxisEngine.PROP_SEND_XSI,
Boolean.FALSE);
(Also lots of examples with new Boolean(false). Which just creates new
Boolean objects for no reason?) None of these are working for me.
Digging further I found this code in SerializationContextImpl:
// Send the xmlType if indicated or if
// the actual xmlType is different than the
// prefered xmlType
if (shouldSendType ||
(xmlType != null &&
(!xmlType.equals(actualXMLType.value)))) {
attributes = setTypeAttribute(attributes,
actualXMLType.value);
}
Hmmm I think that going against the explicitly set value of
'shouldSetType' deserves a log message...but anyway I think this is the
crux of my problem. My generated code had :
_call.addParameter(new javax.xml.namespace.QName("", "XMLRequest"), new
javax.xml.namespace.QName("http://www.w3.org/1999/XMLSchema", "string"),
java.lang.String.class, javax.xml.rpc.ParameterMode.IN);
however the fragment from Axis above suggests I need to use this instead:
_call.addParameter(new javax.xml.namespace.QName("", "XMLRequest"), new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"),
java.lang.String.class, javax.xml.rpc.ParameterMode.IN);
to prevent axis from writing the type I don't want to see in the call.
Fine, I'll accept any level of insanity if the code works ;) However,
this doesnt work either:
15273 [Thread-4] DEBUG org.apache.axis.client.Call - Enter:
Call::invoke(ns, meth, args)
15303 [Thread-4] DEBUG org.apache.axis.client.Call - operation=name:
null
returnQName: null
returnType: {http://www.w3.org/2001/XMLSchema}string
returnClass: class java.lang.String
elementQName:null
soapAction: null
style: rpc
numInParams: 1
method:null
ParameterDesc[0]:
name: XMLRequest
typeEntry: null
mode: IN
isReturn: false
typeQName: {http://www.w3.org/2001/XMLSchema}string
javaType: class java.lang.String
[...snip...]
15453 [Thread-4] DEBUG org.apache.axis.client.Call - <?xml
version="1.0" encoding="UTF-8"?>
<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/XMLSc
hema-instance">
<soapenv:Body>
<ns1:XMLListForms
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="/jetforms/soap/Server.xml">
<XMLRequest xsi:type="xsd:string">[data snipped]</XMLRequest>
</ns1:XMLListForms>
</soapenv:Body>
</soapenv:Envelope>
(NB the operation name and method appear to be null above because axis
doesnt set them, eg Call uses 'operationName' rather than set the name
of 'operation'; this doesnt look like an error in my code)
Anyway, I'm off to run this under a debugger to see if there is some
/other/ way the code can ignore me telling it not to send xsi:types. Has
anyone got any idea how to get shot of the xsi:type? Or how to get
setSchemaVersion to work?
-Baz
[1]the author of the other service is still using SDL to spec it. In
previous releases of the service the WSDL I've written to match it has
worked from axis because it didn't check my xsi:types. I know from
checking network traces against another client that the code I'm sending
is entirely correct apart from the xsi:type.
- Re: Problems with PROP_SEND_XSI Brian Ewins
- Re: Problems with PROP_SEND_XSI Dennis Sosnoski
- Re: Problems with PROP_SEND_XSI Brian Ewins
- SchemaVersion is broken was Re: Problems with... Brian Ewins