0

我正在使用 Oracle Jdeveloper 开发基于 SOAP 的 Web 服务,但是我的行为很奇怪。当我发送请求时,响应是: SOAP 消息中存在错误,这意味着无法显示其结构。但是,如果我调查 HTTP 内容,响应是正确的,我所期望的:

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:dizResponse xmlns:ns2="http://ofelia/">
            <return>
                <ns2:POSI>
                    <RefreshInterval>0</RefreshInterval>
                    <Lon>53</Lon>
                    <Lat>14</Lat>
                </ns2:POSI>
            </return>
        </ns2:dizResponse>
    </S:Body>
</S:Envelope> 

验证的 xml 架构是:

<xs:schema version="1.0" targetNamespace="http://ofelia/" xmlns:tns="http://ofelia/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:element name="POSI">
    <xs:complexType>
      <xs:all>
        <xs:element name="TimeStamp" type="xs:string"/>
        <xs:element name="RefreshInterval" type="xs:int"/>
        <xs:element name="Lon" type="xs:int"/>
        <xs:element name="Lat" type="xs:int"/>
      </xs:all>
    </xs:complexType>
  </xs:element>
  <xs:element name="TESTE">
    <xs:complexType>
      <xs:all>
        <xs:element name="TimeStamp" type="xs:string"/>
        <xs:element name="cenas" type="xs:float" nillable="true"/>
      </xs:all>
    </xs:complexType>
  </xs:element>
 <xs:complexType name="dizResponse">
    <xs:sequence>
      <xs:element name="return" minOccurs="0">
        <xs:complexType mixed="true">
          <xs:sequence>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:element ref="tns:POSI"/>
              <xs:element ref="tns:TESTE"/>
            </xs:choice>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

HTTP 请求:

POST http://localhost:7101/ofelia/agrupaPort HTTP/1.1
SOAPAction: ""
Content-Type: text/xml; charset=UTF-8
Host: localhost:7101
Content-Length: 155
X-HTTPAnalyzer-Rules: 1@localhost:8099

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ofelias/">
    <env:Header/>
    <env:Body>
        <ns1:diz/>
    </env:Body>
</env:Envelope>

HTTP 答案:

HTTP/1.1 200 OK
Content-Type: text/xml;charset=UTF-8
X-Powered-By: Servlet/2.5 JSP/2.1
Date: Thu, 11 Jul 2013 10:30:23 GMT
X-ORACLE-DMS-ECID: 583c10bfdbd326ba:-2aaa5a0a:13fc957b02e:-8000-0000000000000441
Content-Length: 403
X-HTTPAnalyzer-RuleName: Pass through :

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:dizResponse xmlns:ns2="http://ofelias/">
            <return>
                <ns2:TESTE>
                    <cenas>1.0</cenas>
                    <TimeStamp>asdasdasd</TimeStamp>
                </ns2:TESTE>
                <ns2:POSI>
                    <RefreshInterval>5</RefreshInterval>
                    <Lon>53.0</Lon>
                    <Lat>14.0</Lat>
                    <TimeStamp>asdasdsa</TimeStamp>
                </ns2:POSI>
            </return>
        </ns2:dizResponse>
    </S:Body>
</S:Envelope>

知道为什么会这样吗?

此致

4

1 回答 1

0

Can you switch on TCP/IP Monitor if you have one and check if the response has any special character which could alter this soap response?

于 2013-07-10T16:51:19.220 回答