aspose file tools*
The moose likes Web Services and the fly likes java.io.IOException: Type {http://lang.java}Exception is referenced but not defined. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "java.io.IOException: Type {http://lang.java}Exception is referenced but not defined." Watch "java.io.IOException: Type {http://lang.java}Exception is referenced but not defined." New topic
Author

java.io.IOException: Type {http://lang.java}Exception is referenced but not defined.

nalamati satyanarayana
Ranch Hand

Joined: Dec 16, 2005
Posts: 36
Hi,
i am generating webservices from existing esdl file
i am using axis framework for generatring wsdl to java but i am getting error like this'
[axis-wsdl2java] java.io.IOException: Type {http://lang.java}Exception is refere
nced but not defined.
[axis-wsdl2java] at org.apache.axis.wsdl.symbolTable.SymbolTable.checkFor
Undefined(SymbolTable.java:665)
[axis-wsdl2java] at org.apache.axis.wsdl.symbolTable.SymbolTable.add(Symb
olTable.java:545)
[axis-wsdl2java] at org.apache.axis.wsdl.symbolTable.SymbolTable.populate
(SymbolTable.java:518)
[axis-wsdl2java] at org.apache.axis.wsdl.symbolTable.SymbolTable.populate
(SymbolTable.java:495)
[axis-wsdl2java] at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Pars
er.java:361)
[axis-wsdl2java] at java.lang.Thread.run(Thread.java:534)


my WSDL file like this


<?xml version="1.0" encoding="UTF-8"?>
<wsdl efinitions targetNamespace="http://localhost:8080/axis/services/InquiryFacade"
xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/axis/services/InquiryFacade"
xmlns:intf="http://localhost:8080/axis/services/InquiryFacade"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns1="http://policybo.inquirymgmtbo.businessobject.service.portal.mnyl.com"
xmlns:tns2="http://coreobject.businessobject.core.service.portal.mnyl.com"
xmlns:tns3="http://util.java" xmlns:tns4="http://lang.java"
xmlns:tns5="http://exception.core.service.portal.mnyl.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema targetNamespace="http://coreobject.businessobject.core.service.portal.mnyl.com" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://localhost:8080/axis/services/InquiryFacade"/>
<import namespace="http://policybo.inquirymgmtbo.businessobject.service.portal.mnyl.com"/>
<import namespace="http://util.java"/>
<import namespace="http://exception.core.service.portal.mnyl.com"/>
<import namespace="http://xml.apache.org/xml-soap"/>
<import namespace="http://lang.java"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="UserDTO">
<sequence>
<element name="agentCode" nillable="true" type="xsd:string"/>
<element name="agentGOCode" nillable="true" type="xsd:string"/>
<element name="agentZone" nillable="true" type="xsd:string"/>
<element name="companyID" nillable="true" type="xsd:string"/>
<element name="userCode" nillable="true" type="xsd:string"/>
<element name="userId" nillable="true" type="xsd:string"/>
<element name="userLocale" nillable="true" type="xsd:anyType"/>
<element name="userName" nillable="true" type="xsd:string"/>
<element name="userRole" nillable="true" type="xsd:string"/>
<element name="userRoleSub" nillable="true" type="xsd:string"/>
<element name="userSet" type="xsd:boolean"/>
</sequence>
</complexType>
<complexType abstract="true" name="BusinessRequestDTO">
<sequence>
<element name="user" nillable="true" type="tns2:UserDTO"/>
</sequence>
</complexType>
<complexType abstract="true" name="BusinessResponseDTO">
<sequence>
<element name="addlInfo" nillable="true" type="xsd:string"/>
<element name="user" nillable="true" type="tns2:UserDTO"/>
</sequence>
</complexType>
<complexType name="BaseBussinessDTO">
<complexContent>
<extension base="tns2:BusinessResponseDTO">
<sequence/>
</extension>
</complexContent>
</complexType>
</schema>
<schema targetNamespace="http://policybo.inquirymgmtbo.businessobject.service.portal.mnyl.com" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://localhost:8080/axis/services/InquiryFacade"/>
<import namespace="http://util.java"/>
<import namespace="http://coreobject.businessobject.core.service.portal.mnyl.com"/>
<import namespace="http://exception.core.service.portal.mnyl.com"/>
<import namespace="http://xml.apache.org/xml-soap"/>
<import namespace="http://lang.java"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="PolicySearchDTO">
<complexContent>
<extension base="tns2:BusinessRequestDTO">
<sequence>
<element name="BAgent" type="xsd:boolean"/>
<element name="agentID" nillable="true" type="xsd:string"/>
<element name="amountRangeIndicator" nillable="true" type="xsd:string"/>
<element name="clientDOB" nillable="true" type="xsd ateTime"/>
<element name="clientFirstName" nillable="true" type="xsd:string"/>
<element name="clientID" nillable="true" type="xsd:string"/>
<element name="clientLastName" nillable="true" type="xsd:string"/>
<element name="clientMiddleName" nillable="true" type="xsd:string"/>
<element name="clientName" nillable="true" type="xsd:string"/>
<element name="dateIndicator" nillable="true" type="xsd:string"/>
<element name="fromRange" nillable="true" type="xsd ateTime"/>
<element name="grossAmountMax" nillable="true" type="xsd:anyType"/>
<element name="grossAmountMin" nillable="true" type="tns4:Number"/>
<element name="policyId" nillable="true" type="xsd:string"/>
<element name="policyPlanType" nillable="true" type="xsd:string"/>
<element name="policyStatus" nillable="true" type="xsd:string"/>
<element name="premiumMode" nillable="true" type="xsd:string"/>
<element name="processDate" nillable="true" type="xsd ateTime"/>
<element name="toRange" nillable="true" type="xsd ateTime"/>
<element name="writingAgentID" nillable="true" type="xsd:string"/>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="PolicyListDTO">
<complexContent>
<extension base="tns2:BaseBussinessDTO">
<sequence>
<element name="policyListSearchDTO" nillable="true" type="impl:ArrayOf_xsd_anyType"/>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
<schema targetNamespace="http://localhost:8080/axis/services/InquiryFacade" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://policybo.inquirymgmtbo.businessobject.service.portal.mnyl.com"/>
<import namespace="http://util.java"/>
<import namespace="http://coreobject.businessobject.core.service.portal.mnyl.com"/>
<import namespace="http://exception.core.service.portal.mnyl.com"/>
<import namespace="http://xml.apache.org/xml-soap"/>
<import namespace="http://lang.java"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOf_xsd_anyType">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:anyType[]"/>
</restriction>
</complexContent>
</complexType>
</schema>
<schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://localhost:8080/axis/services/InquiryFacade"/>
<import namespace="http://policybo.inquirymgmtbo.businessobject.service.portal.mnyl.com"/>
<import namespace="http://util.java"/>
<import namespace="http://coreobject.businessobject.core.service.portal.mnyl.com"/>
<import namespace="http://exception.core.service.portal.mnyl.com"/>
<import namespace="http://lang.java"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="Vector">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:anyType"/>
</sequence>
</complexType>
</schema>
<schema targetNamespace="http://exception.core.service.portal.mnyl.com" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://localhost:8080/axis/services/InquiryFacade"/>
<import namespace="http://policybo.inquirymgmtbo.businessobject.service.portal.mnyl.com"/>
<import namespace="http://util.java"/>
<import namespace="http://coreobject.businessobject.core.service.portal.mnyl.com"/>
<import namespace="http://xml.apache.org/xml-soap"/>
<import namespace="http://lang.java"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="PortalBaseException">
<sequence>
<element name="additionalMsg" nillable="true" type="xsd:string"/>
<element name="errorCode" type="xsd:int"/>
<element name="initialException" nillable="true" type="xsd:anyType"/>
<element name="initialMsg" nillable="true" type="xsd:string"/>
<element name="rootCause" nillable="true" type="tns4:Exception"/>
</sequence>
</complexType>
</schema>
</wsdl:types>

<wsdl:message name="PortalBaseException">

<wsdl art name="fault" type="tns5 ortalBaseException"/>

</wsdl:message>

<wsdl:message name="getPolicyListResponse">

<wsdl art name="getPolicyListReturn" type="tns1 olicyListDTO"/>

</wsdl:message>

<wsdl:message name="getPolicyListRequest">

<wsdl art name="in0" type="tns1 olicySearchDTO"/>

</wsdl:message>

<wsdl ortType name="InquiryFacade">

<wsdl peration name="getPolicyList" parameterOrder="in0">

<wsdl:input message="impl:getPolicyListRequest" name="getPolicyListRequest"/>

<wsdl utput message="impl:getPolicyListResponse" name="getPolicyListResponse"/>

<wsdl:fault message="impl ortalBaseException" name="PortalBaseException"/>

</wsdl peration>

</wsdl ortType>

<wsdl:binding name="InquiryFacadeSoapBinding" type="impl:InquiryFacade">

<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl peration name="getPolicyList">

<wsdlsoap peration soapAction=""/>

<wsdl:input name="getPolicyListRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/InquiryFacade" use="encoded"/>

</wsdl:input>

<wsdl utput name="getPolicyListResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/InquiryFacade" use="encoded"/>

</wsdl utput>

<wsdl:fault name="PortalBaseException">

<wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="PortalBaseException" namespace="http://localhost:8080/axis/services/InquiryFacade" use="encoded"/>

</wsdl:fault>

</wsdl peration>

</wsdl:binding>

<wsdl:service name="InquiryFacadeService">

<wsdl ort binding="impl:InquiryFacadeSoapBinding" name="InquiryFacade">

<wsdlsoap:address location="http://localhost:8080/axis/services/InquiryFacade"/>

</wsdl ort>

</wsdl:service>

</wsdl efinitions>
nalamati satyanarayana
Ranch Hand

Joined: Dec 16, 2005
Posts: 36
please help me
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
Looks like the WSDL you are working with is one that was created by Axis Java2WSDL. That tool seems to use namespaces like "http://lang.java", "http://util.java", "http://sql.java", etc. to map some standard java types to XML. However I cannot find any reference to some schema files that define the elements in those namespaces. Furthermore Axis own WSDL2Java doesn't seem to know about them either.

So basically the WSDL is useless - to anyone. {http://lang.java}Exception is supposed to be an XML representation of an instance of java.lang.Exception - however only the Java2WSDL tool and the code generated by it knows what that XML representation actually looks like.


The problem is the rootCause element in the "http://exception.core.service.portal.mnyl.com" namespace.


It is referencing {http://lang.java}Exception ("tns4:Exception"). While the "http://lang.java" namespace is imported in a few places it isn't actually defined anywhere.

The only namespaces that are defined are in the WSDL are
  • "http://localhost:8080/axis/services/InquiryFacade"
  • "http://coreobject.businessobject.core.service.portal.mnyl.com"
  • "http://policybo.inquirymgmtbo.businessobject.service.portal.mnyl.com"
  • "http://exception.core.service.portal.mnyl.com"
  • "http://xml.apache.org/xml-soap"


  • These (non-standard) namespaces are used but not defined
  • "http://lang/java"
  • "http://util/java"


  • Any element that is referenced and exists in those namespaces needs to be defined somewhere. So any WSDL-to-Java generation tool would expect something like this:

    However there don't seem to be any schema definitions for the elements that exist in the "http://lang.java", "http://util.java", "http://sql.java", etc. namespaces - these definitions seem to only exists within the logic of the Java2WSDL tool.


    "Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
    Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
    nalamati satyanarayana
    Ranch Hand

    Joined: Dec 16, 2005
    Posts: 36
    Hi,
    Thanks your repaly is very much helful forme
    Peer Reynders
    Bartender

    Joined: Aug 19, 2005
    Posts: 2906
    Originally posted by nalamati satyanarayana:
    if i remove those name spaces it will effect to webservice or not while converting to wsdl to java


    Removing those namespaces isn't enough because references are made to XML types that exist in those namespaces - so you would have to remove or replace those references.

    You did not indicate whether you are creating a web service or a web services client - the WSDL suggest that the web service already exists.

    Are you simply writing a web service client?

    This style of web service interface is no longer recommended because it ultimately causes too many headaches:
  • The interface uses RPC/encoded messaging with the dreaded SOAP section 5 encoding. Even worse it is using SOAP encoding types ({http://schemas.xmlsoap.org/soap/encoding/}Array). There always have been interoperability problems between client and server code that is generated by two different SOAP toolkits (or even with different versions of the same toolkit) when RPC/encoded messaging is used. These days document/literal messaging is preferred.
  • The interface uses the {http://www.w3.org/2001/XMLSchema}anyType XML data type. Basically anyType can represent any well formed XML fragment - this means that you do not have any information on the structure of the incoming (or outgoing) data. JAX-RPC is supposed to map {http://www.w3.org/2001/XMLSchema}anyType to javax.xml.soap.SOAPElement so that you can inspect the data yourself. Axis in the other hand seems to convert it to java.lang.Object - so ultimately org.apache.axis.encoding.ser.BeanDeserializer decides what class of object to create. It's most certainly not the type of object that you are expecting and you will have to "inspect" it during runtime to find out what it really is. In general {http://www.w3.org/2001/XMLSchema}anyType and {http://www.w3.org/2001/XMLSchema}any should be avoided unless you really, really want to pass some arbitrary XML (there usually is a better way). These types tend to leave the WSDL web services contract incomplete.
  • This interface just screams that it was implemented on a Java platform. It tries hard to make the XML elements look and sound like Java classes (Vector, Exception, Locale, DTO, Base, etc.). So this interface wasn't designed in a platform neutral manner. The web services client platform may not even be implemented in Java and the language on the client platform may not support OO concepts like classes. That is why it is important to base a good web services interface on simple XML messages (which don't necessarily use all that fancy extension, restriction stuff) that only use a few simple well supported XML data types. It is simply a fact of life that you will need to write a thin mapping wrapper around those messages to "elevate" them to the paradigm supported by the client platform.



  • There are two references that need to be removed from the WSDL;
  • {http://lang.java}Number on grossAmountMin in {http://policybo.inquirymgmtbo.businessobject.service.portal.mnyl.com}PolicySearchDTO. Changed it to anyType which matches grossAmountMax. Ultimately this should be more specific. It looks like it could be any java.lang.Number - however I don't know why a plain {http://www.w3.org/2001/XMLSchema}decimal wouldn't work.
  • {http://lang.java}Exception on rootCause in {http://exception.core.service.portal.mnyl.com}PortalBaseException. Changed it to {http://www.w3.org/2001/XMLSchema}anyType as its real structure isn't known at this point. Again this should be replaced with something more specific in the future. I imagine that the rootCause is supposed to store a stack trace, possibly in a self referencing, nesting manner, i.e. each element/level would list a message and another "cause". Ultimately this approach is flawed. The SOAP fault is supposed to simply inform the client about the failure, potentially with a correlation ID for later diagnosis - the particulars of the failure should be stored somewhere on the server to support later incident investigations.


  •  
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: java.io.IOException: Type {http://lang.java}Exception is referenced but not defined.
     
    Similar Threads
    wstools unable to parse WSDL from Axis1.4
    Deserializing parameter 'empRequest'
    XML Schema Problem
    XML Schema Problem
    WSDL2Java Error