0 Replies Latest reply on Jun 21, 2006 12:03 PM by mscongdon

    Cannot obtain java type mapping

    mscongdon

      We recently upgraded to JBoss 4.0.4 with the JBossWS stack and are noticing what may be a bug in JBossWS.

      When it comes to defining faults in our messages, all instances of the fault name must be EXACTLY the same in our XSD and all points in our WSDL.

      For example. This works.

      OurService.xsd

      <xs:schema ....>
      ...
       <xs:element name="ServiceFaultMessageType" type="ServiceFaultMessageType" />
      
       <xs:complexType name="ServiceFaultMessageType">
       <xs:sequence>
       <xs:element name="ErrorCode" type="xs:int" />
       <xs:element name="ErrorMessage" type="xs:string" />
       </xs:sequence>
       </xs:complexType>
      ...
      </xs:schema>


      OurService.wsdl
      <wsdl:definitions ...>
      ...
       <wsdl:types .....>...successfully loaded OurService.xsd...</wsdl:types>
      
       ...
       <wsdl:message name="ServiceFaultMessageType">
       <wsdl:part name="fault" element="ourNS:ServiceFaultMessageType" />
       </wsdl:message>
      
       <wsdl:portType name="OurService">
       <wsdl:operation name="retrieveInfo">
       <wsdl:input name="retrieveInfoParams" message="tns:OurServiceInputMessage" />
       <wsdl:output name="retrieveInfoResult" message="tns:OurServiceOutputMessage" />
       <wsdl:fault name="ServiceFaultMessageType" message="tns:ServiceFaultMessageType" />
       </wsdl:operation>
       </wsdl:portType>
      
       <wsdl:binding name="OurServiceBinding" type="tns:OurService">
       <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
       <wsdl:operation name="retrieveInfo">
       <soap:operation soapAction="" />
       <wsdl:input name="retrieveInfoParams">
       <soap:body use="literal" />
       </wsdl:input>
       <wsdl:output name="retrieveInfoResult">
       <soap:body use="literal" />
       </wsdl:output>
       <wsdl:fault name="ServiceFaultMessageType">
       <soap:fault name="ServiceFaultMessageType" use="literal" />
       </wsdl:fault>
       </wsdl:operation>
       </wsdl:binding>
      ...
      </wsdl:definitions>



      In this scenario, the jax-rpc mapping file appears to be correct and the server starts up with no error/warning messages. This is the ONLY scenario in which this works correctly.

      We'd like to leave the XSD file in-tact (no need to change the type names). But if I were to leave the change the wsdl:message name from ServiceFaultMessageType to something like OurServiceFault and update the wsdl:fault definitions accordingly, I get the "Cannot obtain java type mapping" error when starting up the server.

      Here's an example of the same WSDL fragment that would cause this error with only minor naming changes.

      OurNewService.wsdl
      <wsdl:definitions ...>
      ...
       <wsdl:types .....>...successfully loaded OurService.xsd...</wsdl:types>
      
       ...
       <wsdl:message name="OurServiceFault">
       <wsdl:part name="fault" element="ourNS:ServiceFaultMessageType" />
       </wsdl:message>
      
       <wsdl:portType name="OurService">
       <wsdl:operation name="retrieveInfo">
       <wsdl:input name="retrieveInfoParams" message="tns:OurServiceInputMessage" />
       <wsdl:output name="retrieveInfoResult" message="tns:OurServiceOutputMessage" />
       <wsdl:fault name="retrieveInfoFault" message="tns:OurServiceFault" />
       </wsdl:operation>
       </wsdl:portType>
      
       <wsdl:binding name="OurServiceBinding" type="tns:OurService">
       <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
       <wsdl:operation name="retrieveInfo">
       <soap:operation soapAction="" />
       <wsdl:input name="retrieveInfoParams">
       <soap:body use="literal" />
       </wsdl:input>
       <wsdl:output name="retrieveInfoResult">
       <soap:body use="literal" />
       </wsdl:output>
       <wsdl:fault name="retrieveInfoFault">
       <soap:fault name="retrieveInfoFault" use="literal" />
       </wsdl:fault>
       </wsdl:operation>
       </wsdl:binding>
      ...
      </wsdl:definitions>


      We're only seeing this type mapping issue with faults (and not input our output messages).

      Why do the <wsdl:fault>, <wsdl:message> and <soap:fault> "name" attribute values ALL need to be EXACTLY the same as the schema's data type name (i.e. ServiceFaultMessageType)?

      Thanks in advance for your help.

      Michael