users@jax-rpc.java.net

Re: xrpcc: Generate stub from WSDL

From: Hrishikesh Bhagwat <Hrishikesh.Bhagwat_at_XORIANT.COM>
Date: Tue, 16 Apr 2002 19:18:55 +0530

At first i find it hard to believe that xrpcc tool did not create the
<type> part for you. Please check you Service Defn Interface once again
though i m sorry i m not in a possition to tell you what exactly may be
wrong there ... if something indeed is.

Now for your problem ... i think if you remove the "xsd:" prefix from the
all
places in your <types> defn then your stuff should get working. All the
best!

Hrishikesh




-----Original Message-----
From: Su Zhang [mailto:su_ba_ru_at_HOTMAIL.COM]
Sent: Tuesday, April 16, 2002 6:55 PM
To: JAXRPC-INTEREST_at_JAVA.SUN.COM
Subject: xrpcc: Generate stub from WSDL


Hi,

I created a JAX-RPC based web services and used xrpcc tool to generate the
server-side classes and wsdl file. And then deployed them on tomcat
successfully.

To access the web service, the remote client needs to get the wsdl document
(in this case, i used the one generated by the xrpcc tool on the service
side) and generate the client-side stub and other classes.

However, i got an error message when trying to generate the stub:
error: modeler error: invalid entity name: "PriceQuote" (in namespace:
"http://www.w3.org/2001/XMLSchema")

The wsdl document looks as follows:
*************************************************************************
<?xml version="1.0" encoding="UTF-8"?>

<definitions name="TestService"
targetNamespace="http://www.deitel.com/test.wsdl"
xmlns:tns="http://www.deitel.com/test.wsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">

  <message name="getPrice">
    <part name="String_1" type="xsd:string"/></message>
  <message name="getPriceResponse">
    <part name="result" type="xsd:PriceQuote"/></message>
  <portType name="Test">
    <operation name="getPrice">
      <input message="tns:getPrice"/>
      <output message="tns:getPriceResponse"/></operation></portType>
  <binding name="TestBinding" type="tns:Test">
    <operation name="getPrice">
      <input>
        <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
use="encoded" namespace="http://www.deitel.com/test.wsdl"/></input>
      <output>
        <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
use="encoded" namespace="http://www.deitel.com/test.wsdl"/></output>
      <soap:operation soapAction=""/></operation>
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="rpc"/></binding>
  <service name="TestService">
    <port name="TestPort" binding="tns:TestBinding">
      <soap:address
location="http://zhang:8080/jaxrpc-test/test/endpoint/Test"/></port></servic
e></definitions>
**************************************************************************

I noticed that the error is caused by PriceQuote data type. Then I added
PriceQuote data type definition to the wsdl file.
**************************************************************************
  <types>
   <xsd:schema
         targetNamespace="http://www.deitel.com/schema"
         xmlns="http://www.w3.org/2001/XMLSchema">
         <xsd:complexType name="PriceQuote">
            <xsd:sequence>
               <xsd:element name="price" type="xsd:double"/>
               <xsd:element name="ISBN" type="xsd:string"/>
               <xsd:element name="storeID" type="xsd:int"/>
               <xsd:element name="storeDescription" type="xsd:string"/>
            </xsd:sequence>
         </xsd:complexType>
      </xsd:schema>
  </types>

  <message name="getPrice">
    <part name="String_1" type="xsd:string"/></message>
  <message name="getPriceResponse">
    <part name="result" type="xsd1:PriceQuote"/></message>
***************************************************************************

The xrpcc tool then can generate the client-side stub and classes without
any problems. However, when the client is executed, I got the following
error message:
java.rmi.RemoteException: deserialization error: deserialization error:
deserial
ization error: deserialization error: unexpected element type:
expected={http://
www.deitel.com/schema}PriceQuote,
actual={http://www.w3.org/2001/XMLSchema}Price
Quote; nested exception is:
        deserialization error: deserialization error: deserialization error:
des
erialization error: unexpected element type:
expected={http://www.deitel.com/sch
ema}PriceQuote, actual={http://www.w3.org/2001/XMLSchema}PriceQuote
deserialization error: deserialization error: deserialization error:
deserialization error: unexpected element type:
expected={http://www.deitel.com/schema}PriceQuote,
actual={http://www.w3.org/2001/XMLSchema}PriceQuote
        at
com.sun.xml.rpc.encoding.SOAPDeserializationContext.deserializeMultiR
efObjects(SOAPDeserializationContext.java:107)
        at
com.sun.xml.rpc.client.StreamingSender._sendStreamingSender.java:159)
        at test.TestPort_Stub.getPrice(Unknown Source)

Any suggestions?
Thanks in advance,
Su