Hi Sean,
 
You could change PhoneType to string
 
You lose the restriction on the possible values, but at least the SOAP agent
will work.
 
Your application that calls the Axis generated classes could handle the
phone type value check.
 
   <s:attribute name="PhoneType" type="s:string" use="required" />
 
You are using the 22 April 2006 version of Axis 1.4, you could look at using
a later over-night build.
 
I have used 19 November 2006 Axis 1.4 for several years.
 
http://people.apache.org/dist/axis/nightly/
<http://people.apache.org/dist/axis/nightly/> 
 
    axis-bin-1_4.zip   19-Nov-2006 02:33   11M
 
============================================================================
========
 
 

-----Original Message-----
From: Sean O'Leary [mailto:razorho...@gmail.com]
Sent: Friday, 16 October 2009 5:00 AM
To: axis-user@ws.apache.org
Subject: wsdl2java issue when parsing wsdl that uses empty namespaces


Hi everyone, 


Using: Axis version 1.4 (4/22/2006)


I'm using wsdl2java to compile a wsdl for a service that one of my customers
has provided. Everything is fine except for they have one type that they
have declared in a separate schema in the wsdl with no targetNamespace and
then they refer to that type from another schema without putting anything in
for the namespace prefix. This seems to be "valid" wsdl (using no namespace)
but wsdl2java throws the following exception:


java.io.IOException: Type PhoneType is referenced but not defined.
        at
org.apache.axis.wsdl.symbolTable.SymbolTable.checkForUndefined(Symbol
Table.java:665)
        at
org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:545
)
        at
org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav
a:518)
        at
org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav
a:495)
        at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
        at java.lang.Thread.run(Unknown Source)




Here's the offending WSDL snippet:


<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap=" http://schemas.xmlsoap.org/wsdl/soap/
<http://schemas.xmlsoap.org/wsdl/soap/> " xmlns:tm="
http://microsoft.com/wsdl/mime/textMatching/
<http://microsoft.com/wsdl/mime/textMatching/> " xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/
<http://schemas.xmlsoap.org/soap/encoding/> " xmlns:mime="
http://schemas.xmlsoap.org/wsdl/mime/
<http://schemas.xmlsoap.org/wsdl/mime/> " xmlns:tns="
http://services.xyzcompany.com <http://services.xyzcompany.com> " xmlns:s="
http://www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema> "
xmlns:soap12=" http://schemas.xmlsoap.org/wsdl/soap12/
<http://schemas.xmlsoap.org/wsdl/soap12/> " xmlns:http="
http://schemas.xmlsoap.org/wsdl/http/
<http://schemas.xmlsoap.org/wsdl/http/> " targetNamespace="
http://services.xyzcompany.com <http://services.xyzcompany.com> "
xmlns:wsdl=" http://schemas.xmlsoap.org/wsdl/
<http://schemas.xmlsoap.org/wsdl/> ">
  
  <wsdl:types>
  
    <s:schema elementFormDefault="qualified" targetNamespace="
http://services.xyzcompany.com <http://services.xyzcompany.com> ">
      <s:import />
      
      
      ....
      


      <s:complexType name="Phone">
      <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="PhoneDescription"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="PhoneNumber" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Extension" type="s:string" />
      </s:sequence>
      <s:attribute name="PhoneType" type="PhoneType" use="required" />
      </s:complexType>
      
      ....
      
      
    </s:schema>
    
    <s:schema elementFormDefault="qualified">    
      <s:simpleType name="PhoneType">
        <s:restriction base="s:string">
          <s:enumeration value="office" />
          <s:enumeration value="cell" />
          <s:enumeration value="fax" />
          <s:enumeration value="personal" />
          <s:enumeration value="home" />
          <s:enumeration value="other" />
        </s:restriction>
      </s:simpleType>
    </s:schema>
    
  </wsdl:types>


</wsdl:definitions>




If I add  targetNamespace=" http://services.xyzcompany.com
<http://services.xyzcompany.com> "  to the 2nd schema and then prefix the
type="PhoneType" so it is type="tns:PhoneType", wsdl2java is able to compile
the wsdl. Then the problem is of course as soon as I use the generated code
to connect to the service it errors out as axis complains about the same
issue with the service's wsdl.


Any help you can provide is very much appreciated.


Thanks!
Sean

Reply via email to