2015-07-28 3 views
0

У меня есть простой веб-службы, работающие на http://calculator.gear.host/Service1.svcgSOAP для WCF. Применение/мыло + XML; кодировка = UTF-8

У меня нет никаких проблем, в то время как зовите из WCF Test Client и есть ошибка при вызове из с клиентом gSOAP ++.

HTTP/1.1 415 Cannot process the message because the content type 'application/soap+xml; charset=utf-8; action="http://tempuri.org/IService1/GetData"' was not the expected type 'text/xml; charset=utf-8'. 

Пакеты на Fiddler:

WCF Test Client

Запрос

POST http://calculator.gear.host/Service1.svc HTTP/1.1 
    Content-Type: text/xml; charset=utf-8 
    SOAPAction: "http://tempuri.org/ICalculator/GetData" 
    Host: calculator.gear.host 
    Content-Length: 158 
    Expect: 100-continue 
    Accept-Encoding: gzip, deflate 
    Connection: Keep-Alive 

    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><GetData xmlns="http://tempuri.org/"><value>77</value></GetData></s:Body></s:Envelope> 

gSOAP

Запрос

POST http://calculator.gear.host/Service1.svc HTTP/1.1 
Host: calculator.gear.host 
User-Agent: gSOAP/2.8 
Content-Type: application/soap+xml; charset=utf-8; action="http://tempuri.org/IService1/GetData" 
Content-Length: 536 
Connection: close 
SOAPAction: "http://tempuri.org/IService1/GetData" 

<?xml version="1.0" encoding="UTF-8"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns4="http://schemas.datacontract.org/2004/07/WcfService2" xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns1:GetData><ns1:value>55</ns1:value></ns1:GetData></SOAP-ENV:Body></SOAP-ENV:Envelope> 

Ответ

HTTP/1.1 415 Cannot process the message because the content type 'application/soap+xml; charset=utf-8; action="http://tempuri.org/IService1/GetData"' was not the expected type 'text/xml; charset=utf-8'. 
Cache-Control: private 
Content-Length: 0 
Server: Microsoft-IIS/8.5 
X-AspNet-Version: 4.0.30319 
X-Powered-By: ASP.NET 
Set-Cookie: ARRAffinity=7ac8ab2e2023ddbeb7d4f86322b3ed25bc003394df0030ed244a6fc5c10ec47c;Path=/;Domain=calculator.gear.host 
Set-Cookie: WAWebSiteSID=9095f7410a074a959c2084564368b742; Path=/; HttpOnly 
Date: Tue, 28 Jul 2015 15:03:28 GMT 
Connection: close 

ответ

2

Я такая же проблема с сервисом не генерируемый gSOAP (вероятно, с помощью какой-то инструмент в C#). Для вашего клиента gSOAP перекомпилируйте файл WSDL (soapcpp2.exe) с помощью опции -1 (сгенерируйте привязки SOAP 1.1). Это работает для меня.