Doug Kohlert wrote on 12/05/2004, 21:30:
> Narinder,
> Section 5.4 does not say that it must not have any public fields.
It
> states that if it does have public fields that the types of those
fields
> must be valid JAXRPC types. The problem with your Application
class is
> that is does not have any public fields AND it does not conform
the the
> JavaBean style. Therefore, there is no data that can be sent over
the
> wire. If you add one public field, then just that field would be
sent
> over the wire. In short, whatever data you want sent over the
wire will
> have to be stored in either a public field or a JavaBean style
property.
>
Thanks Doug,
I changed my Application class a bit. I don' want any public fields in
my class so I implemented getter/setter methods for all private fields
which I want to be exported (as explained also in Section 5.4.1
and 5.4.2 of Specs).
Now the class looks something like :
package peemsproto;
public class Application implements Serializable {
private String name;
private String log4jConfigFile;
private String appliConfigFile;
private Logger logger;
private static Logger peemsLogger;
private HashMap allRegisteredEvents;
public Application() {
/ Do Nothing Just for confirmation according to JavaBean
}
public Application(String name, String log4jConfigFile, String
appliConfigFile) {
/../
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAppliConfigFile() {
return appliConfigFile;
}
public void setAppliConfigFile(String appliConfigFile) {
this.appliConfigFile = appliConfigFile;
}
public String getLog4jConfigFile() {
return log4jConfigFile;
}
public void setLog4jConfigFile(String log4jConfigFile) {
this.log4jConfigFile = log4jConfigFile;
}
I can now see all the 3 fields having getter/setter methods are visible
in generated WSDL file as :
<complexType name="Application">
<sequence>
<element name="appliConfigFile" type="string" />
<element name="log4jConfigFile" type="string" />
<element name="name" type="string" />
</sequence>
</complexType>
> Whenever you specify
an Object[] in the interface, you must only send
> valid JAXRPC types. Of course Application is not as I pointed out
> above. Also, if you do plan on sending valid JAXRPC types you
must make
> sure that your service endpoint interface references these types
or you
> must specify the types in an <additionalTypes> element in
your wscompile
> config.xml file. By doing one or the other, the JAXRPC SI can
generate
> serializers/deserializers for these types.
>
But still when I try to access this method from client it gives me the
following exception:
JAXRPC.TIE.04: Internal Server Error (JAXRPC.TIE.01: caught
exception while handling request: java.lang.ClassCastException)
I can see the generated Stub files by wscomile utility (like
Application.class, Application_SOAPBuilder.class etc) but still the
problem remains.
I have added the following lines in config-interface.xml file of my
WebService :
<typeMappingRegistry>
<additionalTypes>
<class name="peemsproto.Application"/>
</additionalTypes>
</typeMappingRegistry>
Where I am getting wrong ?
I could not understand when you said : if you do plan
on sending valid JAXRPC types you must make sure that your service
endpoint interface references these types or ...?
TIA
Narinder
>
> Narinder Kumar wrote:
>
> > Hi All,
> >
> > Important environment details :
> >
> > JWSDP 1.3
> > Win 2000
> > JAX-RPC 1.1
> > JDK 1.4.2
> >
> > I am trying to implement a method in the WebService which
should
> > return an Array of Custom-Defined type. The method
signatures are :
> >
> > public interface PeemsIF extends Remote {
> >
> > /.../
> > public Application[] getAllApplications () throws
RemoteException;
> > }
> >
> > Application is a normal java class not implementing the
JavaBeans
> > Design pattern but respects all the constraints specified in
JAX-RPC
> > Specification Sec 5.4 for a custom type to be JAX-RPC value
type like
> > it does not have any public field, implements
java.io.Serializable
> > interface and has a default public Constructor :
> >
> > public class Application implements Serializable {
> >
> > private String name;
> > private String log4jConfigFile;
> > private String appliConfigFile;
> > private Logger logger;
> > private static Logger peemsLogger;
> > private HashMap allRegisteredEvents;
> >
> > public Application() {
> > /..../
> > }
> >
> > Application(String name, String log4jConfigFile, String
> > appliConfigFile) {
> > /../
> > }
> >
> > /..../
> > }
> >
> > When I try to compile and package all this in a WebService
> > wscompile gives the following error :
> >
> > [echo] Running wscompile:
> > [echo]
D:\jwsdp-1.3\apache-ant\../jaxrpc/bin/wscompile.bat
> > -define -d build -nd build
> > -classpath build config-interface.xml -model
> build/model.gz
> > [exec] error: invalid type for JAX-RPC structure:
> > peemsproto.Application
> > [exec] Result: 1
> >
> > peemsproto is the package for Application class. What am
I
> missing ?
> >
> > I tried to change the method signature of Web Service for
> > Application[] to more generic Object[] array. Now the
compilation and
> > deployment of the web service passes peacefully. But when the
client
> > tries to access this method, it gets the following exception :
> >
> > JAXRPC.TIE.04: Internal Server Error (serialization error: no
> > serializer is registered for (class peemsproto.Application,
null))
> >
> > Why are the errors different in both the cases ? What does "no
> > serializer is registered" mean ? i.e. is there a way we can
register
> > our own custom defined types?
> >
> > Regards
> > Narinder
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
users-unsubscribe@jax-rpc.dev.java.net For
> > additional commands, e-mail: users-help@jax-rpc.dev.java.net
>
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Doug Kohlert
>
> Sun Microsystems, Inc.
> doug.kohlert@sun.com
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@jax-rpc.dev.java.net
> For additional commands, e-mail: users-help@jax-rpc.dev.java.net
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@jax-rpc.dev.java.net
For additional commands, e-mail: users-help@jax-rpc.dev.java.net