Robert H
Robert H

Reputation: 11730

Unable to generate proxy classes from wsdl in NetBeans or Eclipse

I am having issues generating proxy classes for NetSuite using NetBeans 7.2.

Location of the WSDL is https://webservices.netsuite.com/wsdl/v2012_2_0/netsuite.wsdl

I am getting the following output when adding a new Web Service Client referancing that WSDL:

ant -f "\\\\network.local\\usersfolders\\roberth\\My Documents\\NetBeansProjects\\JavaApplication2" wsimport-client-netsuite
init:
wsimport-init:
Created dir: \\network.local\usersfolders\roberth\My Documents\NetBeansProjects\JavaApplication2\build\generated-sources\jax-ws
wsimport-client-netsuite:
Created dir: \\network.local\usersfolders\roberth\My Documents\NetBeansProjects\JavaApplication2\build\generated\jax-wsCache\netsuite
command line: wsimport -d "\\network.local\usersfolders\roberth\My Documents\NetBeansProjects\JavaApplication2\build\generated\jax-wsCache\netsuite" -extension -Xnocompile -Xendorsed -keep -s "\\network.local\usersfolders\roberth\My Documents\NetBeansProjects\JavaApplication2\build\generated\jax-wsCache\netsuite" -catalog "\\network.local\usersfolders\roberth\My Documents\NetBeansProjects\JavaApplication2" -verbose "\\network.local\usersfolders\roberth\My Documents\NetBeansProjects\JavaApplication2\xml-resources\web-service-references\netsuite\wsdl" -wsdllocation https://webservices.netsuite.com/wsdl/v2012_2_0/netsuite.wsdl
Missing WSDL_URI

Usage: wsimport [options] <WSDL_URI>
where [options] include:
  -b <path>                 specify jaxws/jaxb binding files or additional schemas
                            (Each <path> must have its own -b)

Examples:
  wsimport stock.wsdl -b stock.xml -b stock.xjb
  wsimport -d generated http://example.org/stock?wsdl

\\network.local\usersfolders\roberth\My Documents\NetBeansProjects\JavaApplication2\nbproject\jaxws-build.xml:22: wsimport failed
BUILD FAILED (total time: 0 seconds)

I am used to C# and importing service reference (read I have zero experience with ANT and web services in Java) and am unsure on how to proceed with this. Can anyone point me in the right direction?

--Edit--

I was able to generate the proxy classes in Eclipse after several tries, however I found that some of the classes are not generated. Further research has found that the reason is I need to be able to generate unreferenced types. The NetSuite documentation says to add the following to the ant task:

Or as an alternative add -w -a to the following command: java –cp <classpath> org.apache.axis.wsdl.WSDL2Java <url>

However I tried option 2 via commmand wsdl2java.bat -ss -sd -ap -uri https://webservices.netsuite.com/wsdl/v2012_2_0/netsuite.wsdl and got:

Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException : org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeExcept ion: Element QName is null for ExceededRequestSizeFault! at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGener ationEngine.java:293)

The exception continues, if more detail is required please let me know.

Upvotes: 1

Views: 3858

Answers (2)

Richard
Richard

Reputation: 1

Robert, the issue is actually different.

If you check the WSDL for operation "getDataCenterUrls" :

    <operation name="getDataCenterUrls">
        <input name="getDataCenterUrlsRequest" message="tns:getDataCenterUrlsRequest"/>
        <output name="getDataCenterUrlsResponse" message="tns:getDataCenterUrlsResponse"/>
        <fault name="ExceededRequestSizeFault" message="tns:ExceededRequestSizeFault"/>
        <fault name="UnexpectedErrorFault" message="tns:UnexpectedErrorFault"/>
    </operation>

this defines ExceededRequestSizeFault but this is not specified in the bindings portion of getDataCenterUrls :

    <operation name="getDataCenterUrls">
        <soap:operation soapAction="getDataCenterUrls"/>
        <input name="getDataCenterUrlsRequest">
            <soap:header message="tns:headers" part="passport" use="literal"/>
            <soap:header message="tns:headers" part="applicationInfo" use="literal"/>
            <soap:header message="tns:headers" part="partnerInfo" use="literal"/>
            <soap:header message="tns:headers" part="preferences" use="literal"/>
            <soap:body use="literal"/>
        </input>
        <output name="getDataCenterUrlsResponse">
            <soap:header message="tns:headers" part="documentInfo" use="literal"/>
            <soap:body use="literal"/>
        </output>
        <fault name="UnexpectedErrorFault">
            <soap:fault name="UnexpectedErrorFault" use="literal"/>
        </fault>
    </operation>

so just patch the WSDL by adding to getDataCenterUrls operation in the bindings section

Upvotes: 0

Robert H
Robert H

Reputation: 11730

I've been able to get past this error, yet have a different error which may be posted as a new question if I am unable to resolve. Anyways, in order to get past this issue I had to do the following:

  • Install the latest Java 6 SDK,
  • Set my AXIS_HOME and JAVA_HOME environment variables to point to axis 1.4 and the Java 6 installation
  • Reboot
  • Copy the NetSuite provided Ant Build.xml and NetSuite.preferences files to my new project.
  • Add timeout="120000" to the
  • point the wsdl.url variable in the NetSuite.preferences section to the location of the WSDL to build.
  • Build the ant project.
  • Comment out the multi-arg constructors located in platform.common -> TransactionSearchRowBasic and TransactionSearchBasic (the ones that throw the error about to many params )
  • copy generated classes to your desired path structure.

Hope this helps anyone who is trying to test out Java with NetSuite...

Upvotes: 1

Related Questions