SOAP 信封元素未声明
SOAP Envelope Element is not declared
我发送到外部 ASP Web 服务的 SOAP 请求有问题。我同时使用了 SoapUI 和 PHP 的 SoapClient
class,并且两次都出现了同样的问题 - 一个错误告诉我 The 'http://www.w3.org/2003/05/soap-envelope:Envelope' element is not declared.
我对'GetStudentEntitlement'的请求
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:adm="http://dest.gov.au/Heims/Admin/" xmlns:heim="http://dest.gov.au/Heims/">
<soap:Header/>
<soap:Body><adm:GetStudentEntitlement>
<heim:entitlementRequest>
<heim:RequestControlTable>
<heim:RequestId>CDD1E704-1298-4D42-AAD9-0031BB90329F</heim:RequestId>
<heim:ClientOrganisationCode>7591</heim:ClientOrganisationCode>
<heim:RequestLocalDateTime>2015-08-10T00:00:00</heim:RequestLocalDateTime>
</heim:RequestControlTable>
<heim:GetEntitlementIn>
<heim:RecordId>CDD1E704-1298-4D42-AAD9-0031BB90329F</heim:RecordId>
<heim:Chessn>1344</heim:Chessn>
<heim:FamilyName>Bassett</heim:FamilyName>
<heim:BirthDate>1988-05-21</heim:BirthDate>
</heim:GetEntitlementIn>
</heim:entitlementRequest>
</adm:GetStudentEntitlement>
</soap:Body>
</soap:Envelope>
回复:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>soap:Sender</soap:Value>
</soap:Code>
<soap:Reason>
<soap:Text xml:lang="en">Heims.WebServices.Extensions.Exceptions.XmlSchemaValidationException: Schema validation errors
at Heims.WebServices.Extensions.SoapFilterExtension.ValidateXmlMessage(SoapMessage message, WebMethodSettings methodSettings) in c:\Userdata\HEIMS.NET\Source\Development\WebService\Heims.WebService.Common\Extensions\SoapFilterExtension.cs:line 408
at Heims.WebServices.Extensions.SoapFilterExtension.ProcessMessageBeforeDeserialise(SoapMessage message) in c:\Userdata\HEIMS.NET\Source\Development\WebService\Heims.WebService.Common\Extensions\SoapFilterExtension.cs:line 200
at Heims.WebServices.Extensions.SoapFilterExtension.ProcessMessage(SoapMessage message) in c:\Userdata\HEIMS.NET\Source\Development\WebService\Heims.WebService.Common\Extensions\SoapFilterExtension.cs:line 173
at System.Web.Services.Protocols.SoapMessage.RunExtensions(SoapExtension[] extensions, Boolean throwOnException)
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()</soap:Text>
</soap:Reason>
<detail>
<ValidationError>
<RecordId/>
<Element>Envelope</Element>
<Line>1</Line>
<Column>2</Column>
<Description>The 'http://www.w3.org/2003/05/soap-envelope:Envelope' element is not declared.</Description>
</ValidationError>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
我尝试在 :soap
声明中添加和删除尾随的 /
,并尝试使用此网站提供的 1.1
和 1.2
SOAP 版本服务。
此端点请求 'Ping' 工作正常:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:adm="http://dest.gov.au/Heims/Admin/">
<soap:Header/>
<soap:Body>
<adm:Ping/>
</soap:Body>
</soap:Envelope>
结果如期返回:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<PingResponse xmlns="http://dest.gov.au/Heims/Admin/">
<PingResult>Heims web services pinged. DateTime = 2015-08-10 11:11:00:05</PingResult>
</PingResponse>
</soap:Body>
</soap:Envelope>
那么 为什么 一个请求 (ping) 的代码可以完美运行,而另一个请求 (GetStudentEntitlement) 却失败了?两者都有 soap:Envelope
声明,但 Ping 请求工作正常。
我也尝试在 soap:Envelope
元素中使用 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
,但错误仍然存在。
这是否可能是 Web 服务本身的服务器端问题?还是我的代码出了问题?
回答我自己的问题。
我直接联系了政府 IT 援助部门,让他们给我发了一个代码示例。他们使用了一种非常不寻常的修改形式的 <soap
包装器,迫使我使用 SimpleXMLElement
手动生成 XML 并使用包装好的 SoapVar
提交给 Web 服务XSD_ANYXML
类型。
你有没有解决这个问题...
我今天在将 UTL_DBWS 实用程序 (oracle plsql) 转换为 APEX 实用程序以调用 HEIMS Web 服务时遇到了同样的问题。
Ping 有效,但 GetStudentEntitlements 和 AllocateStudentChessn 都失败并出现相同的信封错误。
问候
RC
我发送到外部 ASP Web 服务的 SOAP 请求有问题。我同时使用了 SoapUI 和 PHP 的 SoapClient
class,并且两次都出现了同样的问题 - 一个错误告诉我 The 'http://www.w3.org/2003/05/soap-envelope:Envelope' element is not declared.
我对'GetStudentEntitlement'的请求
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:adm="http://dest.gov.au/Heims/Admin/" xmlns:heim="http://dest.gov.au/Heims/">
<soap:Header/>
<soap:Body><adm:GetStudentEntitlement>
<heim:entitlementRequest>
<heim:RequestControlTable>
<heim:RequestId>CDD1E704-1298-4D42-AAD9-0031BB90329F</heim:RequestId>
<heim:ClientOrganisationCode>7591</heim:ClientOrganisationCode>
<heim:RequestLocalDateTime>2015-08-10T00:00:00</heim:RequestLocalDateTime>
</heim:RequestControlTable>
<heim:GetEntitlementIn>
<heim:RecordId>CDD1E704-1298-4D42-AAD9-0031BB90329F</heim:RecordId>
<heim:Chessn>1344</heim:Chessn>
<heim:FamilyName>Bassett</heim:FamilyName>
<heim:BirthDate>1988-05-21</heim:BirthDate>
</heim:GetEntitlementIn>
</heim:entitlementRequest>
</adm:GetStudentEntitlement>
</soap:Body>
</soap:Envelope>
回复:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>soap:Sender</soap:Value>
</soap:Code>
<soap:Reason>
<soap:Text xml:lang="en">Heims.WebServices.Extensions.Exceptions.XmlSchemaValidationException: Schema validation errors
at Heims.WebServices.Extensions.SoapFilterExtension.ValidateXmlMessage(SoapMessage message, WebMethodSettings methodSettings) in c:\Userdata\HEIMS.NET\Source\Development\WebService\Heims.WebService.Common\Extensions\SoapFilterExtension.cs:line 408
at Heims.WebServices.Extensions.SoapFilterExtension.ProcessMessageBeforeDeserialise(SoapMessage message) in c:\Userdata\HEIMS.NET\Source\Development\WebService\Heims.WebService.Common\Extensions\SoapFilterExtension.cs:line 200
at Heims.WebServices.Extensions.SoapFilterExtension.ProcessMessage(SoapMessage message) in c:\Userdata\HEIMS.NET\Source\Development\WebService\Heims.WebService.Common\Extensions\SoapFilterExtension.cs:line 173
at System.Web.Services.Protocols.SoapMessage.RunExtensions(SoapExtension[] extensions, Boolean throwOnException)
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()</soap:Text>
</soap:Reason>
<detail>
<ValidationError>
<RecordId/>
<Element>Envelope</Element>
<Line>1</Line>
<Column>2</Column>
<Description>The 'http://www.w3.org/2003/05/soap-envelope:Envelope' element is not declared.</Description>
</ValidationError>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
我尝试在 :soap
声明中添加和删除尾随的 /
,并尝试使用此网站提供的 1.1
和 1.2
SOAP 版本服务。
此端点请求 'Ping' 工作正常:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:adm="http://dest.gov.au/Heims/Admin/">
<soap:Header/>
<soap:Body>
<adm:Ping/>
</soap:Body>
</soap:Envelope>
结果如期返回:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<PingResponse xmlns="http://dest.gov.au/Heims/Admin/">
<PingResult>Heims web services pinged. DateTime = 2015-08-10 11:11:00:05</PingResult>
</PingResponse>
</soap:Body>
</soap:Envelope>
那么 为什么 一个请求 (ping) 的代码可以完美运行,而另一个请求 (GetStudentEntitlement) 却失败了?两者都有 soap:Envelope
声明,但 Ping 请求工作正常。
我也尝试在 soap:Envelope
元素中使用 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
,但错误仍然存在。
这是否可能是 Web 服务本身的服务器端问题?还是我的代码出了问题?
回答我自己的问题。
我直接联系了政府 IT 援助部门,让他们给我发了一个代码示例。他们使用了一种非常不寻常的修改形式的 <soap
包装器,迫使我使用 SimpleXMLElement
手动生成 XML 并使用包装好的 SoapVar
提交给 Web 服务XSD_ANYXML
类型。
你有没有解决这个问题...
我今天在将 UTL_DBWS 实用程序 (oracle plsql) 转换为 APEX 实用程序以调用 HEIMS Web 服务时遇到了同样的问题。
Ping 有效,但 GetStudentEntitlements 和 AllocateStudentChessn 都失败并出现相同的信封错误。
问候 RC