【问题标题】:Problems with Visual Basic 6.0 and MagentoSoapVisual Basic 6.0 和 MagentoSoap 的问题
【发布时间】:2011-10-28 09:53:09
【问题描述】:

因为我一直在努力在 Visual Basic 6 中制作一个可以与 magento-Soap-Inferface “对话”的工具。

我正在使用以下版本: - 版本 1.5.0.0 中的 Magento - 适用于 Visual Basic 6 的 Microsoft Soap Tookit 3.0

像这里一样在 VB 中编码:

Private Sub Command1_Click()
  Dim paramstring As String
  Dim soapClient, sessionID
  Dim attributeSets() As returnData

  Set soapClient = CreateObject("MSSOAP.SoapClient30")   
  soapClient.MSSoapInit "http://localhost/magento/index.php/api/soap/?wsdl"
  sessionID = soapClient.login("dede", "1q2w3e4r5t6y7u")
  attributeSets = soapClient.call(sessionID, "product_attribute_set.list", 0)    
End Sub

我正在运行并出错

运行时错误'-2147467259(80004004) SoapMapper:找不到 SoapMapper Map 的目标命名空间为 http://xml.apache.org/xml-soap 的架构定义 HRESULT=0x80004005:未指定的错误 - Soap Mapper:无法在命名空间http://xml.apache.org/xml-soap 中为 Map 类型的数组元素创建映射器。 HRESULT=0x80004005:未指定的错误 - SoapMapper : 将数据恢复到 SoapMapper anyType 失败。

按照我的描述,只有当我返回 anyType 或 fixedArray 时才会出现问题。

请帮帮我。

【问题讨论】:

  • 从 VB6 调用 Web 服务的一种简单方法是在 .Net 中创建代理 COM 对象,将服务的功能公开为 COM 接口。这能解决你的问题吗?

标签: php web-services magento soap vb6


【解决方案1】:

这表示 xml 请求架构与预期不匹配。 不需要代理 com

这里是例子

添加对 Microsoft Xml 2.0 或更高版本的引用

检查那个方法

 Public Function PostRequest(urlService As String, soapAction As String, xmlRequest As String) As String

   Dim oHttReq  As XMLHTTPRequest
   Dim Log      As Logger
   Dim w        As w32
   Dim filepath As String
   Dim response As String

   Set oHttReq = New XMLHTTPRequest

   oHttReq.open "POST", urlService, False
   oHttReq.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
   oHttReq.setRequestHeader "SOAPAction", soapAction
   oHttReq.send xmlRequest       

   PostRequest = oHttReq.responseText

   If Not oHttReq Is Nothing Then
     Set oHttReq = Nothing
   End If       

 End Function

在 url 服务中放入 asmx 网络服务的 url: some how http://myserver/serviceinterface/serviceinterface.asmx

在soap action中,首先对你服务中的一些方法进行了修改,然后查看了定义。在那存在一个标签调用 SoapAction,一些如何 SOAPAction:“http://localhost/commonxmlschemas/technology/createcharge”(仅示例)

你也看到了肥皂请求

 POST /myserver/serviceinterface/serviceinterface.asmx HTTP/1.1
 Host: myserver
 Content-Type: text/xml; charset=utf-8
 Content-Length: length
 SOAPAction: "http://localhost/commonxmlschemas/technology/createcharge"

 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
     <RequestHeader xmlns="http://localhost/commonxmlschemas/technology/">
       <Headers>
         <anyType />
         <anyType />
       </Headers>
     </RequestHeader>
   </soap:Header>
   <soap:Body>
     <createcharge xmlns="http://localhost/commonxmlschemas/technology/">
       <chargeRequest xmlns="http://localhost/commonxmlschemas/technology/chargeRequest.xsd">
         <charge>
           <creditcard xmlns="http://localhost/commonxmlschemas/technology/Charge.xsd">string</creditcard>
           <amount xmlns="http://localhost/commonxmlschemas/technology/Charge.xsd">int</amount>
         </charge>
         <Tag>string</Tag>
       </chargeRequest>
     </createcharge>
   </soap:Body>
 </soap:Envelope>

复制自

  <?xml to </soap:Envelope> 

它是 xmlRequest 参数,现在只填充该 xmlRequest 上的参数并将其发送到 PostRequest 方法

简单,不是吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-27
    • 1970-01-01
    相关资源
    最近更新 更多