Why do I get Error Response not of type text/xml: text/html?

11,327

You might want to try sending an "Accept: text/xml" header to inform the server that you are expecting an XML response.

Share:
11,327
SirBT
Author by

SirBT

Updated on June 04, 2022

Comments

  • SirBT
    SirBT almost 2 years

    I am new to using SOAP to communicate with Web Services, I recently wrote a client in php to communicate with a Web Service but get this error message back:

    "Error Response not of type text/xml: text/html"

    Is there something wrong with the format I send away? Please find the request below:

    Request
    
    POST /MobileCashPayout.asmx HTTP/1.0
    Host: www.mtn.com
    User-Agent: NuSOAP/0.9.5 (1.123)
    Content-Type: text/xml; charset=ISO-8859-1
    SOAPAction: ""
    Content-Length: 971
    
    <?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 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" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns5667:Payout xmlns:ns5667="http://tempuri.org"><__numeric_0 xsi:type="xsd:string">testmerc</__numeric_0><__numeric_1 xsi:type="xsd:string">testmerc</__numeric_1><__numeric_2 xsi:type="xsd:string">256750000005</__numeric_2><__numeric_3 xsi:type="xsd:string">256753986532</__numeric_3><__numeric_4 xsi:type="xsd:string">256750000005</__numeric_4><__numeric_5 xsi:type="xsd:string">100.00</__numeric_5><__numeric_6 xsi:type="xsd:string">2222</__numeric_6><__numeric_7 xsi:type="xsd:string"></__numeric_7><__numeric_8 xsi:type="xsd:string">BETNET</__numeric_8></ns5667:Payout></SOAP-ENV:Body></SOAP-ENV:Envelope>
    
  • SirBT
    SirBT almost 12 years
    how do I do that? Can you demonstrate please?
  • Mike Brant
    Mike Brant almost 12 years
    So I see you are using NuSOAP. Take a look at this StackOverflow item stackoverflow.com/questions/945922/… Here there is an answer which hints that the SOAP protocol version you are using might be the problem the suggestion is to pass a config parameter at instantiation to use SOAP protocol 1.1 as most modern SOAP server client would expect to use content type of application/soap+xml. You might try using the native PHP SOAP implementation for better results.
  • SirBT
    SirBT almost 12 years
    It seems like my Client only expects content type of text/xml, not of text/html nor applicatoin/soap+xml. So the suggestion to accept application/soap+xml unfortunately didnt seem to work... Any other suggestions are welcome