0 Replies Latest reply on Jul 24, 2007 11:59 AM by Y E

    Cannot get details in custon fault

    Y E Newbie

      I need to throw a custom exception from a web service. The problem is I don't get the details.
      I'm running my WS under jboss 4.0.4.
      My wsdl contains the following :


      <xsd:element name="MyOperationFault">
       <xsd:complexType>
       <xsd:sequence>
       <xsd:element name="MyOperationFaultCode" type="xsd:string" />
       <xsd:element name="MyOperationFaultSeverity" type="xsd:string" />
       <xsd:element name="MyOperationFaultMessage" type="xsd:string" />
       <xsd:element name="MyOperationFaultComment" type="xsd:string" />
       </xsd:sequence>
       </xsd:complexType>
       </xsd:element>
      </xsd:schema>
      </wsdl:types>
      
      <wsdl:message name="MyOperationRequest">
      <wsdl:part element="tns:MyOperationRequest" name="parameters"/>
      </wsdl:message>
      <wsdl:message name="MyOperationResponse">
      <wsdl:part element="tns:MyOperationResponse" name="parameters"/>
      </wsdl:message>
      
      
      
      
      <wsdl:message name="MyOperationFault">
       <wsdl:part name="parameters" element="tns:MyOperationFault"></wsdl:part>
      </wsdl:message>
      <wsdl:portType name="Test">
       <wsdl:operation name="MyOperation">
       <wsdl:input message="tns:MyOperationRequest"/>
       <wsdl:output message="tns:MyOperationResponse"/>
       <wsdl:fault name="MyOperationException" message="tns:MyOperationFault"></wsdl:fault>
       </wsdl:operation>
      
      </wsdl:portType>
      
      <wsdl:binding name="TestSOAP" type="tns:Test">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      
      
      <wsdl:operation name="MyOperation">
       <soap:operation soapAction="http://www.mycom.com/Test/MyOperation"/>
       <wsdl:input><soap:body use="literal"/></wsdl:input>
       <wsdl:output><soap:body use="literal"/></wsdl:output>
       <wsdl:fault name="MyOperationException" >
       <soap:fault name="MyOperationException"/>
       </wsdl:fault>
      </wsdl:operation>
      
      </wsdl:binding>


      My mapping file contains this:

      
      
      <java-xml-type-mapping>
       <java-type>com.mycom.myapp.ws.types.MyOperationFault</java-type>
       <root-type-qname xmlns:typeNS="http://www.mycom.com/Test/">typeNS:MyOperationFault</root-type-qname>
       <qname-scope>complexType</qname-scope>
       <variable-mapping>
       <java-variable-name>MyOperationFaultCode</java-variable-name>
       <xml-element-name>MyOperationFaultCode</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>MyOperationFaultSeverity</java-variable-name>
       <xml-element-name>MyOperationFaultSeverity</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>MyOperationFaultMessage</java-variable-name>
       <xml-element-name>MyOperationFaultMessage</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>MyOperationFaultComment</java-variable-name>
       <xml-element-name>MyOperationFaultComment</xml-element-name>
       </variable-mapping>
       </java-xml-type-mapping>
      
      
      <exception-mapping>
       <exception-type>com.mycom.myapp.ws.types.MyOperationFault</exception-type>
       <wsdl-message xmlns:exMsgNS="http://www.mycom.com/Test/">exMsgNS:MyOperationFault</wsdl-message>
       <constructor-parameter-order>
       <element-name>MyOperationFaultCode</element-name>
       <element-name>MyOperationFaultSeverity</element-name>
       <element-name>MyOperationFaultMessage</element-name>
       <element-name>MyOperationFaultComment</element-name>
       </constructor-parameter-order>
       </exception-mapping>
      
       <service-interface-mapping>
       <service-interface>com.mycom.myapp.ws.serviceTestService</service-interface>
       <wsdl-service-name xmlns:serviceNS="http://www.mycom.com/Test/">serviceNS:TestService</wsdl-service-name>
       <port-mapping>
       <port-name>TestSOAP</port-name>
       <java-port-name>TestSOAP</java-port-name>
       </port-mapping>
       </service-interface-mapping>
      
      
       <service-endpoint-interface-mapping>
      
       <service-endpoint-interface>com.mycom.myapp.ws.Test</service-endpoint-interface>
       <wsdl-port-type xmlns:portTypeNS="http://www.mycom.com/Test/">portTypeNS:Test</wsdl-port-type>
       <wsdl-binding xmlns:bindingNS="http://www.mycom.com/Test/">bindingNS:TestSOAP</wsdl-binding>
      
      
      
      
       <service-endpoint-method-mapping>
       <java-method-name>MyOperation</java-method-name>
       <wsdl-operation>MyOperation</wsdl-operation>
       <wrapped-element/>
      
       <method-param-parts-mapping>
       <param-position>0</param-position>
       <param-type>java.lang.String</param-type>
       <wsdl-message-mapping>
       <wsdl-message xmlns:wsdlMsgNS="http://www.mycom.com/Test/">wsdlMsgNS:MyOperationRequest</wsdl-message>
       <wsdl-message-part-name>par1</wsdl-message-part-name>
       <parameter-mode>IN</parameter-mode>
       </wsdl-message-mapping>
       </method-param-parts-mapping>
      
       <method-param-parts-mapping>
       <param-position>1</param-position>
       <param-type>java.lang.String</param-type>
       <wsdl-message-mapping>
       <wsdl-message xmlns:wsdlMsgNS="http://www.mycom.com/Test/">wsdlMsgNS:MyOperationRequest</wsdl-message>
       <wsdl-message-part-name>par2</wsdl-message-part-name>
       <parameter-mode>IN</parameter-mode>
       </wsdl-message-mapping>
       </method-param-parts-mapping>
      
       <wsdl-return-value-mapping>
       <method-return-value>com.mycom.myapp.ws.api.MyOperationResponse</method-return-value>
       <wsdl-message xmlns:wsdlMsgNS="http://www.mycom.com/Test/">wsdlMsgNS:MyOperationResponse</wsdl-message>
       <wsdl-message-part-name>parameters</wsdl-message-part-name>
       </wsdl-return-value-mapping>
      
       </service-endpoint-method-mapping>
       </service-endpoint-interface-mapping>
      
      



      and this is how my methods are declared:

      public MyOperationResponse MyOperation(MyOperationRequest request) throws RemoteException,MyOperationFault;
      


      MyOperationFault extends extends Exception implements Serializable


      The problem is that when I throw MyOperationFault I get this:


      <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
       <env:Header/>
       <env:Body>
       <env:Fault>
       <faultcode>env:Client</faultcode>
       <faultstring>com.mycom.myapp.ws.types.MyOperationFault</faultstring>
       </env:Fault>
       </env:Body>
      </env:Envelop>


      I would expect to see also an element "detail" with the rest of the MyOperationFault properties.Can somebody point me the right direction what am I doing wrong?
      Thanks.