为什么 Axis2 为“any”返回空值使用 wsdl2java 时复杂/序列结构中的类型?

发布于 2024-12-10 15:19:50 字数 21604 浏览 1 评论 0原文

我尝试使用 axis2 1.6(和 nightly 1.7)使用以下命令从 WSDL(本页最底部)生成 Java 代码:

$ 导出 JAVA_HOME=/usr/java/default
$ wsdl2java.sh -uri test.wsdl -d adb -u -S src/ -p mypackage --noBuildXML

这适用于一些输出的警告:

[警告] 没有用于导入 http://microsoft.com/wsdl/types/;编译可能会失败
[警告] 没有用于导入的 schemaLocation ;编译可能会失败
[警告] 类型时区丢失!
[警告] 类型 EnumeratedValue 缺失!
...

然后代码编译并运行良好,没有任何异常。但是,当我调用#ListDispatches()(或#GetDispatch())时,它将获得一个包含5个调度的数组,但每个调度中的所有数据都将具有空值,特别是#getIdentifier()、#getClient()、每次调度的 #getSupplier() 等将为 null。

我相信这与在架构中使用“任何”类型的 BaseModel(以及 EnumeratedValue 和 FlagValue)有关。该 WSDL 是由客户提供给我们的,因此我们希望采取阻力最小的路径。我们需要对 WSDL/等进行最少的更改是什么?让它发挥作用?原始 XML 中确实有值,使用此方法获取原始 XML 数据:

responseItem.getOMElement(Response.MY_QNAME,OMAbstractFactory.getOMFactory()).toStringWithConsume();

我尝试将“any”类型(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/">&lt;dd&gt;Returns a unique identifier for a dispatch by its authorization number.&lt;/dd&gt;&lt;dt&gt;&lt;b&gt;Parameters&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;i&gt;authNo:&amp;nbsp;&lt;/i&gt;&lt;/td&gt;&lt;td&gt;String representing the authorization number that is a human readable identifier&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/dd&gt;&lt;dt&gt;&lt;b&gt;Returns&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;&lt;table&gt;&lt;tr&gt;&lt;td colspan='3'&gt;&lt;i&gt;Response Code:&amp;nbsp;&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width='20'&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;i&gt;200 - &lt;/i&gt;&lt;/td&gt;&lt;td&gt;OK.  Response will contain the a unique identifier for the dispatch.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width='20'&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;i&gt;403 - &lt;/i&gt;&lt;/td&gt;&lt;td&gt;Forbidden.  Assigned to a different supplier or is unassigned.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width='20'&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;i&gt;404 - &lt;/i&gt;&lt;/td&gt;&lt;td&gt;Not Found.  Dispatch was not found.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width='20'&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;i&gt;500 - &lt;/i&gt;&lt;/td&gt;&lt;td&gt;Internal Server Error.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/dd&gt;&lt;dd&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;i&gt;DispatchId:&amp;nbsp;&lt;/i&gt;&lt;/td&gt;&lt;td&gt;The dispatch's unique identifier if successful.  An empty unique identifier (00000000-0000-0000-0000-000000000000) in case of exception.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/dd&gt;</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/">&lt;dd&gt;Returns a dispatch based on the dispatch's unique identifier or authorization number.&lt;/dd&gt;&lt;dt&gt;&lt;b&gt;Parameters&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;i&gt;id:&amp;nbsp;&lt;/i&gt;&lt;/td&gt;&lt;td&gt;The dispatch unique identifier&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;i&gt;authNo:&amp;nbsp;&lt;/i&gt;&lt;/td&gt;&lt;td&gt;String representing the authorization number that is a human readable identifier&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/dd&gt;&lt;dt&gt;&lt;b&gt;Returns&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;&lt;table&gt;&lt;tr&gt;&lt;td colspan='3'&gt;&lt;i&gt;Response Code:&amp;nbsp;&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width='20'&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;i&gt;200 - &lt;/i&gt;&lt;/td&gt;&lt;td&gt;OK.  Response will contain the dispatch.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width='20'&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;i&gt;403 - &lt;/i&gt;&lt;/td&gt;&lt;td&gt;Forbidden.  Assigned to a different supplier or is unassigned.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width='20'&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;i&gt;404 - &lt;/i&gt;&lt;/td&gt;&lt;td&gt;Not Found.  Dispatch was not found.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width='20'&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;i&gt;500 - &lt;/i&gt;&lt;/td&gt;&lt;td&gt;Internal Server Error.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/dd&gt;&lt;dd&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;i&gt;Dispatch:&amp;nbsp;&lt;/i&gt;&lt;/td&gt;&lt;td&gt;The associated dispatch if successful.  Null (or Nothing) in case of exception.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/dd&gt;</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/">&lt;dd&gt;Returns a list of active dispatches that have been modified since the provided date and time.&lt;/dd&gt;&lt;dt&gt;&lt;b&gt;Parameters&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;i&gt;lastUtcModifiedTime:&amp;nbsp;&lt;/i&gt;&lt;/td&gt;&lt;td&gt;The UTC date and time that a dispatch was last modified.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/dd&gt;&lt;dt&gt;&lt;b&gt;Returns&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;&lt;table&gt;&lt;tr&gt;&lt;td colspan='3'&gt;&lt;i&gt;Response Code:&amp;nbsp;&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width='20'&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;i&gt;200 - &lt;/i&gt;&lt;/td&gt;&lt;td&gt;OK.  Response will contain the list of dispatches.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width='20'&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;i&gt;500 - &lt;/i&gt;&lt;/td&gt;&lt;td&gt;Internal Server Error.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/dd&gt;&lt;dd&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;i&gt;Dispatches:&amp;nbsp;&lt;/i&gt;&lt;/td&gt;&lt;td&gt;The list of dispatches if successful.  Null (or Nothing) in case of exception.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/dd&gt;</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>

I tried using axis2 1.6 (and nightly 1.7) to generate Java code from the WSDL (very bottom of this page) using the following command:

$ export JAVA_HOME=/usr/java/default
$ wsdl2java.sh -uri test.wsdl -d adb -u -S src/ -p mypackage --noBuildXML

This works with some outputted warnings:

[WARN] No schemaLocation for import of http://microsoft.com/wsdl/types/; compilation may fail
[WARN] No schemaLocation for import of ; compilation may fail
[WARN] Type TimeZone missing!
[WARN] Type EnumeratedValue missing!
...

Then the code compiles and runs fine without any exceptions. However, when I call #ListDispatches() (or #GetDispatch()), it will get an array of 5 dispatches, but all of the data in each dispatch will have null values, specifically #getIdentifier(), #getClient(), #getSupplier(), etc. for each dispatch will be null.

I believe this has to do with the BaseModel (and EnumeratedValue and FlagValue) using "any" types in the schema. This WSDL was provided to us by the customer, so we would like to take the path of least resistance. What are the least amount of changes we would need to make to the WSDL/etc. to get this to work? The raw XML does have values in it, using this method to get the raw XML data:

responseItem.getOMElement(Response.MY_QNAME,OMAbstractFactory.getOMFactory()).toStringWithConsume();

I've tried changing the "any" types (3 lines) to be elements of types anyType/String and removing them completely -- but no dice. I've tried using xmlbeans instead of adb, but it just throws an exception about malformed attributes when I call wsdl2java. I've also tried passing -Eosv and -b to wsdl2java. Lastly, I've tried setting various options:

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");

Please help! Thanks!

test.wsdl (removed parts of file in order to make character cap):

<?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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乞讨 2024-12-17 15:19:50

最终,我最终只是让客户适当地更改他们的 WSDL 以删除“任何”类型,现在它可以工作了。

但是,我认为我可以使用 JAXB 数据绑定解决这个问题,因为我读到它具有“任何”类型的“最佳”实现,但因为已经有很多开发依赖于 ADB 数据绑定,所以我没有想要改变这一点。

Ultimately, I ended up just having the customer change their WSDL appropriately to remove the "any" types, and it now works.

However, I think I could have resolved this using the JAXB databinding as I've read it has the "best" implementation of "any" types, but because there was already a lot of development relying on the ADB databinding, I didn't want to change this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文