我在使用NetBeans 7.2为NetSuite生成代理类时遇到问题。
WSDL的位置为https://webservices.netsuite.com/wsdl/v2012_2_0/netsuite.wsdl
在添加重新构建WSDL的新Web服务客户端时,我得到以下输出:
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)
我习惯于C#并导入服务引用(读取我对使用Java的ANT和Web服务没有经验)并且不确定如何继续这样做。谁能指出我正确的方向?
- 编辑 -
我在几次尝试后能够在Eclipse中生成代理类,但是我发现某些类没有生成。进一步的研究发现,原因是我需要能够生成未引用的类型。 NetSuite文档说要将以下内容添加到ant任务中:
或者作为替代方案,为以下命令添加-w -a:java –cp <classpath> org.apache.axis.wsdl.WSDL2Java <url>
但是我通过commmand wsdl2java.bat -ss -sd
-ap -uri https://webservices.netsuite.com/wsdl/v2012_2_0/netsuite.wsdl
尝试了选项2并得到了:
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)
异常继续,如果需要更多详细信息,请告知我们。
答案 0 :(得分:1)
我已经能够通过此错误,但有一个不同的错误,如果我无法解决,可能会将其作为新问题发布。无论如何,为了解决这个问题,我必须做以下事情:
希望这可以帮助那些尝试使用NetSuite测试Java的人......
答案 1 :(得分:0)
罗伯特, 问题实际上是不同的。
如果检查WSDL操作“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>
这定义了ExceededRequestSizeFault,但是没有在getDataCenterUrls的bindings部分中指定:
<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>
所以只需添加补丁即可修补WSDL to bindData部分中的getDataCenterUrls操作