You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Tom Oinn <tm...@ebi.ac.uk> on 2004/06/10 17:40:33 UTC

More dynamic invocation problems

-----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-----

Re: More dynamic invocation problems

Posted by Davanum Srinivas <da...@gmail.com>.
I almost forgot this one....Can you please open up a bug report?

thanks,
dims

On Fri, 11 Jun 2004 22:23:23 +0100, Tom Oinn <tm...@ebi.ac.uk> wrote:
> Davanum Srinivas wrote:
> > how/where are u getting your "outTypes" from?
> 
> I've attached the original source file (without the changes I described
> before) to this message, the outTypes vector is generated in the
> configureFor(String operationName) method. It's being picked up
> correctly as far as I can see, the type defined in the WSDL and the type
> the code reads appear to be the same to me.
> 
> One thing I haven't tried is running the monitor to see if Axis is
> actually sending back what it claims from the JWS service, if it wasn't
> then that would explain it (and be a different bug)
> 
> Cheers,
> 
> Tom
> 
> 
> 


-- 
Davanum Srinivas - http://webservices.apache.org/~dims/

Re: More dynamic invocation problems

Posted by Tom Oinn <tm...@ebi.ac.uk>.
Davanum Srinivas wrote:
> how/where are u getting your "outTypes" from?

I've attached the original source file (without the changes I described 
before) to this message, the outTypes vector is generated in the 
configureFor(String operationName) method. It's being picked up 
correctly as far as I can see, the type defined in the WSDL and the type 
the code reads appear to be the same to me.

One thing I haven't tried is running the monitor to see if Axis is 
actually sending back what it claims from the JWS service, if it wasn't 
then that would explain it (and be a different bug)

Cheers,

Tom

Re: More dynamic invocation problems

Posted by Davanum Srinivas <da...@gmail.com>.
how/where are u getting your "outTypes" from?

On Thu, 10 Jun 2004 16:40:33 +0100, Tom Oinn <tm...@ebi.ac.uk> 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/