Results 1 to 4 of 4

Thread: Custom soap fault and wsdl

  1. #1
    Join Date
    Nov 2006
    Posts
    23

    Default Custom soap fault and wsdl

    In the past, before Spring Web Services, I've used wsdl that looked like this:

    Code:
    <wsdl:operation name="GetUser">
    	<wsdl:input message="useradmin:GetUser"/>
    	<wsdl:output message="useradmin:GetUserResponse"/>
    	<wsdl:fault name="ErrorCodeFault" message="useradmin:ErrorCodeFault"/>
    </wsdl:operation>
    The idea, of course, is that the consumer of the wsdl has some idea which operations return which custom soap faults.

    So far I've been using generated wsdl for my Spring Web Services project. I've got the custom soap fault defined in the xsd:

    Code:
    <element name="GetUserRequestFault">
    	<complexType>
    		<sequence>
    			<element name="ErrorMessage" type="string"/>
    			<element name="ErrorCode" type="string"/>
    			<element name="Login" type="string"/>
    		</sequence>
    	</complexType>
    </element>
    Is there any easy or well known way to get the generated wsdl to include the fault element?

  2. #2
    Join Date
    Nov 2006
    Posts
    23

    Default

    Should have spent more time with the code before posting... I haven't figured it all out yet, but I see that there is wsdl fault generation code.

    Not sure yet why it doesn't work for me, but I'm getting there.

  3. #3
    Join Date
    Nov 2006
    Posts
    23

    Default

    With the following schema the wsdl comes out just fine:

    Code:
    <element name="GetUserRequest">
        <complexType>
            <sequence>
                <element name="Login" type="string"/>
            </sequence>
        </complexType>
    </element>
    
    <element name="GetUserFault">
        <complexType>
            <sequence>
                <element name="ErrorMessage" type="string"/>
                <element name="ErrorCode" type="string"/>
                <element name="Login" type="string"/>
            </sequence>
         </complexType>
    </element>
       
    <element name="GetUserResponse">
        <complexType>
            <sequence>
                <element name="User" type="user:User"/>
            </sequence>
        </complexType>
    </element>
    The previous version of the schema had a mis-named fault element. It was "GetUserRequestFault". Should be "GetUserFault, as above.

  4. #4
    Join Date
    Aug 2006
    Posts
    9

    Default Multiple faults for operation

    Is there no way to add more than one fault to a given operation?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •