客户端在SAP Web Service中找到了“text / xml charset = utf-8”的响应内容类型,但预期为“text / xml”

时间:2017-09-18 10:51:51

标签: c# rest wsdl sap

我想在启用SAP Remote的功能模块中创建WSDL URL,该模块需要用于第三方客户端的请求/响应。

我已按照本教程Consume and create a Web Service ABAP, SOAMANAGER Transaction

我最后得到了一切,

这是我的WSDL URL http://host:port/sap/bc/srt/wsdl/flv_10002A111AD1/srvc_url/sap/bc/srt/rfc/sap/z_web_service_definition/199/z_web_service_name/z_web_binding?sap-client=199,其中包含我需要的确切XML数据,

我面临的问题是,当我尝试从我的C#-Console应用程序连接此URL时,该应用程序达到绑定ULR http://host:port/sap/bc/srt/rfc/sap/z_web_service_definition/199/z_web_service_name/z_web_binding

当我在浏览器中检查此URL时,没有加载XML,因此我在C#中遇到错误

Web异常,因为客户端发现响应内容类型为'text / xml; charset = utf-8',但预计'text / xml'

       z_web_service_name service = new z_web_service_name();  // SAP Web Service
        ZmmBatchPutawayFromPhp data = new ZmmBatchPutawayFromPhp(); // SAP Funcion Module
        data.PBktxt = "Text";
        NetworkCredential cred = new NetworkCredential(); // Client credential
        cred.UserName = "XXXXX";
        cred.Password = "*****";
        cred.Domain = "host";
        service.Credentials = cred;
        service.Proxy = new WebProxy("host", port);
        service.Credentials = cred;
        ZmmBatchPutawayFromPhpResponse response = new ZmmBatchPutawayFromPhpResponse();
        response = service.ZmmBatchPutawayFromPhp(data); // connect to SAP
        Console.Write(response.ToString());

任何人都可以帮我解决这个问题,或者在C#应用程序中确切需要连接的方式?

z_web_service_name是我在SAP中创建的服务,ZmmBatchPutawayFromPhp是我在功能模块中创建的功能模块,在SOAMANAGER的帮助下,我在服务定义和绑定的帮助下创建了WSDL文件。

示例XML代码,我无法复制完整的XML文件,因为它太大了。

<wsdl:service name="z_web_service_name">
<wsdl:port name="z_web_binding" binding="tns:z_web_binding">
<soap:address location="http://PORT:8000/sap/bc/srt/rfc/sap/z_web_service_definition/199/z_web_service_name/z_web_binding" /> 
</wsdl:port>
<wsdl:port name="z_web_binding_soap12" binding="tns:z_web_binding_soap12">
<wsoap12:address location="http://PORT:8000/sap/bc/srt/rfc/sap/z_web_service_definition/199/z_web_service_name/z_web_binding" /> 
</wsdl:port>
</wsdl:service>

zmmBatchPutawayFromPhp

<xsd:element name="ZmmBatchPutawayFromPhp">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="PBktxt" type="n0:char25" minOccurs="0" /> 
<xsd:element name="PCharg" type="n0:char11" minOccurs="0" /> 
<xsd:element name="PIqain" type="n0:char1" minOccurs="0" /> 
<xsd:element name="PLgnum" type="n0:char3" minOccurs="0" /> 
<xsd:element name="PLgort" type="n0:char4" minOccurs="0" /> 
<xsd:element name="PLirtn" type="n0:char1" minOccurs="0" /> 
<xsd:element name="PMacid" type="n0:char30" minOccurs="0" /> 
<xsd:element name="PMatnr" type="n0:char18" minOccurs="0" /> 
<xsd:element name="PMblnr" type="n0:char12" minOccurs="0" /> 
<xsd:element name="PMenge" type="n0:char15" minOccurs="0" /> 
<xsd:element name="PNlpla" type="n0:char15" minOccurs="0" /> 
<xsd:element name="PNobox" type="n0:char10" minOccurs="0" /> 
<xsd:element name="PPdaid" type="n0:char20" minOccurs="0" /> 
<xsd:element name="PPsn" type="n0:char15" minOccurs="0" /> 
<xsd:element name="PUname" type="n0:char12" minOccurs="0" /> 
<xsd:element name="PWerks" type="n0:char4" minOccurs="0" /> 
<xsd:element name="TLog" type="tns:TableOfVife" minOccurs="0" /> 
</xsd:sequence>
</xsd:complexType>
</xsd:element>

绑定网址

Generated using SOAMANGER

0 个答案:

没有答案