Я пытался использовать axis2 1.6 (и nightly 1.7) для генерации Java-кода из WSDL (в самом низу этой страницы) с помощью следующей команды:
$ export JAVA_HOME = / usr / java / default
$ wsdl2java.sh -uri test.wsdl -d adb -u -S src / -p mypackage --noBuildXML
Это работает с некоторыми выданными предупреждениями:
[ПРЕДУПРЕЖДЕНИЕ] Нет схемы расположения для импорта http://microsoft.com/wsdl/types/; компиляция может завершиться ошибкой
[WARN] Нет schemaLocation для импорта; компиляция может закончиться неудачей
[WARN] Тип TimeZone отсутствует!
[WARN] Тип EnumeratedValue отсутствует!
...
Затем код компилируется и работает нормально без каких-либо исключений. Однако когда я вызываю #ListDispatches () (или #GetDispatch ()), он получает массив из 5 отправлений, но все данные в каждой отправке будут иметь нулевые значения, в частности #getIdentifier (), #getClient (), #getSupplier () и т. д. для каждой отправки будет нулевым.
Я полагаю, что это связано с BaseModel (и EnumeratedValue и FlagValue), использующими любые типы в схеме. Этот WSDL был предоставлен нам клиентом, поэтому мы хотели бы пойти по пути наименьшего сопротивления. Какое минимальное количество изменений нам нужно внести в WSDL / и т. Д. заставить это работать? Необработанный XML содержит значения, используя этот метод для получения необработанных XML-данных:
responseItem.getOMElement(Response.MY_QNAME,OMAbstractFactory.getOMFactory()).toStringWithConsume();
Я пытался изменить "любые" типы (3 строки), чтобы они были элементами типов anyType / String, и удалил их полностью - но без кубиков. Я попытался использовать xmlbeans вместо adb, но при вызове wsdl2java он просто выдает исключение из-за некорректных атрибутов. Я также попытался передать -Eosv и -b в wsdl2java. Наконец, я попытался установить различные параметры:
stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM,Constants.VALUE_FALSE);
stub._getServiceClient().getOptions().setProperty(Constants.SERVICE_TCCL,Constants.TCCL_COMPOSITE);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED,Constants.VALUE_FALSE);
stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_REST,Constants.VALUE_FALSE);
stub._getServiceClient().getOptions().setProperty(Constants.Configuration.CONTENT_TYPE,"application/x-www-form-urlencoded");
stub._getServiceClient().getOptions().setProperty(Constants.Configuration.MESSAGE_TYPE,"application/x-www-form-urlencoded");
Пожалуйста, помогите! Спасибо!
test.wsdl (удаленные части файла для создания заглавной буквы):
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://vans.ljkco.com/webservices/suppliers/coachusa/dispatch/2011-01-01/" xmlns:s1="http://microsoft.com/wsdl/types/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://vans.ljkco.com/webservices/suppliers/coachusa/dispatch/2011-01-01/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://vans.ljkco.com/webservices/suppliers/coachusa/dispatch/2011-01-01/">
<s:import namespace="http://microsoft.com/wsdl/types/" />
<s:import />
<s:complexType name="Response">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Code" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Message" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Data" type="tns:ArrayOfDataItem" />
</s:sequence>
</s:complexType>
<s:complexType name="ArrayOfDataItem">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="DataItem" nillable="true" type="tns:DataItem" />
</s:sequence>
</s:complexType>
<s:complexType name="DataItem">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Value" type="s:string" />
</s:sequence>
<s:attribute name="Key" type="s:string" />
</s:complexType>
<s:element name="GetDispatch">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="id" type="s1:guid" />
<s:element minOccurs="0" maxOccurs="1" name="authNo" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetDispatchResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetDispatchResult" type="tns:DispatchResponseItem" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="DispatchResponseItem">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Response" type="tns:Response" />
<s:element minOccurs="0" maxOccurs="1" name="Dispatch" type="tns:Dispatch" />
</s:sequence>
</s:complexType>
<s:complexType name="Dispatch">
<s:complexContent mixed="false">
<s:extension base="tns:BaseModel">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Identifier" type="tns:Identifier" />
<s:element minOccurs="0" maxOccurs="1" name="ParentDispatch" type="tns:Identifier" />
<s:element minOccurs="0" maxOccurs="1" name="Client" type="tns:ClientItem" />
<s:element minOccurs="0" maxOccurs="1" name="Supplier" type="tns:SupplierItem" />
<s:element minOccurs="0" maxOccurs="1" name="VanBase" type="tns:VanBaseItem" />
<s:element minOccurs="0" maxOccurs="1" name="TimeZone" type="TimeZone" />
<s:element minOccurs="0" maxOccurs="1" name="Profile" type="tns:DispatchProfile" />
<s:element minOccurs="0" maxOccurs="1" name="Communication" type="tns:CommuniqueList" />
<s:element minOccurs="0" maxOccurs="1" name="Legs" type="tns:LegList" />
<s:element minOccurs="0" maxOccurs="1" name="Authorizations" type="tns:AuthorizationList" />
<s:element minOccurs="0" maxOccurs="1" name="Events" type="tns:EventList" />
<s:element minOccurs="0" maxOccurs="1" name="SupplierProfile" type="tns:SupplierProfile" />
<s:element minOccurs="0" maxOccurs="1" name="Cancellation" type="tns:CancelInfo" />
<s:element minOccurs="0" maxOccurs="1" name="Created" type="tns:CreationInfo" />
<s:element minOccurs="0" maxOccurs="1" name="Modified" type="tns:ModifiedInfo" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
<s:complexType name="BaseModel" abstract="true">
<s:sequence>
<s:any minOccurs="0" maxOccurs="unbounded" />
</s:sequence>
<s:attribute name="Type" type="s:string" />
</s:complexType>
<s:complexType name="Identifier">
<s:complexContent mixed="false">
<s:extension base="tns:BaseModel">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="Id" type="s1:guid" />
<s:element minOccurs="0" maxOccurs="1" name="AuthNo" type="s:string" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
<s:element name="ListDispatches">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="utcModifiedSince" type="s:dateTime" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="ListDispatchesResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ListDispatchesResult" type="tns:DispatchListResponseItem" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="DispatchListResponseItem">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Response" type="tns:Response" />
<s:element minOccurs="0" maxOccurs="1" name="Dispatches" type="tns:ArrayOfDispatch" />
</s:sequence>
</s:complexType>
<s:complexType name="ArrayOfDispatch">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="Dispatch" nillable="true" type="tns:Dispatch" />
</s:sequence>
</s:complexType>
<s:complexType name="FlagInfo">
<s:complexContent mixed="false">
<s:extension base="tns:BaseModel">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="Id" type="s1:guid" />
<s:element minOccurs="0" maxOccurs="1" name="SortCode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
</s:schema>
<s:schema elementFormDefault="qualified" targetNamespace="http://microsoft.com/wsdl/types/">
<s:simpleType name="guid">
<s:restriction base="s:string">
<s:pattern value="[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}" />
</s:restriction>
</s:simpleType>
</s:schema>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" id="EnumeratedValue" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="EnumeratedValue">
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="Value" type="xs:int" use="required" />
</xs:complexType>
<xs:complexType name="FlagValue">
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="Value" type="xs:int" use="required" />
</xs:complexType>
<xs:complexType name="TimeZone">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="Index" type="xs:int" />
<xs:element minOccurs="0" maxOccurs="1" name="Name">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="64" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="DisplayName">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="64" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Info" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="GetDispatchSoapIn">
<wsdl:part name="parameters" element="tns:GetDispatch" />
</wsdl:message>
<wsdl:message name="GetDispatchSoapOut">
<wsdl:part name="parameters" element="tns:GetDispatchResponse" />
</wsdl:message>
<wsdl:message name="ListDispatchesSoapIn">
<wsdl:part name="parameters" element="tns:ListDispatches" />
</wsdl:message>
<wsdl:message name="ListDispatchesSoapOut">
<wsdl:part name="parameters" element="tns:ListDispatchesResponse" />
</wsdl:message>
<wsdl:portType name="DispatchSoap">
<wsdl:operation name="GetDispatchId">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"><dd>Returns a unique identifier for a dispatch by its authorization number.</dd><dt><b>Parameters</b></dt><dd><table><tr><td><i>authNo:&nbsp;</i></td><td>String representing the authorization number that is a human readable identifier</td></tr></table></dd><dt><b>Returns</b></dt><dd><table><tr><td colspan='3'><i>Response Code:&nbsp;</i></td></tr><tr><td width='20'>&nbsp;</td><td><i>200 - </i></td><td>OK. Response will contain the a unique identifier for the dispatch.</td></tr><tr><td width='20'>&nbsp;</td><td><i>403 - </i></td><td>Forbidden. Assigned to a different supplier or is unassigned.</td></tr><tr><td width='20'>&nbsp;</td><td><i>404 - </i></td><td>Not Found. Dispatch was not found.</td></tr><tr><td width='20'>&nbsp;</td><td><i>500 - </i></td><td>Internal Server Error.</td></tr></table></dd><dd><table><tr><td><i>DispatchId:&nbsp;</i></td><td>The dispatch's unique identifier if successful. An empty unique identifier (00000000-0000-0000-0000-000000000000) in case of exception.</td></tr></table></dd></wsdl:documentation>
<wsdl:input message="tns:GetDispatchIdSoapIn" />
<wsdl:output message="tns:GetDispatchIdSoapOut" />
</wsdl:operation>
<wsdl:operation name="GetDispatch">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"><dd>Returns a dispatch based on the dispatch's unique identifier or authorization number.</dd><dt><b>Parameters</b></dt><dd><table><tr><td><i>id:&nbsp;</i></td><td>The dispatch unique identifier</td></tr><tr><td><i>authNo:&nbsp;</i></td><td>String representing the authorization number that is a human readable identifier</td></tr></table></dd><dt><b>Returns</b></dt><dd><table><tr><td colspan='3'><i>Response Code:&nbsp;</i></td></tr><tr><td width='20'>&nbsp;</td><td><i>200 - </i></td><td>OK. Response will contain the dispatch.</td></tr><tr><td width='20'>&nbsp;</td><td><i>403 - </i></td><td>Forbidden. Assigned to a different supplier or is unassigned.</td></tr><tr><td width='20'>&nbsp;</td><td><i>404 - </i></td><td>Not Found. Dispatch was not found.</td></tr><tr><td width='20'>&nbsp;</td><td><i>500 - </i></td><td>Internal Server Error.</td></tr></table></dd><dd><table><tr><td><i>Dispatch:&nbsp;</i></td><td>The associated dispatch if successful. Null (or Nothing) in case of exception.</td></tr></table></dd></wsdl:documentation>
<wsdl:input message="tns:GetDispatchSoapIn" />
<wsdl:output message="tns:GetDispatchSoapOut" />
</wsdl:operation>
<wsdl:operation name="ListDispatches">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"><dd>Returns a list of active dispatches that have been modified since the provided date and time.</dd><dt><b>Parameters</b></dt><dd><table><tr><td><i>lastUtcModifiedTime:&nbsp;</i></td><td>The UTC date and time that a dispatch was last modified.</td></tr></table></dd><dt><b>Returns</b></dt><dd><table><tr><td colspan='3'><i>Response Code:&nbsp;</i></td></tr><tr><td width='20'>&nbsp;</td><td><i>200 - </i></td><td>OK. Response will contain the list of dispatches.</td></tr><tr><td width='20'>&nbsp;</td><td><i>500 - </i></td><td>Internal Server Error.</td></tr></table></dd><dd><table><tr><td><i>Dispatches:&nbsp;</i></td><td>The list of dispatches if successful. Null (or Nothing) in case of exception.</td></tr></table></dd></wsdl:documentation>
<wsdl:input message="tns:ListDispatchesSoapIn" />
<wsdl:output message="tns:ListDispatchesSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="DispatchSoap" type="tns:DispatchSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetDispatch">
<soap:operation soapAction="http://vans.ljkco.com/webservices/suppliers/coachusa/dispatch/2011-01-01/GetDispatch" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="ListDispatches">
<soap:operation soapAction="http://vans.ljkco.com/webservices/suppliers/coachusa/dispatch/2011-01-01/ListDispatches" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="DispatchSoap12" type="tns:DispatchSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetDispatch">
<soap12:operation soapAction="http://vans.ljkco.com/webservices/suppliers/coachusa/dispatch/2011-01-01/GetDispatch" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="ListDispatches">
<soap12:operation soapAction="http://vans.ljkco.com/webservices/suppliers/coachusa/dispatch/2011-01-01/ListDispatches" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Dispatch">
<wsdl:port name="DispatchSoap" binding="tns:DispatchSoap">
<soap:address location="https://demo.ljkco.com/webservices/suppliers/coachusa/dispatch.asmx" />
</wsdl:port>
<wsdl:port name="DispatchSoap12" binding="tns:DispatchSoap12">
<soap12:address location="https://demo.ljkco.com/webservices/suppliers/coachusa/dispatch.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>