我是这样调用的,总是报错
Option Explicit
Private Const WSURL = "http://localhost:7001/DynaCall/DynaCall/DynaCall.wsdl"Private Sub Command1_Click()
Dim soapClient3
Set soapClient3 = CreateObject("MSSOAP.SoapClient30")
On Error Resume Next
Call soapClient3.MSSoapInit(WSURL, "", "")
If Err <> 0 Then
Text1.Text = Err.Description
End If
Text1.Text = soapClient3.myCall()
End SubSoapMapper:The schema definition with a targetnamespace of http://www.w3.org/1999/XMLSchema for SoapMapper string could not be found HRESULT=0x80004005: 未指定的错误
- SoapMapper:The SoapMapper for element string could not be created HRESULT=0x80004005: 未指定的错误
- WSDLOperation:Initialization of a SoapMapper for operation unifiedCall failed HRESULT=0x80004005: 未指定的错误
- WSDLOperation:Initializing of the input message failed for operation unifiedCall HRESULT=0x80004005: 未指定的错误
- WSDLPort:An operation for port DynaCallPort could not be initialized HRESULT=0x80004005: 未指定的错误
- WSDLPort:Analyzing the binding information for port DynaCallPort failed HRESULT=0x80004005: 未指定的错误
- WSDLService:Initialization of the port for service DynaCall failed HRESULT=0x80004005: 未指定的错误
- WSDLReader:Analyzing the WSDL file failed HRESULT=0x80004005: 未指定的错误
- Client:One of the parameters supplied is invalid. HRESULT=0x80070057: 参数错误。
我的WSDL文件如下: <?xml version="1.0" ?>
- <definitions targetNamespace="java:uninterface" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="java:uninterface">
- <types>
<schema targetNamespace="java:uninterface" xmlns="http://www.w3.org/1999/XMLSchema" />
</types>
- <message name="unifiedCallRequest">
<part name="arg0" type="xsd:string" />
</message>
- <message name="unifiedCallResponse">
<part name="return" type="xsd:string" />
</message>
- <portType name="DynaCallPortType">
- <operation name="unifiedCall">
<input message="tns:unifiedCallRequest" />
<output message="tns:unifiedCallResponse" />
</operation>
</portType>
- <binding name="DynaCallBinding" type="tns:DynaCallPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http/" />
- <operation name="unifiedCall">
<soap:operation soapAction="urn:unifiedCall" />
- <input>
<soap:body use="encoded" namespace="urn:DynaCall" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
- <output>
<soap:body use="encoded" namespace="urn:DynaCall" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
- <service name="DynaCall">
<documentation>todo</documentation>
- <port name="DynaCallPort" binding="tns:DynaCallBinding">
<soap:address location="http://127.0.0.1:7001/DynaCall/DynaCall" />
</port>
</service>
</definitions>
Option Explicit
Private Const WSURL = "http://localhost:7001/DynaCall/DynaCall/DynaCall.wsdl"Private Sub Command1_Click()
Dim soapClient3
Set soapClient3 = CreateObject("MSSOAP.SoapClient30")
On Error Resume Next
Call soapClient3.MSSoapInit(WSURL, "", "")
If Err <> 0 Then
Text1.Text = Err.Description
End If
Text1.Text = soapClient3.myCall()
End SubSoapMapper:The schema definition with a targetnamespace of http://www.w3.org/1999/XMLSchema for SoapMapper string could not be found HRESULT=0x80004005: 未指定的错误
- SoapMapper:The SoapMapper for element string could not be created HRESULT=0x80004005: 未指定的错误
- WSDLOperation:Initialization of a SoapMapper for operation unifiedCall failed HRESULT=0x80004005: 未指定的错误
- WSDLOperation:Initializing of the input message failed for operation unifiedCall HRESULT=0x80004005: 未指定的错误
- WSDLPort:An operation for port DynaCallPort could not be initialized HRESULT=0x80004005: 未指定的错误
- WSDLPort:Analyzing the binding information for port DynaCallPort failed HRESULT=0x80004005: 未指定的错误
- WSDLService:Initialization of the port for service DynaCall failed HRESULT=0x80004005: 未指定的错误
- WSDLReader:Analyzing the WSDL file failed HRESULT=0x80004005: 未指定的错误
- Client:One of the parameters supplied is invalid. HRESULT=0x80070057: 参数错误。
我的WSDL文件如下: <?xml version="1.0" ?>
- <definitions targetNamespace="java:uninterface" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="java:uninterface">
- <types>
<schema targetNamespace="java:uninterface" xmlns="http://www.w3.org/1999/XMLSchema" />
</types>
- <message name="unifiedCallRequest">
<part name="arg0" type="xsd:string" />
</message>
- <message name="unifiedCallResponse">
<part name="return" type="xsd:string" />
</message>
- <portType name="DynaCallPortType">
- <operation name="unifiedCall">
<input message="tns:unifiedCallRequest" />
<output message="tns:unifiedCallResponse" />
</operation>
</portType>
- <binding name="DynaCallBinding" type="tns:DynaCallPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http/" />
- <operation name="unifiedCall">
<soap:operation soapAction="urn:unifiedCall" />
- <input>
<soap:body use="encoded" namespace="urn:DynaCall" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
- <output>
<soap:body use="encoded" namespace="urn:DynaCall" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
- <service name="DynaCall">
<documentation>todo</documentation>
- <port name="DynaCallPort" binding="tns:DynaCallBinding">
<soap:address location="http://127.0.0.1:7001/DynaCall/DynaCall" />
</port>
</service>
</definitions>
给一段代码你。
Dim Serializer As SoapSerializer
Dim Reader As SoapReader
'Dim ResultElm As IXMLDOMElement
'Dim FaultElm As IXMLDOMElement
Dim Connector As SoapConnector Set Connector = New HttpConnector
Connector.Property("EndPointURL") = "http://czh.httech.com:9080/sjhtWeb/servlet/rpcrouter"
Connector.Connect Connector.Property("SoapAction") = "uri:getUserToDo"
Connector.BeginMessage Set Serializer = New SoapSerializer
Serializer.Init Connector.InputStream Serializer.startEnvelope
Serializer.SoapNamespace "xsd", "http://www.w3.org/1999/XMLSchema"
Serializer.SoapNamespace "xsi", "http://www.w3.org/1999/XMLSchema-instance"
Serializer.startBody
Serializer.startElement "getUserToDo", "http://tempuri.org/cn.com.info21.sjht.system.RemoteFunction" Serializer.startElement "userName"
Serializer.SoapAttribute "xsi:type", "", "xsd:string"
Serializer.writeString "admin"
Serializer.endElement
Serializer.startElement "userPass"
Serializer.SoapAttribute "xsi:type", "", "xsd:string"
Serializer.writeString "password"
Serializer.endElement Serializer.endElement
Serializer.endBody
Serializer.endEnvelope
Connector.EndMessage
Set Reader = New SoapReader
Reader.Load Connector.OutputStream If Not Reader.Fault Is Nothing Then
MsgBox "error:" + Reader.faultstring.Text, vbExclamation
Else
MsgBox (Reader.RPCResult.Text)
End If