Search code examples
xmlweb-serviceswsdlapache-axiswsdl2java

Converting rpc to Document - No type was mapped to the name with namespace


I am converting this WSDL file from RPC/Literal to Document/Literal. I'm brand new to using WSDL and I'm getting the hang of it but this error has me confused, tried a couple of other solutions seen on here but none of them fixed the problem.

The Error: Every time I try to generate the Skelton and Stubs using WSDL2Java, I get the error No type was mapped to the name proptype with namespace urn:Approver

Please Help

<?xml version="1.0" encoding="UTF-8"?>

<definitions name="ApproverDefinitions" targetNamespace="urn:Approver"
 xmlns="http://schemas.xmlsoap.org/wsdl/"
 xmlns:app="urn:Approver"
 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
    <types>
 <schema elementFormDefault="qualified" targetNamespace="urn:Approver"
  xmlns="http://www.w3.org/2001/XMLSchema">
 <element name="proposal" type="app:propType"/>
 <element name="rate" type="xsd:float"/>
 <complexType name="propType">
 <sequence>
 <element name="name" type="xsd:string"/>
 <element name="address" type="xsd:string"/>
 <element name="amount" type="xsd:float"/>
 </sequence>
 </complexType>
 
 </schema>
 </types>

  <message name="proposalMessage">
<!-- need three parts for name, address, and amount values 
     use appropriate datatypes (e.g. xsd:string)-->
     <part name="parameters" element="app:proptype"/>

  </message>

  <message name="rateMessage">
<!-- need one part for rate value, again use appropriate data type -->
<part name="parameters" element="app:rate"/>
  </message>


  <portType name="loanPort">
    <operation name="approveOperation">
            <input message="app:proposalMessage"/>
        <output message="app:rateMessage"/>

<!-- include input and output messages defined above -->

    </operation>
  </portType>

  <binding name="loanBinding" type="app:loanPort">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

    <operation name="approveOperation">
      <soap:operation soapAction=""/>
      <input>
    <soap:body use="literal" namespace="urn:Approver"
     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </input>
      <output>
    <soap:body use="literal" namespace="urn:Approver"
     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </output>
    </operation>

  </binding>

  <service name="ApproverService">
    <port name="ApproverLoan" binding="app:loanBinding">
      <soap:address location="http://127.0.0.1:8080/axis2/services/ApproverService"/>
    </port>
  </service>
</definitions>

Solution

  • The element attribute of the <part> tag requires an XML element (i.e. something defined with <xsd:element>), you provided an XML type (i.e. something defined with <xsd:complexType or <xsd:simpleType>). Replace it with:

    <part name="parameters" element="app:proposal" />