【发布时间】:2026-01-20 02:00:01
【问题描述】:
花了一整天的时间尝试使用 wsdl2java (Axis2 1.5.4) 生成一个 xmlbeans 绑定,完全糊涂了。这是我的命令行:
wsdl2java.bat -uri http://localhost:3000/api/wsdl -d xmlbeans -a -or -o build/client
这是 WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl2:description xmlns:wsdlx="http://www.w3.org/ns/wsdl-extensions" xmlns:whttp="http://www.w3.org/ns/wsdl/http" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsdl2="http://www.w3.org/ns/wsdl" xmlns:tns="http://localhost:3000/api/wsdl" targetNamespace="http://localhost:3000/api/wsdl">
<wsdl2:documentation>
</wsdl2:documentation>
<wsdl2:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" targetNamespace="http://localhost:3000/api/wsdl">
<xs:element type="tns:loginType" name="login">
<xs:annotation>
<xs:documentation>
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element type="tns:idType" name="id">
<xs:annotation>
<xs:documentation>
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="loginType">
<xs:sequence>
<xs:element type="xs:string" minOccurs="1" maxOccurs="1" name="email"/>
<xs:element type="xs:string" minOccurs="1" maxOccurs="1" name="password"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="idType">
<xs:attribute type="xs:int" name="id"/>
</xs:complexType>
</xs:schema>
</wsdl2:types>
<wsdl2:interface name="AtlasServiceInterface">
<wsdl2:operation style="http://www.w3.org/ns/wsdl/style/iri" name="login" pattern="http://www.w3.org/ns/wsdl/in-out">
<wsdl2:documentation>
</wsdl2:documentation>
<wsdl2:input messageLabel="In" element="tns:login"/>
<wsdl2:output messageLabel="Out" element="tns:id"/>
</wsdl2:operation>
</wsdl2:interface>
<wsdl2:binding type="https://www.w3.org/ns/wsdl/http" interface="tns:AtlasServiceInterface" name="AtlasServiceHTTPBinding">
<wsdl2:documentation>
</wsdl2:documentation>
<wsdl2:operation ref="tns:login" whttp:method="POST" whttp:location="login"/>
</wsdl2:binding>
<wsdl2:service interface="tns:AtlasServiceInterface" name="AtlasService">
<wsdl2:endpoint binding="tns:AtlasServiceHTTPBinding" name="AtlasServiceHTTPEndpoint" address="http://localhost:3000/api/"/>
</wsdl2:service>
</wsdl2:description>
我知道这是一个 HTTP 绑定...如果它不受支持,错误消息会很好。
更新0 我应该补充说 wsdl2java 完成了,我得到了一些 java 类。 AtlasServiceStub 在那里,但是当我尝试使用它时,我的登录操作没有任何方法。
【问题讨论】:
-
同样的问题,当我使用 xmlbeans 选项为我的 WSDL 生成存根时缺少一些必需/必须的方法。你找到任何解决方案了吗?请分享。
标签: wsdl axis2 wsdl2java xmlbeans