Skip to Content
Sep 18, 2017 at 09:03 AM

Client found response content type of 'text/xml charset=utf-8' but expected 'text/xml' in SAP API

2019 Views Last edit Sep 19, 2017 at 05:48 AM 7 rev

Hi All,

i want to create WSDL URL in SAP for Remote enabled function module which needs to be use for both request/response from 3rd party client.

i have followed this tutorial Consume and create a Web Service ABAP, SOAMANAGER Transaction

i got everything at the end ,

this is my 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, which contains the exact XML data what i need,

the problem i am facing is when i try connect this url from my C#-Console application which hits Binding ULR http://host:port/sap/bc/srt/rfc/sap/z_web_service_definition/199/z_web_service_name/z_web_binding ,

when i check this URL in browser no XML is loading hence i am getting error in C# that

Web Exception as Client found response content type of 'text/xml; charset=utf-8', but expected 'text/xml'

anyone please help me to solve this or how exactly need to connect in C# application ?

C# Code :

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

example XML Code ,i cannot copy complete XML file since its too large.

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


<xsd:element name="ZmmBatchPutawayFromPhp">
<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" /> 


error.png (20.4 kB)
error1.png (26.9 kB)