how/where are u getting your "outTypes" from?
On Thu, 10 Jun 2004 16:40:33 +0100, Tom Oinn <[EMAIL PROTECTED]> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi all,
>
> Thanks firstly for the help with the dynamic invoker and complex types.
> I have run into a slightly strange behaviour, possibly I'm just being
> brain dead though?
>
> I don't know at build time what types a web service may return, they may
> have mappings in Axis already to simple java types such as string or
> string[]. If this is the case then I just handle the returned object,
> that's fine. If this is not the case I return the literal XML (actually
> as a string of XML but that's a detail, I expect to get a DOM document
> back from the invoke operation).
>
> I thought the following code would work :
>
> - --------------------------------------------------------------
> // Iterate over inputs, there are
> // vectors of input names and types
>
> QName outputQName = ((Parameter)outTypes.get(i)).getType().getQName();
> TypeMapping existingMappings =
> ((org.apache.axis.client.Call)call).getTypeMapping();
> if (existingMappings.getClassForQName(outputQName) == null) {
> ~ System.out.println("No existing deserializer for " +
> outputQName.toString());
> ((org.apache.axis.client.Call)call).registerTypeMapping(org.w3c.dom.Element.class,
>
> outputQName,
> new
> ElementSerializerFactory(),
> new
> ElementDeserializerFactory());
> // Tell the workflow front end that this is an XML output
> outputPort.setSyntacticType("'text/xml'");
> }
> else {
> // Convert the simple type back out to text/plain, octet-stream etc.
> outputPort.setSyntacticType(xsdTypeToInternalType(outputQName.getLocalPart()));
> }
> - ---------------------------------------------------------------
>
> (apologies for rather long code line length)
>
> This actually does work for inputs that are genuine complex types, ones
> which axis would otherwise throw an exception when it hits them. The
> strange behaviour is that when I have a service that is returning a
> string[] (it's a jws service, the WSDL is available at
> http://www.ebi.ac.uk/collab/mygrid/service1/goviz/GoViz.jws?wsdl) this
> mechanism still kicks in and returns a block of XML. Actually of course
> it _doesn't_ return a block of xml, it returns a String[] which confuses
> my framework a touch.
>
> So, in the case of the jws service linked above, why is there no
> deserializer registered when I interrogate the TypeMapping given that
> there obviously is one? - without this code in place Axis quite happily
> returns me a String[] from the methods that use that type. I would
> expect to get some kind of array type back from the getTypeMapping call
> in this case, or am I just doing something wrong? Given that I didn't
> initially get a class back from this call, and then registered my own
> type mapping why do I get back a String[] and not a Document (I want the
> String[], but don't see why it's being returned as that after
> registering the deserializer)
>
> Thanks in advance,
>
> Tom Oinn
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.7 (Cygwin32)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
> iD8DBQFAyIDxvIo3NIa9d1ARAhnjAKCInRtvVH5v76S3eM0xslesvBNOIQCdGS1B
> 3ezAQwOq4UIqLiTFjjKJ7mk=
> =9s84
> -----END PGP SIGNATURE-----
>
--
Davanum Srinivas - http://webservices.apache.org/~dims/