magentosoapapiv2catalogProductInfo “Session expired. Try to relogin”错误

标签 magento soap soapui

我正在尝试通过 SoapUI 测试 magento Soap“catalogProductInfo”请求。

这是请求:

    <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Magento" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
       <soapenv:Header/>
       <soapenv:Body>
          <urn:catalogProductInfo soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
              <sessionId xsi:type="xsd:string"></sessionId>
              <productId xsi:type="xsd:string">31</productId>
              <attributes xsi:type="urn:catalogProductRequestAttributes">
                  <attributes xsi:type="urn:ArrayOfString" soapenc:arrayType="xsd:string[]">sku</attributes>
             </attributes>
         </urn:catalogProductInfo>
      </soapenv:Body>
   </soapenv:Envelope>

这是回复:

   <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
      <SOAP-ENV:Body>
        <SOAP-ENV:Fault>
           <faultcode>5</faultcode>
           <faultstring>Session expired. Try to relogin.</faultstring>
       </SOAP-ENV:Fault>
     </SOAP-ENV:Body>
  </SOAP-ENV:Envelope> 

从哪里获取 sessionId?

最佳答案

I solved it by running the login request:

   <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Magento">
     <soapenv:Header/>
       <soapenv:Body>
         <urn:login soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
           <username xsi:type="xsd:string">username</username>
           <apiKey xsi:type="xsd:string">apikey</apiKey>
         </urn:login>
       </soapenv:Body>
     </soapenv:Envelope>

then u get the sessionId in response:

    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
      <SOAP-ENV:Body>
        <ns1:loginResponse>
          <loginReturn xsi:type="xsd:string">2764d0d32d6206b3e77a4a07d28c11a4</loginReturn>
        </ns1:loginResponse>
     </SOAP-ENV:Body>
   </SOAP-ENV:Envelope>

关于magentosoapapiv2catalogProductInfo “Session expired. Try to relogin”错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34131922/

相关文章:

java - 配置 WSDD 以匹配 AXIS 中的 WSDL

spring - 端点 SWS 没有适配器

Java时区错误

magento - 从外部管理面板链接到 Magento Admin

python - 通过 SOAP v2 创建 Magento 产品

java - 使用 SOAP UI 而不是 REST-assured 来自动化 CI 的 REST 服务是否有优势

web-services - Groovy在Map之外的结构中捕获响应头

php - 通过 module.xml 文件的 Magento block 注入(inject)

php - 如何将 EAV 值传递给 Paypal 支付信息

magento - 如何在 Magento 中添加管理员用户属性