简体   繁体   中英

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

I am trying to consume a web service published by Enterprise One (JD Edwards) using .NET 4.0 and svcutil.exe. I cannot at this time change the WSDL.

In Visual Studio 2012 when I add a 'Service Reference' and point to the online WSDL, no errors are shown to me but the generated .cs file contains only a namespace, no classes. I have downloaded the WSDL and tried using svcutil.exe to generate client classes like so:

svcutil ServiceWSDL.wsdl

When I do this I receive the following error:

Error: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter Error: Referenced type ' http://schemas.xmlsoap.org/soap/encoding/:Array ' is only valid for encoded SOAP. XPath to Error Source: //wsdl:definitions[@targetNamespace='http://oracle.e1.bssv.JP550016]/wsdl:portType[@name='Oracle_E1_SBF_JWS_PkgBldFile_AccountMasterQueryPublished']

What I would like to know is if there is some way to use svcutil to generate a proxy that will function, or do I need to forego the use of a proxy and use HttpWebRequest to get the request sent?

Portion of WSDL causing error:

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

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

Try changing on the Portion of WSDL causing error:

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

For some reason worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM