【问题标题】:WCF not sending some data typesWCF 不发送某些数据类型
【发布时间】:2012-03-14 23:52:47
【问题描述】:

我正在通过 WCF 调用 SAP PI Web 服务。

我导入服务引用,实例化数据对象并设置所有数据,这些类型都正确显示。

但是当我尝试在测试客户端中生成 SOAP 信封时,没有生成任何 INT 和 DATE 数据字段,因此,我没有发送任何这些数据类型。

这是我正在使用的 WSDL 示例:

<wsdl:definitions name="itfGRHU_Dados_Candidatos_Out_Sync" targetNamespace="http://www.xxx.com/Vagas_to_SAP/Envio_Dados_Candidatos" xmlns:p1="http://www.xxx.com/Vagas_to_SAP/Envio_Dados_Candidatos" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    <wsdl:documentation/>
    <wsdl:types>
        <xsd:complexType name="dtpGRHU_Dados_Candidatos_Campos">
            <xsd:annotation>
                <xsd:appinfo source="http://sap.com/xi/VersionID">5e84228c1f7111e1b60a0000125697d2</xsd:appinfo>
            </xsd:annotation>
            <xsd:sequence>
                <xsd:element name="IT4002_OBJID" minOccurs="0">
                    <xsd:annotation>
                        <xsd:appinfo source="http://sap.com/xi/TextID">643fdb0b1f5011e1c09c70f1a13bc69d</xsd:appinfo>
                        <xsd:documentation>Vaga</xsd:documentation>
                    </xsd:annotation>
                    <xsd:simpleType>
                        <xsd:restriction base="xsd:int">
                            <xsd:totalDigits value="8"/>
                        </xsd:restriction>
                    </xsd:simpleType>
                </xsd:element>
                <xsd:element name="IT0002_GBDAT" type="xsd:date" minOccurs="0">
                    <xsd:annotation>
                        <xsd:appinfo source="http://sap.com/xi/TextID">64402abe1f5011e1acf970f1a13bc69d</xsd:appinfo>
                        <xsd:documentation>Data de Nascimento</xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </wsdl:types>
</wsdl:definitions>

谢谢。

【问题讨论】:

  • 我记得 SAP 架构和 Biztalk 存在很大问题。每个字段都被标记为可选( minOccurs="0" )。尝试更改导入的 WSDL 上 IT4002_OBJID 和 IT0002_GBDAT 元素的基数,看看是否有影响
  • 您能否向我们展示您用于创建此请求的 C#(或 VB.NET)生成的类??
  • @RobertSlaney 这就是答案!谢谢!
  • 看看stackoverflow.com/questions/7263232/…是否适用,即使它是关于asmx的。
  • 是的,同样的问题,在代码中提出了解决方案,在 wsdl 中。 stackoverflow.com/questions/1184245/…

标签: wcf web-services soap wsdl


【解决方案1】:

按照@robertslaney 的建议,在导入的 WSDL 上更改基数 (minOccurs="0") 解决了这个问题。

【讨论】:

    猜你喜欢
    • 2020-11-22
    • 1970-01-01
    • 2015-02-21
    • 1970-01-01
    • 1970-01-01
    • 2016-10-17
    • 1970-01-01
    • 2014-08-06
    • 1970-01-01
    相关资源
    最近更新 更多