jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • XFire
  • XFIRE-719

Client generation takes wrong name for faults

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.2.2
  • Fix Version/s: 1.2.3
  • Component/s: Generator
  • Labels:
    None

Description

Hi,

I have build a WebService Operation throwing multiple faults each containing the same Data Element:

<s:element name="WebServiceFaultDetail">
<s:complexType>
<s:sequence>
<s:element maxOccurs="1" minOccurs="0" name="detailMessage" type="s:string"/>
<s:element maxOccurs="1" minOccurs="0" name="code" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
...
<wsdl:message name="AuthenticationFailedFault">
<wsdl:part name="AuthenticationFailedFault" element="ns1:WebServiceFaultDetail"/>
</wsdl:message>
<wsdl:message name="ServiceNotAvailableFault">
<wsdl:part name="ServiceNotAvailableFault" element="ns1:WebServiceFaultDetail"/>
</wsdl:message>
<wsdl:message name="DeviceNotFoundFault">
<wsdl:part name="DeviceNotFoundFault" element="ns1:WebServiceFaultDetail"/>
</wsdl:message>
...
<wsdl:operation name="GetDeviceInformation">
<wsdl:input name="GetDeviceInformationRequest" message="tns:GetDeviceInformationRequest"/>
<wsdl:output name="GetDeviceInformationResponse" message="tns:GetDeviceInformationResponse"/>
<wsdl:fault name="AuthenticationFailedFault" message="tns:AuthenticationFailedFault"/>
<wsdl:fault name="DeviceNotFoundFault" message="tns:DeviceNotFoundFault"/>
<wsdl:fault name="ServiceNotAvailableFault" message="tns:ServiceNotAvailableFault"/>
</wsdl:operation>

But when generating a client from this WSDL, the generated Exception's faults are all named "WebServiceFaultDetail" instead of "AuthenticationFailedFault/DeviceNotFoundFault/ServiceNotAvailableFault":

public class AuthenticationFailedFault extends FaultInfoException
{
...
public static QName getFaultName() { return new QName("http://www.arvato.de/telco/tass/service/web/deviceinformation/types", "WebServiceFaultDetail"); }
}

So when invoking the client, I get the following expected Exception:

java.lang.IllegalArgumentException: A fault with name [WebServiceFaultDetail] already exists in this operation
at org.codehaus.xfire.service.OperationInfo.addFault(OperationInfo.java:197)
at org.codehaus.xfire.service.binding.ObjectServiceFactory.addFault(ObjectServiceFactory.java:908)
at org.codehaus.xfire.service.binding.ObjectServiceFactory.initializeFaults(ObjectServiceFactory.java:881)
at org.codehaus.xfire.service.binding.ObjectServiceFactory.addOperation(ObjectServiceFactory.java:801)
at org.codehaus.xfire.service.binding.ObjectServiceFactory.initializeOperations(ObjectServiceFactory.java:706)
at org.codehaus.xfire.service.binding.ObjectServiceFactory.create(ObjectServiceFactory.java:410)
at org.codehaus.xfire.annotations.AnnotationServiceFactory.create(AnnotationServiceFactory.java:246)
at org.codehaus.xfire.service.binding.ObjectServiceFactory.create(ObjectServiceFactory.java:345)
at de.arvato.telco.tass.service.web.client.DeviceInformationServiceClient.create0(DeviceInformationServiceClient.java:59)
at de.arvato.telco.tass.service.web.client.DeviceInformationServiceClient.<init>(DeviceInformationServiceClient.java:26)
at de.arvato.telco.tass.service.web.client.DeviceInformationTestClient.main(DeviceInformationTestClient.java:18)

Fault names in the generated Exceptions should match the fault names in the operations and not their associated data elements, right?

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Dan Diephouse added a comment - 29/Oct/06 7:52 PM

OK, we'll look into this. Thanks.

Show
Dan Diephouse added a comment - 29/Oct/06 7:52 PM OK, we'll look into this. Thanks.
Hide
Permalink
Dan Diephouse added a comment - 26/Nov/06 1:15 PM

Hi Frank, I've finally figured out the issue here. Its a limitation in JSR181. JSR181 doesn't have a way to separate out different fault parts with the same name. Which is why in JAX-WS they added the @WebFault annotation. Try using the JAX-WS generator with the JAXWSServiceFactory and things should work alright.

Show
Dan Diephouse added a comment - 26/Nov/06 1:15 PM Hi Frank, I've finally figured out the issue here. Its a limitation in JSR181. JSR181 doesn't have a way to separate out different fault parts with the same name. Which is why in JAX-WS they added the @WebFault annotation. Try using the JAX-WS generator with the JAXWSServiceFactory and things should work alright.
Hide
Permalink
Aleksander Adamowski added a comment - 11/Aug/10 9:57 AM

Just for the record, the exception "java.lang.IllegalArgumentException: A fault with name [ExceptionName] already exists in this operation" can also be thrown by CXF when publishing a JAX-WS endpoint, where a web method has the same exception listed twice in its "throws" clause.

E.g.:

@WebMethod
public ReturnType someOperation(@WebParam(name = "someParam1") final String someParam1,
@WebParam(name = "someParam2") final String someParam2)
throws SomeCustomException1, SomeCustomException2, SomeCustomException1

Yes, it makes no sense but I've seen some absent-minded developers put those duplicate exception declarations and javac doesn't complain.

Show
Aleksander Adamowski added a comment - 11/Aug/10 9:57 AM Just for the record, the exception "java.lang.IllegalArgumentException: A fault with name [ExceptionName] already exists in this operation" can also be thrown by CXF when publishing a JAX-WS endpoint, where a web method has the same exception listed twice in its "throws" clause. E.g.: @WebMethod public ReturnType someOperation(@WebParam(name = "someParam1") final String someParam1, @WebParam(name = "someParam2") final String someParam2) throws SomeCustomException1, SomeCustomException2, SomeCustomException1 Yes, it makes no sense but I've seen some absent-minded developers put those duplicate exception declarations and javac doesn't complain.

People

  • Assignee:
    Dan Diephouse
    Reporter:
    Frank Grupe
Vote (0)
Watch (0)

Dates

  • Created:
    19/Oct/06 10:16 AM
    Updated:
    11/Aug/10 9:57 AM
    Resolved:
    26/Nov/06 1:15 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.