Skip to Content
avatar image
Former Member

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

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
        Console.Write(response.ToString());

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>
<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>
error.png (20.4 kB)
error1.png (26.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Sep 18, 2017 at 10:59 AM

    Could this be a parsing bug on the client side?

    A typical header would look like this:

    Content-Type: text/xml; charset=utf-8

    That's exactly what your client appears to be parsing into the content type variable. They would need to stop at the semicolon.

    Regards,

    Patrick

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Patrick Weber.

      My problem is Calculated Binding URL , please check the screen short which i updated , i have generated WSDL URL successfully in SOAMANAGER , i created web service in C# application when i try to connect to SAP which hits Calculated binding URL which has no data hence i am getting web exception as Web Exception as Client found response content type of 'text/xml; charset=utf-8', but expected 'text/xml' ,please check screen short.