You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Bohnenberger, Keith" <KB...@mcdonaldbradley.com> on 2003/10/30 17:29:06 UTC

axis document style web services

Does wsdl generation for document literal web services work using axis?
 
I have the following schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema 
  targetNamespace="http://example.com/stockquote/schemas" 
  xmlns="http://www.w3.org/2000/10/XMLSchema"       
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="TradePriceRequest">
     <xsd:complexType>
        <xsd:all>
          <xsd:element name="tickerSymbol" type="xsd:string"/>
        </xsd:all>
     </xsd:complexType>
  </xsd:element>
  <xsd:element name="TradePrice">
     <xsd:complexType>
        <xsd:all>
            <xsd:element name="price" type="xsd:float"/>
        </xsd:all>
     </xsd:complexType>
  </xsd:element>
</xsd:schema>
 
 
My interface looks like this:
public interface StockServiceIF extends java.rmi.Remote
{
    public TradePrice getLastTradePrice(TradePriceRequest request)
throws java.rmi.RemoteException;
}
 
 
I use the following ant target to generate the wsdl:
<target name="java2wsdl">
      <java classname="org.apache.axis.wsdl.Java2WSDL"
classpathref="compile.classpath" fork="true">
            <arg line="-o ${basedir}/stockService.wsdl"/>
            <arg line="-l
http://localhost:8080/axis/service/J2WStockService"/>
            <arg line="-n http://example.com/stockquote/schemas"/>
            <arg
line="-pcom.mbi.axis.test.server=http://example.com/stockquote/schemas"/
>
            <arg line="-y DOCUMENT"/>
            <arg line="-u LITERAL"/>
            <arg line="-Cfile://${basedir}/stock.xsd"/>
            <arg value="com.mbi.axis.test.server.StockServiceIF"/>
      </java>
</target>
 
I get the following wsdl back:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="http://example.com/stockquote/schemas"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://example.com/stockquote/schemas"
xmlns:intf="http://example.com/stockquote/schemas"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <wsdl:types>
  <xsd:schema targetNamespace="http://example.com/stockquote/schemas"
xmlns="http://www.w3.org/2000/10/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <xsd:element name="TradePriceRequest">
         <xsd:complexType>
             <xsd:all>
                <xsd:element name="tickerSymbol" type="xsd:string"/>
             </xsd:all>
         </xsd:complexType>
     </xsd:element>
     <xsd:element name="TradePrice">
         <xsd:complexType>
             <xsd:all>
                  <xsd:element name="price" type="xsd:float"/>
             </xsd:all>
         </xsd:complexType>
     </xsd:element>
   <complexType name="TradePriceRequest">
    <sequence>
     <element name="tickerSymbol" nillable="true" type="xsd:string"/>
     <element name="valid" type="xsd:boolean"/>
    </sequence>
   </complexType>
   <element name="in0" type="impl:TradePriceRequest"/>
   <complexType name="TradePrice">
    <sequence>
     <element name="price" type="xsd:float"/>
     <element name="valid" type="xsd:boolean"/>
    </sequence>
   </complexType>
   <element name="getLastTradePriceReturn" type="impl:TradePrice"/>
  </xsd:schema>
 </wsdl:types>
   <wsdl:message name="getLastTradePriceResponse">
      <wsdl:part element="impl:getLastTradePriceReturn"
name="getLastTradePriceReturn"/>
   </wsdl:message>
   <wsdl:message name="getLastTradePriceRequest">
      <wsdl:part element="impl:in0" name="in0"/>
   </wsdl:message>
   <wsdl:portType name="StockServiceIF">
      <wsdl:operation name="getLastTradePrice" parameterOrder="in0">
         <wsdl:input message="impl:getLastTradePriceRequest"
name="getLastTradePriceRequest"/>
         <wsdl:output message="impl:getLastTradePriceResponse"
name="getLastTradePriceResponse"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="J2WStockServiceSoapBinding"
type="impl:StockServiceIF">
      <wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="getLastTradePrice">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="getLastTradePriceRequest">
            <wsdlsoap:body
namespace="http://example.com/stockquote/schemas" use="literal"/>
         </wsdl:input>
         <wsdl:output name="getLastTradePriceResponse">
            <wsdlsoap:body
namespace="http://example.com/stockquote/schemas" use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="StockServiceIFService">
      <wsdl:port binding="impl:J2WStockServiceSoapBinding"
name="J2WStockService">
         <wsdlsoap:address
location="http://localhost:8080/axis/service/J2WStockService"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>
 
 
But I would like to be able to generate the following wsdl
<?xml version="1.0"?>
<definitions
name="StockQuote"targetNamespace="http://example.com/stockquote.wsdl"
xmlns:tns="http://example.com/stockquote.wsdl"
xmlns:xsd1="http://example.com/stockquote.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/">    
<types>       
   <schema targetNamespace="http://example.com/stockquote.xsd"
xmlns="http://www.w3.org/2000/10/XMLSchema">           
            <element name="TradePriceRequest">              
                        <complexType>  <all>  <element
name="tickerSymbol" type="string"/> </all>  </complexType>
</element>           
            <element name="TradePrice">              
                        <complexType>  <all>  <element name="price"
type="float"/>  </all>  </complexType>           
            </element>       
   </schema>    
</types>    
<message name="GetLastTradePriceInput"> <part name="body"
element="xsd1:TradePriceRequest"/>  </message>    
<message name="GetLastTradePriceOutput">   <part name="body"
element="xsd1:TradePrice"/>    </message>    
<portType name="StockQuotePortType"> 
            <operation name="GetLastTradePrice">
              <input message="tns:GetLastTradePriceInput"/> <output
message="tns:GetLastTradePriceOutput"/>        </operation>    
</portType>    
<binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>       
     <operation name="GetLastTradePrice">           
          <soap:operation
soapAction="http://example.com/GetLastTradePrice"/>           
               <input> <soap:body use="literal"/> </input> <output>
<soap:body use="literal"/></output></operation>
</binding>    
<service name="StockQuoteService">       
   <documentation>My first service</documentation>  
   <port name="StockQuotePort" binding="tns:StockQuoteBinding">
<soap:address location="http://example.com/stockquote"/>  </port>
</service>
</definitions> 
 
 
When I tell java2wsdl to use my schema why does it add its own?