Hi all,
Answered my own question, finally.
Here's exactly what I did:
1) I removed the typeMapping element from the deployment for the SNIS
service and re-deployed.
Doing this restored the type information for the Configuration class in the
axis-generated WSDL file.
2) I copied this WSDL file to
/usr/apps/tomcat/webapps/axis/WEB-INF/SNIS.wsdl
3) I put back the typeMapping section of the deployment, and also added the
following line:
<wsdlFile>/usr/apps/tomcat/webapps/axis/WEB-INF/SNIS.wsdl</wsdlFile>
4) In my client, I added the following code:
=================================================
service=new Service(wsdlUrl, qn);
TypeMappingRegistry tmr = service.getTypeMappingRegistry();
TypeMapping tm = tmr.createTypeMapping();
tm.register(Class.forName("test.Configuration"), new
QName("http://test", "Configuration"), new ConfigurationSerFactory(), new
ConfigurationDeserFactory());
tmr.register("http://schemas.xmlsoap.org/soap/encoding/", tm);
=================================================
Once I explicitly registered the TypeMapping with the *client* everything
worked just fine. In hindsight, I don't know why I expected the client to
automatically pick up the typeMapping from the service, since the TestSer
example class clearly registers the typemapping itself.
This leads me to the following questions:
1) Why does the type information of the class to be mapped disappear from
the axis-generated WSDL file when I put the typeMapping section in? Without
that information typeMapping doesn't work (returning the "referenced but not
defined" exception), since there's nothing to map from the WSDL file. Also,
there doesn't seem to be any explicit connection between the QName used on
the service side and the QName used on the client side to resolve the types
in question, which strikes me as odd, if convenient...
2) I've noticed a peculiarity with the auto-generated WSDL files. Let's say
I have a service deployed and I bounce the tomcat instance. I then go to
the auto-generated WSDL url, like this:
http://myserver:8080/axis/services/SNIS?wsdl
The wsdl:definitions header looks like this:
<wsdl:definitions targetNamespace="http://myserver:8080/axis/services/SNIS">
And it stays that way for the rest of the hits to that URL.
If I bounce the server and access by IP address:
http://192.168.1.100:8080/axis/services/SNIS?wsdl
I get this:
<wsdl:definitions
targetNamespace="http://192.168.1.100:8080/axis/services/SNIS">
And again, it stays that way for the rest of the hits to that URL.
Now, if I'm a client, and I'm looking for a service with namespace
"http://myserver:8080/axis/services/SNIS" named "SNISService", but the first
time I accessed the WSDL auto-generating url I referenced the thing by IP
address, THIS SERVICE IS NOT FOUND. I have to look for the service with
namespace "http://192.168.1.100:8080/axis/services/SNIS" instead. This
strikes me as peculiar as well, and caused me no small headache I was trying
to solve the typeMapping problem.
On to the iffy world of returning an Array of Configurations! :)
Best,
Ben
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 04, 2005 11:22 AM
> To: [email protected]
> Subject: struggling with typeMapping / beanMapping
>
>
> Greetings, all -
>
> I have been having a merry time indeed with Axis, deploying services,
> creating Service objects by passing the URL of the
> automatically generated
> WSDL file and then performing call() on them, all without any
> issue. I then
> started experimenting with serialization.
>
> I have a class named "test.Configuration" used by a service
> called "SNIS".
> This class started life as a fairly sophisticated animal so I wrote a
> serializer (test.ConfigurationSerialzer) and deserializer
> (test.ConfigurationDeserializer) for it so I could pass them
> around natively
> via the Axis engine, and then wrote factories
> (test.ConfigurationSerFactory
> and test.ConfigurationDeserFactory) to procure them. I got
> all of this
> information out of the Developer's Guide and again it all
> semed enormously
> straightforward.
>
> I wrote the SNIS service deployment as follows :
>
> ===========================================
> <deployment xmlns="http://xml.apache.org/axis/wsdd/"
>
> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
>
> <service name="SNIS" provider="java:RPC">
> <typeMapping qname="ns1:Configuration" xmlns:ns1="test"
> type="java:test.Configuration"
> serializer="test.ConfigurationSerFactory"
> deserializer="test.ConfigurationDeserFactory"
>
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
> <parameter name="className" value="test.SNIS"/>
> <parameter name="allowedMethods" value="*"/>
> <parameter name="scope" value="application"/>
> </service>
> </deployment>
> ===========================================
>
> Axis seemed happy with it when I deployed it via the AdminTool, but I
> noticed that when I checked out the WSDL file which Axis
> created for it
> (http://myserver:8080/axis/services/SNIS?wsdl) it lacked any
> of the type
> information I expected regarding the Configuration class, and when I
> attempted to use the service, I got the following error:
>
> =========================================================
> [java] - URL : http://myserver:8080/axis/services/SNIS?wsdl
> [java] - NAME : SNISService
> [java] - creating service with
> [http://myserver:8080/axis/services/SNIS?wsdl, SNISService]
> [java] - creating qname with
> [http://myserver:8080/axis/services/SNIS,
> SNISService]
> [java] - ServiceException : javax.xml.rpc.ServiceException: Error
> processing WSDL document:
> [java] java.io.IOException: Type {test}Configuration is
> referenced but
> not defined.
> =========================================================
>
> I have been experimenting with the deployment file for 3 days
> and have not
> yet found the magic incantation required to make the
> serializers work. One
> interesting thing I notice is that if I remove the
> "typeMapping" section
> entirely then suddenly the WSDL file contains the information
> I expected to
> see regarding the Configiration class in the first place.
> Also, the test
> client runs, and can list the methods available in the SNIS
> service, but
> when I attempt to call the method which uses the
> Configuration class, I of
> course get this error:
>
> =========================================================
> [java] - URL : http://myserver:8080/axis/services/SNIS?wsdl
> [java] - NAME : SNISService
> [java] - creating service with
> [http://myserver:8080/axis/services/SNIS?wsdl, SNISService]
> [java] - creating qname with
[http://myserver:8080/axis/services/SNIS,
SNISService]
[java] name: setConfiguration
[java] name: execPing
[java] name: getConfiguration
[java] name: addConfiguration
[java] name: execTraceroute
[java] - exception in serviceCall : java.io.IOException: No serializer
found for class test.Configuration in registry
[EMAIL PROTECTED]
[java] AxisFault
=========================================================
This error makes perfect sense to me, it's what sent me scurrying to the
developer's guide to figure out how to make this work. I've read the test
de/serializer and associated factory code, it all seemed to make sense,
only... I cannot make it work. Nothing I do seemes correct. If I do not
put the typeMapping section in the WSDD file, Axis seems to know the type
(it shows up in the WSDL file it generates) but can't find the serializer
for it. If I put the typeMapping section in to describe the serializer,
Axis seems not to know anything about the type any more, and nothing I've
done makes this situation make any sense.
I even went so far as to lobotomize my Configuration class so I could use
the beanMapping, but that gives me exactly the same errors - if I don't put
the beanMapping section in then Axis knows about the Configuration class and
puts it into the WSDL. If I put in the beanMapping section that type
information goes away and I get the "referenced but not defined" error. I
could fill pages more with variations on the errors above as I've diddled
the WSDD file trying to make the thing work but it would be pointless - I'm
certain that I've missed something crucial, I just can't figure it out.
Any help is vastly appreciated!
Best Regards,
Ben
___________________________________________________________________
The information contained in this message and any attachment may be
proprietary, confidential, and privileged or subject to the work
product doctrine and thus protected from disclosure. If the reader
of this message is not the intended recipient, or an employee or
agent responsible for delivering this message to the intended
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify me
immediately by replying to this message and deleting it and all
copies and backups thereof. Thank you.