2

Hello I am attempting to use xjc command to generate java objects from a .xsd file. The xsd file is massive and a portion of it can be seen below. When I run xjc on the following schema I get 3 classes UpsBas, MsgHdr, and Stm. However Stm should have a handfull of subclasses such as Ipr, Trs, or StmBpy. Why are these subclasses not being created?

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <!--uses CommercialInvoice v03.9, Shipment v03.7, Waybill v01.3, Manifest v01.8, Event v01.2, Declaration v01.8, BillingInvoice v01.2, Statements v01.3-->
    <xsd:element name="UpsBas">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="MsgHdr"/>
                <xsd:element ref="Stm" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="MsgHdr">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="MsgFmtNr" type="xsd:string" minOccurs="1"/>
                <xsd:element name="MsgFmtVerNr" type="xsd:string" minOccurs="1"/>
                <xsd:element name="MsgInfSrcCd" type="xsd:string" minOccurs="1"/>
                <xsd:element name="MsgOidNr" type="xsd:string" minOccurs="1"/>
                <xsd:element name="MsgTs" type="xsd:string" minOccurs="1"/>
                <xsd:element name="MsgVerNr" type="xsd:string" minOccurs="0"/>
                <xsd:element name="MsgVerMrNr" type="xsd:string" minOccurs="0"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Stm">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="StmNr" type="xsd:string" minOccurs="0"/>
                <xsd:element name="PrdStmNr" type="xsd:string" minOccurs="0"/>
                <xsd:element name="StmStsCd" type="xsd:string" minOccurs="0"/>
                <xsd:element name="StmDt" type="xsd:string" minOccurs="0"/>
                <xsd:element name="StmRptDt" type="xsd:string" minOccurs="0"/>
                <xsd:element name="DlyStmRptDt" type="xsd:string" minOccurs="0"/>
                <xsd:element name="StmPrcDt" type="xsd:string" minOccurs="0"/>
                <xsd:element name="StmPrdSttDt" type="xsd:string" minOccurs="0"/>
                <xsd:element name="StmPrdEndDt" type="xsd:string" minOccurs="0"/>
                <xsd:element name="EntSmyPsnDt" type="xsd:string" minOccurs="0"/>
                <xsd:element name="NtcCrtDt" type="xsd:string" minOccurs="0"/>
                <xsd:element name="DocRcvDt" type="xsd:string" minOccurs="0"/>
                <xsd:element name="PmtDueDt" type="xsd:string" minOccurs="0"/>
                <xsd:element name="EntTypCd" type="xsd:string" minOccurs="0"/>
                <xsd:element name="EntNr" type="xsd:string" minOccurs="0"/>
                <xsd:element name="EntPorCd" type="xsd:string" minOccurs="0"/>
                <xsd:element name="PrcPorCd" type="xsd:string" minOccurs="0"/>
                <xsd:element name="StmTypCd" type="xsd:string" minOccurs="0"/>
                <xsd:element name="BkrRefNr" type="xsd:string" minOccurs="0"/>
                <xsd:element name="PmtTypCd" type="xsd:string" minOccurs="0"/>
                <xsd:element name="Ipr" minOccurs="0" maxOccurs="unbounded">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="IprNscNr" type="xsd:string" minOccurs="0"/>
                            <xsd:element name="TotA" minOccurs="0" maxOccurs="unbounded">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:element name="ADscTe" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="A" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="FeeTypCd" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="ASeqNr" type="xsd:string" minOccurs="0"/>
                                    </xsd:sequence>
                                </xsd:complexType>
                            </xsd:element>
                            <xsd:element name="Trs" minOccurs="0" maxOccurs="unbounded">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:element name="TrsLinNr" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="PrdStmNr" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="RelDocNr" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="DocTypCd" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="DocRelDt" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="DocDt" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="IptDrcScyOptCd" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="PorCd" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="DocNr" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="PmtDueDt" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="UndRevIr" type="xsd:boolean" minOccurs="0"/>
                                        <xsd:element name="StsCd" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="TrsDt" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="OthTrsIr" type="xsd:boolean" minOccurs="0"/>
                                        <xsd:element name="PrcPorCd" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="EntSmyPsnDt" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="DlyStmRptDt" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="A" minOccurs="0" maxOccurs="unbounded">
                                            <xsd:complexType>
                                                <xsd:sequence>
                                                    <xsd:element name="ADscTe" type="xsd:string" minOccurs="0"/>
                                                    <xsd:element name="ASeqNr" type="xsd:string" minOccurs="0"/>
                                                    <xsd:element name="A" type="xsd:string" minOccurs="0"/>
                                                    <xsd:element name="FeeTypCd" type="xsd:string" minOccurs="0"/>
                                                </xsd:sequence>
                                            </xsd:complexType>
                                        </xsd:element>
                                    </xsd:sequence>
                                </xsd:complexType>
                            </xsd:element>
                            <xsd:element name="IprBpy" minOccurs="0" maxOccurs="unbounded">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:element name="BpyNr" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="IprNa" minOccurs="0" maxOccurs="unbounded">
                                            <xsd:complexType>
                                                <xsd:sequence>
                                                    <xsd:element name="SeqNr" type="xsd:string" minOccurs="0"/>
                                                    <xsd:element name="IprNa" type="xsd:string" minOccurs="0"/>
                                                </xsd:sequence>
                                            </xsd:complexType>
                                        </xsd:element>
                                    </xsd:sequence>
                                </xsd:complexType>
                            </xsd:element>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="StmBpy" minOccurs="0" maxOccurs="unbounded">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="BpyRlDscTe" type="xsd:string" minOccurs="0"/>
                            <xsd:element name="BpyIdDscTe" type="xsd:string" minOccurs="0"/>
                            <xsd:element name="BpyNr" type="xsd:string" minOccurs="0"/>
                            <xsd:element name="BpyIdNr" type="xsd:string" minOccurs="0"/>
                            <xsd:element name="BpyNa" minOccurs="0" maxOccurs="unbounded">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:element name="SeqNr" type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="Na" type="xsd:string" minOccurs="0"/>
                                    </xsd:sequence>
                                </xsd:complexType>
                            </xsd:element>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="DltEnt" minOccurs="0" maxOccurs="unbounded">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="EntSmyNr" type="xsd:string" minOccurs="0"/>
                            <xsd:element name="DltSrcCd" type="xsd:string" minOccurs="0"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>
Juan Carlos Mendoza
  • 5,736
  • 7
  • 25
  • 50
Connor Blair
  • 73
  • 2
  • 10
  • Did you look at the signature of the `getIpr()` method in the `Stm` class? xjc generates static nested classes for the anonymously declared schema types. Do you not have a static `Stm.Ipr` class defined in Stm.java? – VGR Sep 06 '17 at 19:42
  • I do have a static class Stm.Ipr but I thought xjc would generate this sub class for me, with its corresponding variable. Do i have to run another xjc command for the sub classes? – Connor Blair Sep 06 '17 at 19:46
  • If you have an `Stm.Ipr` class, then I’m having trouble understanding why you claim xjc did not generate the class for you. – VGR Sep 06 '17 at 19:48

1 Answers1

0

Please use the command prompt. The following is the way for generating from wsdl. See the link enter link description here

Use to following command to create the package:

xjc -xmlschema myXsdName.xsd

Use the following command to generate the jar:

jar cvf myJarName.jar packagename/*
javalearner_heaven
  • 483
  • 1
  • 6
  • 21