XFire

[WsGen] Anonymous types in wsdl:message cause NPE

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Critical Critical
  • Resolution: Incomplete
  • Affects Version/s: 1.0
  • Fix Version/s: None
  • Component/s: Generator
  • Labels:
    None
  • Number of attachments :
    0

Description

When you try to use Wsdl11Generator (e.g,. from WsGenTask) to generate WSDL bindings from a WSDL file which contains Messages with anonymous schema types, you get a NullPointerException from AbstractServiceGenerator.

Take the following WSDL fragment:

<wsdl:message name="MyMessage">
<wsdl:part name="parameters" element="tns:MyResponse" />
</wsdl:message>

<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="MyResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="request" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>

If you look at WSDLServiceBuilder.createMessagePart(), you see the following logic:

MessagePartInfo part = info.addMessagePart(element.getQName(), XmlSchemaElement.class);

SchemaType st = null;
if (element.getRefName() != null)

{ st = getBindingProvider().getSchemaType(element.getRefName(), service); }

else if (element.getSchemaTypeName() != null)

{ st = getBindingProvider().getSchemaType(element.getSchemaTypeName(), service); }

part.setSchemaType(st);

It appears that this code will only work for Messages with non-anonymous element types. However, it looks as though it would be trivial to check whether the element has an anonymous type by adding another elese-if clause:

else if (element.getSchemaType() != null)

{ st = element.getSchemaType(); }

Activity

Hide
Dan Diephouse added a comment -

Hi, yeah I think I fixed this already in current CVS. Hopefully I'll be putting out a 1.1 beta release in the next 24 hours and you can test with that!

Show
Dan Diephouse added a comment - Hi, yeah I think I fixed this already in current CVS. Hopefully I'll be putting out a 1.1 beta release in the next 24 hours and you can test with that!
Hide
hzy9981 added a comment -

good job

Show
hzy9981 added a comment - good job

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: