簡體   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