簡體   English   中英

從C#/ WCF消耗Java服務-數組僅對編碼的SOAP有效

[英]Consuming Java service from C#/WCF - Array only valid for encoded SOAP

我正在嘗試使用.NET 4.0和svcutil.exe使用由Enterprise One(JD Edwards)發布的Web服務。 我目前無法更改WSDL。

在Visual Studio 2012中,當我添加“服務引用”並指向聯機WSDL時,沒有顯示任何錯誤,但生成的.cs文件僅包含名稱空間,沒有類。 我已經下載了WSDL,並嘗試使用svcutil.exe生成客戶端類,如下所示:

svcutil ServiceWSDL.wsdl

當我這樣做時,我收到以下錯誤:

錯誤:無法導入wsdl:portType詳細信息:運行WSDL導入擴展時拋出了異常:System.ServiceModel.Description.XmlSerializerMessageContractImporter錯誤:引用類型' http://schemas.xmlsoap.org/soap/encoding/:Array '是僅對編碼的SOAP有效。 錯誤的XPath來源://wsdl:definitions[@targetNamespace='http://oracle.e1.bssv.JP550016]/wsdl:portType[@name='Oracle_E1_SBF_JWS_PkgBldFile_AccountMasterQueryPublished']

我想知道的是,是否有某種方式可以使用svcutil生成將起作用的代理,還是我需要放棄使用代理並使用HttpWebRequest來獲取發送的請求?

導致錯誤的WSDL部分:

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="java:java.util" xmlns:WL5G3N0="http://schemas.xmlsoap.org/wsdl/" xmlns:WL5G3N1="http://oracle.e1.bssv.JP550016/" xmlns:WL5G3N2="java:oracle.e1.bssvfoundation.exception" xmlns:WL5G3N3="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
  <xs:complexType name="ArrayList">
    <xs:complexContent>
      <xs:restriction base="soapenc:Array" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"/>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>

整個WSDL:

<?xml version='1.0' encoding='UTF-8'?>
<WL5G3N2:definitions name="AccountMasterQueryPublishedDefinitions" targetNamespace="http://oracle.e1.bssv.JP550016/" xmlns="" xmlns:WL5G3N0="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:WL5G3N1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:WL5G3N2="http://schemas.xmlsoap.org/wsdl/" xmlns:WL5G3N3="http://oracle.e1.bssv.JP550016/" xmlns:WL5G3N4="java:oracle.e1.bssvfoundation.exception" xmlns:WL5G3N5="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
  <WL5G3N0:Policy WL5G3N1:Id="Wssp1.2-2007-Https-UsernameToken-Plain.xml">
    <sp:TransportBinding xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
      <wsp:Policy>
        <sp:TransportToken>
          <wsp:Policy>
            <sp:HttpsToken/>
          </wsp:Policy>
        </sp:TransportToken>
        <sp:AlgorithmSuite>
          <wsp:Policy>
            <sp:Basic256/>
          </wsp:Policy>
        </sp:AlgorithmSuite>
        <sp:Layout>
          <wsp:Policy>
            <sp:Lax/>
          </wsp:Policy>
        </sp:Layout>
        <sp:IncludeTimestamp/>
      </wsp:Policy>
    </sp:TransportBinding>
    <sp:SupportingTokens xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
      <wsp:Policy>
        <sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
          <wsp:Policy>
            <sp:WssUsernameToken10/>
          </wsp:Policy>
        </sp:UsernameToken>
      </wsp:Policy>
    </sp:SupportingTokens>
  </WL5G3N0:Policy>
  <wsp:UsingPolicy WL5G3N2:Required="true"/>
  <WL5G3N2:types>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="java:oracle.e1.bssvfoundation.base" xmlns:WL5G3N0="http://schemas.xmlsoap.org/wsdl/" xmlns:WL5G3N1="http://oracle.e1.bssv.JP550016/" xmlns:WL5G3N2="java:oracle.e1.bssvfoundation.exception" xmlns:WL5G3N3="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:complexType name="ValueObject"/>
    </xs:schema>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="java:java.util" xmlns:WL5G3N0="http://schemas.xmlsoap.org/wsdl/" xmlns:WL5G3N1="http://oracle.e1.bssv.JP550016/" xmlns:WL5G3N2="java:oracle.e1.bssvfoundation.exception" xmlns:WL5G3N3="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
      <xs:complexType name="ArrayList">
        <xs:complexContent>
          <xs:restriction base="soapenc:Array" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"/>
        </xs:complexContent>
      </xs:complexType>
    </xs:schema>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://oracle.e1.bssv.JP550016/" xmlns:WL5G3N0="http://schemas.xmlsoap.org/wsdl/" xmlns:WL5G3N1="http://oracle.e1.bssv.JP550016/" xmlns:WL5G3N2="java:oracle.e1.bssvfoundation.exception" xmlns:WL5G3N3="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:import namespace="java:oracle.e1.bssv.JP550016.valueobject"/>
      <xs:element name="accountMasterQueryElement" type="java:V0901G_pInbound" xmlns:java="java:oracle.e1.bssv.JP550016.valueobject"/>
      <xs:element name="accountMasterQueryResponseElement" type="java:V0901G_pOutbound" xmlns:java="java:oracle.e1.bssv.JP550016.valueobject"/>
    </xs:schema>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="java:oracle.e1.bssvfoundation.util" xmlns:WL5G3N0="http://schemas.xmlsoap.org/wsdl/" xmlns:WL5G3N1="http://oracle.e1.bssv.JP550016/" xmlns:WL5G3N2="java:oracle.e1.bssvfoundation.exception" xmlns:WL5G3N3="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:complexType name="E1MessageList">
        <xs:sequence>
          <xs:element maxOccurs="unbounded" minOccurs="0" name="E1Messages" nillable="true" type="java:E1Message" xmlns:java="java:oracle.e1.bssvfoundation.util"/>
        </xs:sequence>
      </xs:complexType>
      <xs:complexType name="E1Message">
        <xs:sequence>
          <xs:element minOccurs="1" name="MessagePrefix" nillable="true" type="xs:string"/>
          <xs:element minOccurs="1" name="Message" nillable="true" type="xs:string"/>
        </xs:sequence>
      </xs:complexType>
    </xs:schema>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="java:oracle.e1.bssvfoundation.exception" xmlns:WL5G3N0="http://schemas.xmlsoap.org/wsdl/" xmlns:WL5G3N1="http://oracle.e1.bssv.JP550016/" xmlns:WL5G3N2="java:oracle.e1.bssvfoundation.exception" xmlns:WL5G3N3="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:complexType name="BusinessServiceException">
        <xs:annotation>
          <xs:documentation>The base Exception class for Published Business Services. 
  All Published Business Service exceptions must extend from this class.</xs:documentation>
        </xs:annotation>
        <xs:sequence>
          <xs:element minOccurs="1" name="RequestID" nillable="true" type="xs:string">
            <xs:annotation>
              <xs:documentation>Public accessor methods are necessary for Web Services calls, but this method should not be 
 used by application development.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element minOccurs="1" name="Message" nillable="true" type="xs:string">
            <xs:annotation>
              <xs:documentation>Overrides getMessage from super class. Returns the exception message.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:complexType>
      <xs:element name="BusinessServiceException" type="java:BusinessServiceException" xmlns:java="java:oracle.e1.bssvfoundation.exception"/>
    </xs:schema>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="java:oracle.e1.bssv.JP550016.valueobject" xmlns:WL5G3N0="http://schemas.xmlsoap.org/wsdl/" xmlns:WL5G3N1="http://oracle.e1.bssv.JP550016/" xmlns:WL5G3N2="java:oracle.e1.bssvfoundation.exception" xmlns:WL5G3N3="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:import namespace="java:oracle.e1.bssvfoundation.base"/>
      <xs:import namespace="java:java.util"/>
      <xs:import namespace="java:oracle.e1.bssvfoundation.util"/>
      <xs:complexType name="V0901G_pOutbound">
        <xs:annotation>
          <xs:documentation>The outbound value object returns a list of accounts from the F0901</xs:documentation>
        </xs:annotation>
        <xs:complexContent>
          <xs:extension base="java:ValueObject" xmlns:java="java:oracle.e1.bssvfoundation.base">
            <xs:sequence>
              <xs:element minOccurs="1" name="CostCenter" nillable="true" type="xs:string"/>
              <xs:element minOccurs="1" name="AccountId" nillable="true" type="xs:string"/>
              <xs:element minOccurs="1" name="Company" nillable="true" type="xs:string"/>
              <xs:element minOccurs="1" name="ObjectAccount" nillable="true" type="xs:string"/>
              <xs:element minOccurs="1" name="Subsidiary" nillable="true" type="xs:string"/>
              <xs:element minOccurs="1" name="AccountDescription" nillable="true" type="xs:string"/>
              <xs:element minOccurs="1" name="LevelOfDetailAcctCde" nillable="true" type="xs:string"/>
              <xs:element minOccurs="1" name="PostingEdit" nillable="true" type="xs:string"/>
              <xs:element minOccurs="1" name="BusinessUnitName" nillable="true" type="xs:string"/>
              <xs:element minOccurs="1" name="CurrencyCodeFrom" nillable="true" type="xs:string"/>
              <xs:element minOccurs="1" name="E1MessageList" nillable="true" type="java1:E1MessageList" xmlns:java1="java:oracle.e1.bssvfoundation.util"/>
              <xs:element minOccurs="1" name="QueryResults" nillable="true" type="java1:ArrayList" xmlns:java1="java:java.util"/>
            </xs:sequence>
          </xs:extension>
        </xs:complexContent>
      </xs:complexType>
      <xs:complexType name="V0901G_pInbound">
        <xs:annotation>
          <xs:documentation>The inbound parameters to select a list of accounts.</xs:documentation>
        </xs:annotation>
        <xs:complexContent>
          <xs:extension base="java:ValueObject" xmlns:java="java:oracle.e1.bssvfoundation.base">
            <xs:sequence>
              <xs:element minOccurs="1" name="CostCenter" nillable="true" type="xs:string"/>
              <xs:element minOccurs="1" name="ObjectAccount" nillable="true" type="xs:string"/>
              <xs:element minOccurs="1" name="Subsidiary" nillable="true" type="xs:string"/>
              <xs:element minOccurs="1" name="HelmSwitch" nillable="true" type="xs:string"/>
            </xs:sequence>
          </xs:extension>
        </xs:complexContent>
      </xs:complexType>
    </xs:schema>
  </WL5G3N2:types>
  <WL5G3N2:message name="accountMasterQuery">
    <WL5G3N2:part element="WL5G3N3:accountMasterQueryElement" name="inputV0"/>
  </WL5G3N2:message>
  <WL5G3N2:message name="accountMasterQueryResponse">
    <WL5G3N2:part element="WL5G3N3:accountMasterQueryResponseElement" name="accountMasterQueryResponseElement"/>
  </WL5G3N2:message>
  <WL5G3N2:message name="BusinessServiceException">
    <WL5G3N2:part element="WL5G3N4:BusinessServiceException" name="BusinessServiceException"/>
  </WL5G3N2:message>
  <WL5G3N2:portType name="Oracle_E1_SBF_JWS_PkgBldFile_AccountMasterQueryPublished" wsp:PolicyURIs="#Wssp1.2-2007-Https-UsernameToken-Plain.xml">
    <WL5G3N2:operation name="accountMasterQuery" parameterOrder="inputV0">
      <WL5G3N2:input message="WL5G3N3:accountMasterQuery"/>
      <WL5G3N2:output message="WL5G3N3:accountMasterQueryResponse"/>
      <WL5G3N2:fault message="WL5G3N3:BusinessServiceException" name="BusinessServiceException"/>
    </WL5G3N2:operation>
  </WL5G3N2:portType>
  <WL5G3N2:binding name="AccountMasterQueryPublishedSoapBinding" type="WL5G3N3:Oracle_E1_SBF_JWS_PkgBldFile_AccountMasterQueryPublished">
    <WL5G3N5:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <WL5G3N2:operation name="accountMasterQuery">
      <WL5G3N5:operation soapAction="http://oracle.e1.bssv.JP550016//accountMasterQuery" style="document"/>
      <WL5G3N2:input>
        <WL5G3N5:body parts="inputV0" use="literal"/>
      </WL5G3N2:input>
      <WL5G3N2:output>
        <WL5G3N5:body parts="accountMasterQueryResponseElement" use="literal"/>
      </WL5G3N2:output>
      <WL5G3N2:fault name="BusinessServiceException">
        <WL5G3N5:fault name="BusinessServiceException" use="literal"/>
      </WL5G3N2:fault>
    </WL5G3N2:operation>
  </WL5G3N2:binding>
  <WL5G3N2:service name="AccountMasterQueryPublished">
    <WL5G3N2:port binding="WL5G3N3:AccountMasterQueryPublishedSoapBinding" name="AccountMasterQueryPublishedHttpPort">
      <WL5G3N5:address location="https://server/path/AccountMasterQueryPublished"/>
    </WL5G3N2:port>
  </WL5G3N2:service>
</WL5G3N2:definitions>

嘗試更改導致錯誤的WSDL部分:

<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/"/>

由於某種原因對我有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM