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

1.7k views Asked by At

I want to create WSDL URL in SAP Remote-enabled function module (RFC protocol) 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, which contains the exact XML data what I need: http://host:1111/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

The problem I am facing is when I try to connect to this URL from my C#-Console application which hits Binding URL http://host:1111/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#:

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

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());

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

z_web_service_name is a service which I created in SAP. ZmmBatchPutawayFromPhp is a function module which I created in function module, with the help of SOAMANAGER I have created WSDL file with help of service definition and binding.

Example XML code (I cannot copy complete XML file since it's 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>

Binding URL

Generated using SOAMANGER

0

There are 0 answers