users@jax-rpc.java.net

Re: Got "unexpected null value for literal data" exception in WSI compliant web service

From: Merten Schumann <Merten.Schumann_at_asg.com>
Date: Tue, 31 Aug 2004 08:11:16 +0200

Hello Doug,

I tried to send you a message to your address @sun.com but will repeat
it here:

Tried to use doc/lit in addition to rpc/lit.

Well, in rpc/lit the framework throws an exception when I hand over null
values. I have a work-around for this, the clients have to send at least
empty strings, that's fine for me.

But with features="wsi, documentliteral" my Dynamic Proxy client (not
changed, same thing which works against rpc/lit server) fails quite
early when trying to create the proxy.

Exception in thread "main"
port: {urn:rochade}RoSrapScriptExecServiceWSIPort does not contain
operation: execute
 at
com.sun.xml.rpc.client.dii.ConfiguredCall.configureCall(ConfiguredCall.j
ava:94)
 at
com.sun.xml.rpc.client.dii.ConfiguredCall.configureCall(ConfiguredCall.j
ava:70)
 at
com.sun.xml.rpc.client.dii.ConfiguredCall.setMethodName(ConfiguredCall.j
ava:53)
 at
com.sun.xml.rpc.client.dii.DynamicProxyBuilder.buildDynamicProxyFor(Dyna
micProxyBuilder.java:63)
 at
com.sun.xml.rpc.client.dii.ConfiguredService.getPort(ConfiguredService.j
ava:209)
 at
de.rochade.srap.ws.test.RoSrapScriptExecServiceClient.main(RoSrapScriptE
xecServiceClient.java:47)

Another problem appears with the simple HelloService. My non-WSI and
wsi,rpcliteral service works fine, sayHello() method returns a message.
But with wsi,docliteral I do get for may sayHello("rums") call from a
Dynamic Proxy client

SEVERE: deserialization error: XML reader error: unexpected character
content: "rums"
deserialization error: XML reader error: unexpected character content:
"rums"
at
com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.deserialize
(LiteralObjectSerializerBase.java:101)
at
de.rochade.srap.ws.HelloService_Tie.deserialize_sayHello(HelloService_Ti
e.java:107)
at
de.rochade.srap.ws.HelloService_Tie.readFirstBodyElement(HelloService_Ti
e.java:94)
at
com.sun.xml.rpc.server.StreamingHandler.handle(StreamingHandler.java:158
)
at
com.sun.xml.rpc.server.http.JAXRPCServletDelegate.doPost(JAXRPCServletDe
legate.java:316)
at
com.sun.xml.rpc.server.http.JAXRPCServlet.doPost(JAXRPCServlet.java:69)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:768)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:237)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:157)

Could it be that doc/literal is not really supported in Dynamic Proxy
client or so?

Thank you!
   Merten

The WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="urn:rochade" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
name="WSRoSrapScriptExecServiceWSI" targetNamespace="urn:rochade">
  <types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="urn:rochade">
      <complexType name="debugBounceText">
        <sequence>
          <element name="String_1" type="string"
nillable="true"/></sequence></complexType>
      <complexType name="debugBounceTextResponse">
        <sequence>
          <element name="result" type="string"
nillable="true"/></sequence></complexType>
      <complexType name="execute">
        <sequence>
          <element name="String_1" type="string" nillable="true"/>
          <element name="String_2" type="string" nillable="true"/>
          <element name="String_3" type="string"
nillable="true"/></sequence></complexType>
      <complexType name="executeResponse">
        <sequence>
          <element name="result" type="string"
nillable="true"/></sequence></complexType>
      <complexType name="isControlAreaUserRequired">
        <sequence/></complexType>
      <complexType name="isControlAreaUserRequiredResponse">
        <sequence>
          <element name="result"
type="boolean"/></sequence></complexType>
      <element name="debugBounceText" type="tns:debugBounceText"/>
      <element name="debugBounceTextResponse"
type="tns:debugBounceTextResponse"/>
      <element name="execute" type="tns:execute"/>
      <element name="executeResponse" type="tns:executeResponse"/>
      <element name="isControlAreaUserRequired"
type="tns:isControlAreaUserRequired"/>
      <element name="isControlAreaUserRequiredResponse"
type="tns:isControlAreaUserRequiredResponse"/></schema></types>
  <message name="RoSrapScriptExecServiceWSI_debugBounceText">
    <part name="parameters" element="tns:debugBounceText"/></message>
  <message name="RoSrapScriptExecServiceWSI_debugBounceTextResponse">
    <part name="result"
element="tns:debugBounceTextResponse"/></message>
  <message name="RoSrapScriptExecServiceWSI_execute">
    <part name="parameters" element="tns:execute"/></message>
  <message name="RoSrapScriptExecServiceWSI_executeResponse">
    <part name="result" element="tns:executeResponse"/></message>
  <message name="RoSrapScriptExecServiceWSI_isControlAreaUserRequired">
    <part name="parameters"
element="tns:isControlAreaUserRequired"/></message>
  <message
name="RoSrapScriptExecServiceWSI_isControlAreaUserRequiredResponse">
    <part name="result"
element="tns:isControlAreaUserRequiredResponse"/></message>
  <portType name="RoSrapScriptExecServiceWSI">
    <operation name="debugBounceText">
      <input message="tns:RoSrapScriptExecServiceWSI_debugBounceText"/>
      <output
message="tns:RoSrapScriptExecServiceWSI_debugBounceTextResponse"/></oper
ation>
    <operation name="execute">
      <input message="tns:RoSrapScriptExecServiceWSI_execute"/>
      <output
message="tns:RoSrapScriptExecServiceWSI_executeResponse"/></operation>
    <operation name="isControlAreaUserRequired">
      <input
message="tns:RoSrapScriptExecServiceWSI_isControlAreaUserRequired"/>
      <output
message="tns:RoSrapScriptExecServiceWSI_isControlAreaUserRequiredRespons
e"/></operation></portType>
  <binding name="RoSrapScriptExecServiceWSIBinding"
type="tns:RoSrapScriptExecServiceWSI">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
    <operation name="debugBounceText">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/></input>
      <output>
        <soap:body use="literal"/></output></operation>
    <operation name="execute">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/></input>
      <output>
        <soap:body use="literal"/></output></operation>
    <operation name="isControlAreaUserRequired">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/></input>
      <output>
        <soap:body use="literal"/></output></operation></binding>
  <service name="WSRoSrapScriptExecServiceWSI">
    <port name="RoSrapScriptExecServiceWSIPort"
binding="tns:RoSrapScriptExecServiceWSIBinding">
      <soap:address xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
location="http://localhost:8080/rochade/srap/scriptExecWSI"/></port></se
rvice></definitions>

The interface:

package de.rochade.srap.ws;

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface RoSrapScriptExecService extends Remote
{
 String execute(String xml, String user, String password) throws
RemoteException;
 
 boolean isControlAreaUserRequired() throws RemoteException;
 
 String debugBounceText(String txt) throws RemoteException;
}

> -----Original Message-----
> From: Doug Kohlert [mailto:Doug.Kohlert_at_Sun.COM]
> Sent: Monday, August 30, 2004 6:08 PM
> To: users_at_jax-rpc.dev.java.net
> Subject: Re: Got "unexpected null value for literal data"
> exception in WSI compliant web service
>
> Merten,
> If you use -f:wsi and -f:documentliteral you should be able
> to send null
> values in parameters.
>
> Merten Schumann wrote:
>
> >Doug,
> >
> >thank you for this information!
> >
> >I have to offer an existing API as a web service. The API
> supports null
> >values in parameters. So, I think this language feature is a
> thing you
> >should/cannot support in web service area.
> >
> >cu
> > Merten
> >
> >
> >
> >>-----Original Message-----
> >>From: Doug Kohlert [mailto:Doug.Kohlert_at_Sun.COM]
> >>Sent: Friday, August 27, 2004 11:30 PM
> >>To: users_at_jax-rpc.dev.java.net
> >>Subject: Re: Got "unexpected null value for literal data"
> >>exception in WSI compliant web service
> >>
> >>Merten,
> >>With just the WSI option you cannot send null values as
> parameters.
> >>This is because the default mode is rpc/lit and since
> >>message parts refer to types instead of elements there is no way to
> >>specify that a null value is valid.
> >>If you use the wsi option in combination with
> -f:documentliteral you
> >>will be able to send null values as the parts will reference
> >>nillable elements.
> >>
> >>Thank you for using JAXRPC.
> >>
> >>
> >>Merten Schumann wrote:
> >>
> >>
> >>
> >>>Hello,
> >>>
> >>>I've created a simple JAX-RPC web service with Sun J2EE 1.4 RI and
> >>>deployed the .war (including the JAX-RPC .jars from Sun
> J2EE 1.4) in
> >>>Tomcat 5.0.27. I tried to create two variants: WSI
> compliant and not
> >>>compliant (feature="wsi" to wscompile).
> >>>
> >>>There's a method
> >>> String execute(String msg, String user, String password) throws
> >>>RemoteException;
> >>>in the service' interface. In a JAX-RPC client I invoke the
> >>>
> >>>
> >>method with
> >>
> >>
> >>> execute("foo", null, null)
> >>>This works fine in non-WSI compliant version, but with
> features="wsi"
> >>>version I do get
> >>>
> >>>SEVERE: unexpected null value for literal data
> >>>unexpected null value for literal data
> >>>at
> >>><my_service>_execute_RequestStruct__WSICompliant__LiteralSeri
> >>>
> >>>
> >>alizer.doDe
> >>
> >>
> >>>serialize(
> >>>
> >>><my_service>_execute_RequestStruct__WSICompliant__LiteralSeri
> >>>
> >>>
> >>alizer.java
> >>
> >>
> >>>:70)
> >>>at
> >>>com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.
> >>>
> >>>
> >>internalDes
> >>
> >>
> >>>erialize(LiteralObjectSerializerBase.java:183)
> >>>at
> >>>com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.
> >>>
> >>>
> >>deserialize
> >>
> >>
> >>>(LiteralObjectSerializerBase.java:95)
> >>>at
> >>>de.rochade.srap.ws.RoSrapScriptExecService_Tie.deserialize_ex
> >>>
> >>>
> >>ecute(<my_s
> >>
> >>
> >>>ervice>_Tie.java:224)
> >>>at
> >>>de.rochade.srap.ws.RoSrapScriptExecService_Tie.readFirstBodyE
> >>>
> >>>
> >>lement(<my_
> >>
> >>
> >>>service>_Tie.java:185)
> >>>at
> >>>com.sun.xml.rpc.server.StreamingHandler.handle(StreamingHandl
> >>>
> >>>
> >>er.java:158
> >>
> >>
> >>>)
> >>>at
> >>>com.sun.xml.rpc.server.http.JAXRPCServletDelegate.doPost(JAXR
> >>>
> >>>
> >>PCServletDe
> >>
> >>
> >>>legate.java:316)
> >>>
> >>>The method works if I call execute("foo", "", "").
> >>>
> >>>I do not use method overloading in the service interface,
> there's not
> >>>another execute method.
> >>>
> >>>My question is, in WSI compliant way, is it not possible
> to hand over
> >>>null values to web service methods???
> >>>
> >>>Thanx a lot!
> >>> Merten
> >>>
> >>>-----------------------------------------------------------
> ----------
> >>>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> >>>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>--
> >>-------------------------------
> >>Doug Kohlert
> >>Sun MicroSystems, Inc.
> >>
> >>
> >>
> >>------------------------------------------------------------
> ---------
> >>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> >>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
> >>
> >>
> >>
> >>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> >For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
> >
> >
> >
> >
>
> --
> -------------------------------
> Doug Kohlert
> Sun MicroSystems, Inc.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net