使用SOAP连接到服务器时出错

时间:2019-05-13 02:34:31

标签: java xml wsdl

我有一台启用了Web服务的服务器,以下是我期望的示例请求

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:sec="http://schemas.xmlsoap.org/ws/2002/04/secext" 
 xmlns:urn="urn:ebx-schemas:dataservices_1.0">
 <soapenv:Header>
  <sec:Security>
     <UsernameToken>
        <Username>****</Username>
        <Password>****</Password>
     </UsernameToken>
  </sec:Security>
  </soapenv:Header>
  <soapenv:Body>
  <urn:select_dietary>
     <branch>dspace-dfat-reference</branch>
     <instance>DFAT_Reference_Data</instance>
     <predicate>dietaryID=1</predicate>
  </urn:select_dietary>
  </soapenv:Body>
 </soapenv:Envelope>

当第三方尝试连接到我的服务器时,他们收到以下错误:

There was an error downloading 'http://*****/dataservices/connector /$metadata'. 
The request failed with HTTP status 404: .
Metadata contains a reference that cannot be resolved: 
'http://******/connector'.
The content type text/xml;charset=UTF-8 of the response message does not 
match the content type of the binding (application/soap+xml; charset=utf-8). 
If using a custom encoder, be sure that the IsContentTypeSupported method is 
implemented properly. The first 1024 bytes of the response were: '<SOAP- 
ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> 
<SOAP-ENV:Header/><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP- 
ENV:javax.xml.soap.SOAPException</faultcode> 
<faultstring>javax.xml.soap.SOAPException: InputStream does not represent a 
valid SOAP 1.1 Message</faultstring><faultactor>unknown</faultactor><detail> 
<m:StandardException xmlns:m="urn:ebx-schemas:dataservices_1.0"> 
<code>javax.xml.soap.SOAPException</code><label>InputStream does not 
represent a valid SOAP 1.1 Message</label> 
<description>java.lang.RuntimeException: javax.xml.soap.SOAPException: 
InputStream does not represent a valid SOAP 1.1 Message

有人可以帮助我吗?告诉我这是什么问题?

1 个答案:

答案 0 :(得分:0)

您对请求的响应的内容类型为“ text / xml; charset = UTF-8”,但是客户端期望的内容类型为“ application / soap + xml; charset = utf-8”。