我用 Delphi2010 导入 WSDL 文件,生成 Pas文件,在 D7中调用,然后调用成功,但是 函数的返回值 
和 我用 XMLSpy 调试返回的值不一样。
这个接口是IBM的人做的,他后来说是我 发送的 soap 请求的格式不一样,并 抓包给我。
我 现在不知道怎么办.
delphi里面 在那里 修改这个 soap请求的格式?
还有,soap的 格式应该是 统一的,为什么 发过去的格式就不一样?
之所以产出 这样的疑问,是因为 网上有 免费的 WebService,我用同样的 方法,调试就能通过,而且返回正确的结果。另外还有一个 问题,我在 delphi 2010 中 做了一个工程,用的代码 和 D7 下一样,但在 运行是 delphi2010竟然有错误。
大概意思是 验证没有通过。但同样的代码 在D7下 调用成功,只是IBM的人说我的 soap请求的格式不对.请各位高手 指点?

解决方案 »

  1.   

    我也是 第一次做这样的开发,也就看了 几天的时间,请各位指教。
    等于 现在 IBM的 就提供一个 WSDL 文件,里面有一个接口函数,
    理论上 我调用那个 接口函数,他们就能 收到 数据。还有 一个问题,大家可能会问 为什么要用 Delphi2010引入 WSDL?
    那是因为 D7 引入WSDL生产的 Pas文件,连编译都 通不过,有几个 类型 不定义
    而 Delphi2010 恰恰解决了这个 问题。
      

  2.   

    SOAP请求格式不对,检查一下编码,另外DELPHI 2010和DELPHI 7是不一样的,DELPHI 2010支持UNICODE,DELPHI 7不支持。
      

  3.   

    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions xmlns:p2="http://xinaogroup.com/ccs" xmlns:p1="http://xinaogroup.com/workflow" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="Z_O_MI_SCADA_ECC_091_MEASURE_INFO" targetNamespace="http://xinaogroup.com/workflow">
    <wsdl:types>
    <xsd:schema targetNamespace="http://xinaogroup.com/workflow" xmlns="http://xinaogroup.com/workflow" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="Z_MT_SCADA_ECC_091_MEASURE_INFO" type="Z_DT_SCADA_ECC_091_MEASURE_INFO"/>
    <xsd:element name="Z_MT_SCADA_ECC_091_MEAINFO_RESP" type="Z_DT_SCADA_ECC_091_MEAINFO_RESP"/>
    <xsd:complexType name="ExchangeLogData">
    <xsd:sequence>
    <xsd:element name="severity" type="xsd:string" minOccurs="0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
    <xsd:element name="text" type="xsd:string"/>
    <xsd:element name="url" type="xsd:string" minOccurs="0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
    <xsd:element name="id" type="xsd:string" minOccurs="0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="Z_DT_SCADA_ECC_091_MEAINFO_RESP">
    <xsd:annotation>
    <xsd:appinfo source="http://sap.com/xi/TextID">4c333980889e11dfcd45001125bdd6ca</xsd:appinfo>
    </xsd:annotation>
    <xsd:sequence>
    <xsd:element name="RC">
    <xsd:annotation>
    <xsd:appinfo source="http://sap.com/xi/TextID">cac42760889d11df98d70026c6b5e1e2</xsd:appinfo>
    <xsd:documentation xml:lang="ZH">返回码</xsd:documentation>
    </xsd:annotation>
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="1"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="TEXT">
    <xsd:annotation>
    <xsd:appinfo source="http://sap.com/xi/TextID">cac42761889d11dfc32a0026c6b5e1e2</xsd:appinfo>
    <xsd:documentation xml:lang="ZH">返回文本</xsd:documentation>
    </xsd:annotation>
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="40"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="ECPT_DATA" maxOccurs="unbounded">
    <xsd:annotation>
    <xsd:appinfo source="http://sap.com/xi/TextID">3323aab0889e11dfaf8c0026c6b5e1e2</xsd:appinfo>
    </xsd:annotation>
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="POINT">
    <xsd:annotation>
    <xsd:appinfo source="http://sap.com/xi/TextID">3323aab1889e11dfbba50026c6b5e1e2</xsd:appinfo>
    <xsd:documentation xml:lang="ZH">计量点</xsd:documentation>
    </xsd:annotation>
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="12"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="Z_DT_SCADA_ECC_091_MEASURE_INFO">
    <xsd:sequence>
    <xsd:element name="DATA" minOccurs="0" maxOccurs="unbounded" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:annotation>
    <xsd:appinfo source="http://sap.com/xi/TextID">ecd03cf0889c11df95c10026c6b5e1e2</xsd:appinfo>
    </xsd:annotation>
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="POINT">
    <xsd:annotation>
    <xsd:appinfo source="http://sap.com/xi/TextID">ecd03cf1889c11dfa9690026c6b5e1e2</xsd:appinfo>
    <xsd:documentation xml:lang="ZH">计量点</xsd:documentation>
    </xsd:annotation>
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="12"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="READC">
    <xsd:annotation>
    <xsd:appinfo source="http://sap.com/xi/TextID">012996b0889d11df881d0026c6b5e1e2</xsd:appinfo>
    <xsd:documentation xml:lang="ZH">计量读数</xsd:documentation>
    </xsd:annotation>
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="22"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="IDATE" type="xsd:date">
    <xsd:annotation>
    <xsd:appinfo source="http://sap.com/xi/TextID">35ba0270889d11dfbfcf0026c6b5e1e2</xsd:appinfo>
    <xsd:documentation xml:lang="ZH">测量日期</xsd:documentation>
    </xsd:annotation>
    </xsd:element>
    <xsd:element name="ITIME" type="xsd:time">
    <xsd:annotation>
    <xsd:appinfo source="http://sap.com/xi/TextID">35ba0271889d11df83e40026c6b5e1e2</xsd:appinfo>
    <xsd:documentation xml:lang="ZH">度量时间</xsd:documentation>
    </xsd:annotation>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="ExchangeFaultData">
    <xsd:sequence>
    <xsd:element name="faultText" type="xsd:string"/>
    <xsd:element name="faultUrl" type="xsd:string" minOccurs="0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
    <xsd:element name="faultDetail" type="ExchangeLogData" minOccurs="0" maxOccurs="unbounded" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    <xsd:schema targetNamespace="http://xinaogroup.com/ccs" xmlns:p0="http://xinaogroup.com/workflow" xmlns="http://xinaogroup.com/ccs" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:import namespace="http://xinaogroup.com/workflow"/>
    <xsd:element name="FaultMT">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="standard" type="p0:ExchangeFaultData"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    </wsdl:types>
    <wsdl:message name="Z_MT_SCADA_ECC_091_MEASURE_INFO">
    <wsdl:part name="Z_MT_SCADA_ECC_091_MEASURE_INFO" element="p1:Z_MT_SCADA_ECC_091_MEASURE_INFO" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
    </wsdl:message>
    <wsdl:message name="Z_MT_SCADA_ECC_091_MEAINFO_RESP">
    <wsdl:part name="Z_MT_SCADA_ECC_091_MEAINFO_RESP" element="p1:Z_MT_SCADA_ECC_091_MEAINFO_RESP" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
    </wsdl:message>
    <wsdl:message name="FaultMT">
    <wsdl:part name="FaultMT" element="p2:FaultMT" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
    </wsdl:message>
    <wsdl:portType name="Z_O_MI_SCADA_ECC_091_MEASURE_INFO">
    <wsdl:operation name="Z_O_MI_SCADA_ECC_091_MEASURE_INFO">
    <wsdl:input message="p1:Z_MT_SCADA_ECC_091_MEASURE_INFO"/>
    <wsdl:output message="p1:Z_MT_SCADA_ECC_091_MEAINFO_RESP"/>
    <wsdl:fault name="FaultMT" message="p1:FaultMT" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
    </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="Z_O_MI_SCADA_ECC_091_MEASURE_INFOBinding" type="p1:Z_O_MI_SCADA_ECC_091_MEASURE_INFO" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
    <wsdl:operation name="Z_O_MI_SCADA_ECC_091_MEASURE_INFO">
    <soap:operation soapAction="http://sap.com/xi/WebService/soap1.1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
    <wsdl:input>
    <soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
    </wsdl:input>
    <wsdl:output>
    <soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
    </wsdl:output>
    <wsdl:fault name="FaultMT">
    <soap:fault name="FaultMT" use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
    </wsdl:fault>
    </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="Z_O_MI_SCADA_ECC_091_MEASURE_INFOService">
    <wsdl:port name="Z_O_MI_SCADA_ECC_091_MEASURE_INFOPort" binding="p1:Z_O_MI_SCADA_ECC_091_MEASURE_INFOBinding" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    <soap:address location="http://ucnlfi135:50100/XISOAPAdapter/MessageServlet?channel=:BS_SCADA:Z_SOAP_SENDER_SCADA_ECC_091_MEASURE_INFO&amp;version=3.0&amp;Sender.Service=BS_SCADA&amp;Interface=http%3A%2F%2Fxinaogroup.com%2Fworkflow%5EZ_O_MI_SCADA_ECC_091_MEASURE_INFO" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>
    这个 是 对方提供的 WSDL文件
      

  4.   

    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?><!-- Adapter Call (Integration Engine, Idoc, RFC) --> <SOAP-ENV:Z_MT_SCADA_ECC_091_MEASURE_INFO xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><DATA xmlns='http://xinaogroup.com/workflow'><POINT>1581</POINT><READC>789.45</READC><IDATE>2010-07-20</IDATE><ITIME>09:27:51</ITIME></DATA></SOAP-ENV:Z_MT_SCADA_ECC_091_MEASURE_INFO>
    这个 是 他们抓到的 我程序发送的 数据格式。他们说 格式不对!
      

  5.   

    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?><!-- Adapter Call (Integration Engine, Idoc, RFC) --> <m:Z_MT_SCADA_ECC_091_MEASURE_INFO xmlns:m='http://xinaogroup.com/workflow' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/'>
    <DATA>
    <POINT>1581</POINT>
    <READC>45.45</READC>
    <IDATE>2010-08-13</IDATE>
    <ITIME>09:14:15</ITIME>
    </DATA>
    </m:Z_MT_SCADA_ECC_091_MEASURE_INFO>
    这是 他们提供的 正确的 请求格式!!