[ http://issues.apache.org/jira/browse/AXIS2-784?page=all ]

Ajith Harshana Ranabahu resolved AXIS2-784.
-------------------------------------------

    Resolution: Fixed

The reason for this is the target namespace of the schema and the WSDL being 
the same. This bug is fixed and the given WSDL generates valid code against the 
SVN

> Java code generated by WSDL2Java does not compile when WSDL contains a custom 
> element in SOAP header
> ----------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-784
>                 URL: http://issues.apache.org/jira/browse/AXIS2-784
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: om, Tools, wsdl
>    Affects Versions: 1.0
>         Environment: Windows XP Professional, JDK1.5.0_03, Ant 1.6.5 
>            Reporter: Bhaskar Rathod
>         Assigned To: Ajith Harshana Ranabahu
>         Attachments: sample-address.wsdl
>
>
> I have created a WSDL file, and I am trying to generate and compile java code 
> for my web service. I can generate code, but ant build fails with complains 
> about org.apache.axiom.om.OMelement. The errors are about the method 
> newXMLStreamReader() and variable Factory within this interface.
> Specifically, I am trying to add a custom soap header in my request and 
> response.
> WSDL:
> ----------
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
> xmlns:tns="http://foo.bar/service";
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"; name="TtsSgsTitleTransfer"
> targetNamespace="http://foo.bar/service";>
>    <wsdl:types>
>      <xsd:schema targetNamespace="http://foo.bar/service";
>        xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>        xmlns:tns="http://foo.bar/service";
>        xmlns="http://foo.bar/service";   >
>          <xsd:simpleType name="AddressLineType">
>             <xsd:restriction base="xsd:string">
>                <xsd:maxLength value="50"/>
>             </xsd:restriction>
>          </xsd:simpleType>
>          <xsd:simpleType name="CityType">
>             <xsd:restriction base="xsd:string">
>                <xsd:maxLength value="25"/>
>             </xsd:restriction>
>          </xsd:simpleType>
>          <xsd:simpleType name="StateType">
>             <xsd:restriction base="xsd:string">
>                <xsd:maxLength value="2"/>
>             </xsd:restriction>
>          </xsd:simpleType>
>          <xsd:simpleType name="ZIPType">
>             <xsd:restriction base="xsd:string">
>                <xsd:maxLength value="12"/>
>             </xsd:restriction>
>          </xsd:simpleType>
>          <xsd:simpleType name="CountryType">
>             <xsd:restriction base="xsd:string">
>                <xsd:maxLength value="3"/>
>             </xsd:restriction>
>          </xsd:simpleType>
>          <xsd:complexType name="AddressType">
>             <xsd:sequence>
>                <xsd:element name="line1" type="tns:AddressLineType"/>
>                <xsd:element name="line2" type="tns:AddressLineType" 
> minOccurs="0"/>
>                <xsd:element name="city" type="tns:CityType"/>
>                <xsd:element name="state" type="tns:StateType"/>
>                <xsd:element name="zip" type="tns:ZIPType"/>
>                <xsd:element name="country" type="tns:CountryType" 
> default="USA" minOccurs="0"/>
>             </xsd:sequence>
>          </xsd:complexType>
>          <xsd:complexType name="ResponseType">
>             <xsd:sequence>
>                <xsd:element name="transmissionId" type="xsd:string"/>
>                <xsd:element name="success" type="xsd:string"/>
>                <xsd:element name="errorMessage" type="xsd:string"/>
>             </xsd:sequence>
>          </xsd:complexType>
>          <xsd:complexType name="HeaderType">
>             <xsd:sequence>
>                <xsd:element name="clientId" type="xsd:string"/>
>             </xsd:sequence>
>          </xsd:complexType>
>          <xsd:element name="updateAddressResponseElement" 
> type="tns:ResponseType"/>
>          <xsd:element name="updateAddressRequestElement" 
> type="tns:AddressType"/>
>          <xsd:element name="updateAddressResponseHeader" 
> type="tns:HeaderType"/>
>          <xsd:element name="updateAddressRequestHeader" 
> type="tns:HeaderType"/>
>       </xsd:schema>
>    </wsdl:types>
>    <wsdl:message name="updateAddressRequest">
>       <wsdl:part element="tns:updateAddressRequestElement" 
> name="addressRequest" />
>       <wsdl:part name="updateAddressRequestHeader" 
> element="tns:updateAddressRequestHeader" />
>    </wsdl:message>
>    <wsdl:message name="updateAddressResponse">
>       <wsdl:part element="tns:updateAddressResponseElement" 
> name="addressResponse" />
>       <wsdl:part name="updateAddressResponseHeader" 
> element="tns:updateAddressResponseHeader" />
>    </wsdl:message>
>    <wsdl:portType name="AddressPort">
>       <wsdl:operation name="updateAddress">
>          <wsdl:input name="updateAddressRequest" 
> message="tns:updateAddressRequest" />
>          <wsdl:output name="updateAddressResponse" 
> message="tns:updateAddressResponse" />
>       </wsdl:operation>
>    </wsdl:portType>
>    <wsdl:binding name="addressBinding" type="tns:AddressPort">
>       <soap:binding style="document" 
> transport="http://schemas.xmlsoap.org/soap/http"; />
>       <wsdl:operation name="updateAddress">
>          <soap:operation soapAction="" />
>          <wsdl:input>
>          <soap:header message="tns:updateAddressRequest" 
> part="updateAddressRequestHeader" use="literal"/>
>          <soap:body use="literal" parts="addressRequest" />
>          </wsdl:input>
>          <wsdl:output>
>             <soap:header message="tns:updateAddressResponse" 
> part="updateAddressResponseHeader" use="literal"/>
>             <soap:body use="literal" parts="addressResponse" />
>          </wsdl:output>
>       </wsdl:operation>
>    </wsdl:binding>
>    <wsdl:service name="AddressService">
>       <wsdl:port name="SOAPPort"
>                   binding="tns:addressBinding">
>          <soap:address location="http://localhost:8080/AddressService"; />
>       </wsdl:port>
>    </wsdl:service>
> </wsdl:definitions>
> ----------------------------------------------------
> My stack trace on compile error:
> ----------------------------------------------------------
> C:\devtools\axis2-std-1.0-bin\samples\wsdl>WSDL2Java -uri sample-address.wsdl 
> -sd -s -ss -d xmlbeans -p test.address -o address_src
> Using AXIS2_HOME:   c:\devtools\axis2-std-1.0-bin
> Using JAVA_HOME:    C:\devtools\jdk1.5.0_03
> log4j:WARN No appenders could be found for logger
> (org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter).
> log4j:WARN Please initialize the log4j system properly.
> C:\devtools\axis2-std-1.0-bin\samples\wsdl>cd address_src
> C:\devtools\axis2-std-1.0-bin\samples\wsdl\address_src>ant
> Buildfile: build.xml
> init:
>    [mkdir] Created dir:
> C:\devtools\axis2-std-1.0-bin\samples\wsdl\address_src\build
>    [mkdir] Created dir:
> C:\devtools\axis2-std-1.0-bin\samples\wsdl\address_src\build\classes
>    [mkdir] Created dir:
> C:\devtools\axis2-std-1.0-bin\samples\wsdl\address_src\build\lib
>    [mkdir] Created dir:
> C:\devtools\axis2-std-1.0-bin\samples\wsdl\address_src\test
> jar.xbeans:
>      [jar] Building jar:
> C:\devtools\axis2-std-1.0-bin\samples\wsdl\address_src\build\lib\XBeans-packaged.jar
> pre.compile.test:
>     [echo] XmlBeans Availability = true
>     [echo] Stax Availability= true
>     [echo] Axis2 Availability= true
> compile.src:
>    [javac] Compiling 230 source files to
> C:\devtools\axis2-std-1.0-bin\samples\wsdl\address_src\build\classes
>    [javac] 
> C:\devtools\axis2-std-1.0-bin\samples\wsdl\address_src\src\test\address\AddressServiceMessageReceiverInOut.java:77:
> cannot find
> symbol
>    [javac] symbol  : method newXMLStreamReader()
>    [javac] location: interface org.apache.axiom.om.OMElement
>    [javac]
> (org.apache.axiom.om.OMAbstractFactory.getOMFactory(),new
> org.apache.axis2.util.StreamWrapper(param.newXMLStream
> Reader())) ;
>    [javac]
>                                                        ^
>    [javac] 
> C:\devtools\axis2-std-1.0-bin\samples\wsdl\address_src\src\test\address\AddressServiceMessageReceiverInOut.java:160:
> cannot find
>  symbol
>    [javac] symbol  : variable Factory
>    [javac] location: interface org.apache.axiom.om.OMElement
>    [javac]                  return 
> org.apache.axiom.om.OMElement.Factory.parse(
>    [javac]                                                      ^
>    [javac] 
> C:\devtools\axis2-std-1.0-bin\samples\wsdl\address_src\src\test\address\AddressServiceMessageReceiverInOut.java:164:
> cannot find
>  symbol
>    [javac] symbol  : variable Factory
>    [javac] location: interface org.apache.axiom.om.OMElement
>    [javac]                  return 
> org.apache.axiom.om.OMElement.Factory.parse(
>    [javac]                                                      ^
>    [javac] Note: * uses or overrides a deprecated API.
>    [javac] Note: Recompile with -Xlint:deprecation for details.
>    [javac] Note:
> C:\devtools\axis2-std-1.0-bin\samples\wsdl\address_src\src\test\address\AddressServiceMessageReceiverInOut.java
> uses unche
> cked or unsafe operations.
>    [javac] Note: Recompile with -Xlint:unchecked for details.
>    [javac] 3 errors
> BUILD FAILED
> C:\devtools\axis2-std-1.0-bin\samples\wsdl\address_src\build.xml:50:
> Compile failed; see the compiler error output for details.
> Total time: 17 seconds

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to