繁体   English   中英

无法从第三方Web服务获得响应

[英]Not able to get response from a third party web service

我正在尝试使用QAS网络服务在英国进行邮政编码查询。 当我发布我的请求XML时,它说“服务器无法识别HTTP标头SOAPAction的价值:DoSearch”。

当我删除mMethod.setRequestHeader(“SOAPAction”,“/ DoSearch”)时; 从我的SOAPClient,然后收到的错误是无法处理请求没有有效的操作参数。 请提供有效的肥皂行动。

WSDL的链接是: https//ws.ondemand.qas.com/ProOnDemand/V3/ProOnDemandService.asmx? WSDL

我想promlem是我无法在标题中设置action参数,但我没有任何关于如何这样做的线索,我有点卡住了。 请帮忙。

我想发布的请求XML是:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:qas="http://www.qas.com/OnDemand_2011-03">
<soap:Header>
<qas:QAAuthentication>
<qas:Username>username</qas:Username>
<qas:Password>password</qas:Password>
</qas:QAAuthentication>
</soap:Header>
<soap:Body>
<QASearch RequestTag="Single Line postcode search"
xmlns:web="http://www.qas.com/OnDemand_2011_03">
<web:Country>GBR</web:Country>
<web:Engine Flatten="true ">Singleline</web:Engine>
<web:Layout>QADefault</web:Layout>
<web:Search>B168JR</web:Search>
</QASearch>
</soap:Body>
</soap:Envelope>

对不起,这太晚了,我刚刚看到你的问题 - 我当然希望你能够在此之前解决这个问题!

您是否使用自动化工具从WSDL创建该请求或手动创建它? 您的请求结构存在一些问题,如果我们更改应该允许请求。

要使其正常工作,您需要使用类似于以下的结构:

<soap:Envelope
       xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:qas="http://www.qas.com/OnDemand-2011-03">
<soap:Header>
<qas:QAQueryHeader>
    <qas:QAAuthentication>
        <qas:Username>username</qas:Username>
        <qas:Password>password</qas:Password>
    </qas:QAAuthentication>
</qas:QAQueryHeader>
</soap:Header>
<soap:Body>
    <qas:QASearch>
        <qas:Country>GBR</qas:Country>
        <qas:Engine Flatten="true ">Singleline</qas:Engine>
        <qas:Layout>QADefault</qas:Layout>
        <qas:Search>B168JR</qas:Search>
    </qas:QASearch>
</soap:Body>
</soap:Envelope>

我改变的事情很少。

  • qas:QAQueryHeader已添加到您的标题中。 这是QAS OnDemand服务所必需的。
  • 更正了您的命名空间(下划线到破折号):
    • 之前:xmlns:qas =“http://www.qas.com/OnDemand _ 2011-03”
    • 之后:xmlns:qas =“http://www.qas.com/OnDemand - 2011-03”
  • 删除了QASearch的额外命名空间导入,以简化和整理请求。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM