我正在使用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 REQUEST:
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 ANSWER:
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>
知道为什么会这样吗?
祝你好运
答案 0 :(得分:0)
如果你有TCP / IP Monitor,你可以打开TCP / IP Monitor并检查响应是否有任何可能改变这个soap响应的特殊字符?