Visual Basic 6.0和MagentoSoap的问题 [英] Problems with Visual Basic 6.0 and MagentoSoap
问题描述
一段时间以来,我一直在使用Visual Basic 6制作一个可以与magento-Soap-Inferface对话"的工具.
since some time I am working to make a tool in in Visual Basic 6 which can ‘talk’ with the magento-Soap-Inferface.
我正在使用以下版本: -版本1.5.0.0中的Magento -用于Visual Basic 6的Microsoft Soap Tookit 3.0
I am using the following versions: - Magento in Version 1.5.0.0 - Microsoft Soap Tookit 3.0 for Visual Basic 6
在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
我正在运行并且出现错误
i running and error
运行时错误'-2147467259(80004004) SoapMapper:模式定义,目标名称空间为 http://xml.apache.org/xml-soap找不到SoapMapper映射库HRESULT = 0x80004005:未指定的错误 -肥皂映射器:无法在名称空间 http://xml.apache中为Map类型的数组元素创建映射器. org/xml-soap . HRESULT = 0x80004005:未指定的错误 -SoapMapper:将数据还原到SoapMapper anyType失败.
Run-time error '-2147467259(80004004) SoapMapper:The schema definision with a targetnamespace of http://xml.apache.org/xml-soap for SoapMapper Map cound not be found HRESULT=0x80004005:Unspecified error - Soap Mapper : can't create mapper for array element of type Map in namespace http://xml.apache.org/xml-soap. HRESULT=0x80004005:Unspecified error - SoapMapper : Restoring data into SoapMapper anyType Failed.
我已经描述过了,只有当我取回anyType或fixedArray时,问题才会出现.
How I have described, the problem comes only up when I get back anyType or fixedArray.
请帮助我.
推荐答案
这是说xml请求架构与预期的不匹配. 不需要代理com
This is saying the xml request schema does not match the expected. Proxy com is not necessary
此处为示例
添加对Microsoft Xml 2.0版或更高版本的引用
Add reference to Microsoft Xml, version 2.0 or higher
检查该方法
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 Web服务的url:一些 http://myserver/serviceinterface/serviceinterface.asmx
in url service put url of the asmx web service: some how http://myserver/serviceinterface/serviceinterface.asmx
首先对您服务中的某些方法进行了修订,然后再查看其定义.在该标签中存在一个名为SoapAction的标记,SOAPAction的标记如下:"http://localhost/commonxmlschemas/technology/createcharge"(仅示例)
in soap action first taked a revised to some method in you service and after see to the definition. In that exist a tag call SoapAction, some how SOAPAction: "http://localhost/commonxmlschemas/technology/createcharge" (only example)
您还看到了肥皂请求
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方法
it is the xmlRequest parameter now only fill the parameters on that xmlRequest and send it to the PostRequest Method
简单,不是吗?
这篇关于Visual Basic 6.0和MagentoSoap的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!