簡體   English   中英

SOAP服務:我有一個示例請求文件XML,但對格式感到困惑

[英]SOAP Service: I have a sample request file XML but getting confused about the format

我正在集成到運行Apache Axis的遠程服務中。 我得到了一個樣本請求文件,看起來像下面的樣子

<?xml version="1.0" encoding="UTF-8"?>
<request xmlns="http://api.somedomain.com/openSession" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="openSession.xsd">
    <session key="xabc123092"/>
    <user name="admin" password="secret"/>
</request>

我知道SOAP需要“信封和主體”,以便請求符合

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope 
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
       ....
    </soapenv:Body>
</soapenv:Envelope>

現在,我對提供給我的樣本請求文件感到困惑。 我嘗試使用請求標頭中的一些SOAPAction來制作以下SOAP請求,但無濟於事

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope 
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
       <soapenv:openSession>
         <session key="xabc123092"/>
         <user name="admin" password="secret"/>
      </soapenv:openSession>
    </soapenv:Body>
</soapenv:Envelope>

上面給出了以下內容

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope 
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <soapenv:Fault>
            <faultcode>soapenv:Server.userException</faultcode>
            <faultstring>org.xml.sax.SAXException: operation description is missing parameter description!</faultstring>
            <detail>
                <ns1:hostname 
                    xmlns:ns1="http://xml.apache.org/axis/">api.somedomain.com
                </ns1:hostname>
            </detail>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>

有人可以告訴我我在這里想念的嗎?

不知道您是否仍然面臨此問題。 它缺少request元素以及soap請求中的名稱空間。 請嘗試以下:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope 
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <request xmlns="http://api.somedomain.com/openSession" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="openSession.xsd">
            <session key="xabc123092"/>
            <user name="admin" password="secret"/>
        </request>
    </soapenv:Body>
</soapenv:Envelope>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM