Friday, 15 June 2007

JAX-RPC 1.4 Java Web Services in JDeveloper 10.1.3.1 fails to handle List<Dept> return type at runtime

I am working on developing some internal web services training to the BPEL team and came across what I thought should work within JAX-RPC 1.4 java web services. I had a service class with a method as follows

public List<Dept> showAllDeps()

I quickly generated a web service using the web service wizard and then generated a client via the proxy wizard and found at runtime I was not able to return a List of Dept records and ended up with an error as follows at runtime.

java.rmi.ServerException:
start fault message:
Internal Server Error (serialization error: no serializer is
registered for (class pas.jdbc.Dept, null)) :end fault message
at
oracle.j2ee.ws.client.StreamingSender._raiseFault(StreamingSender.java
:560)

It turns out that this use case should actually work and was a bug which I filed internally, but it turns out there is an easy workaround to enable this to work so that the correct WSDL is generated for the proxy client to successfully run. In the JAX-RPC wizard there is a page called "Additional Classes". You can use this to make sure that classes such as "Dept" have schema mappings, once that is added , the WSDL gets created with what's required for the client to correctly run.

Thanks to the web service developers for this information so now my demos are written with signature method as follows and can be successfully invoked from clients.

public List<Dept> showAllDeps()

4 comments:

Richard said...

RE: "In the JAX-RPC wizard there is a page called "Additional Classes". You can use this to make sure that classes such as "Dept" have schema mappings, once that is added , the WSDL gets created with what's required for the client to correctly run."

It appears that I am having a similar problem. Does the schema mapping need to be added to the JAX-RPC wizard for the web service or the proxy client? I am using JDeveloper 10.1.3.3.0 and don't see an "Additional Classes" page... can this now be found on the "User Defined Type Mappings" or "Handler Details" page? Or is this the "Step 3 of 6: Custom Mappings" on the proxy wizard? thanks for any help on this. I am trying to understand more about this error and it's resolution. My PL/SQL packaged function that I am calling via the web service accepts a table of objects. I am testing a simpler test with only scalar values to see if I can figure out where the issue is.

Pas Apicella said...

If your exposing some PL/SQL and hence using the PL/SQL web service wizard then you don't need to use the "Additional Classes" page as it doesn't exist in this case.

This entry talks about Java Web Services only , for PL/SQL you don't need to do this it should be handled for you automatically.

Dan said...

At last light at the end of the tunnel! I am having the same problem, please could you explain how to reslove in a little more detail? e.g. what class needs to be added? maybe a 'helloworld' style example? That would be so appreciated. Also does this now work when you run the service and use jdeveloper's test proxy client to test? Any more detail would be greatly received. I have exactly this problem with POJO based web service but just can't workout how to get your solution to work?

Pas Apicella said...

This error occurs when the jaxrpc wizard does not look at the generic type to find the additional class.

eg: You have a method as follows

public List<Dept> showAllDeps();

When creating the JAX-RPC 1.4 web service , on step 8 of 8 of the wizard there is a page called "Additional Classes" in this page, use the Add button to add the Dept class to ensure you end up with a correct ComplexType element in the WSDL.

Now when you test a proxy client it will correctly find the Dept ComplexType reference and avoid any run time exceptions.