- Katılım
- 16 Eylül 2008
- Mesajlar
- 1,290
- Excel Vers. ve Dili
- Microsoft Office 2019 English
Merhabalar,
Aşağıdaki kod ile personellere ait verileri çekmek istiyorum. Fakat object hatası alıyorum. Nerede hata yapıyorum acaba.
Dim Req As Object
Dim sEnv As String
Dim Resp As New MSXML2.DOMDocument60
Set Req = CreateObject("MSXML2.XMLHTTP")
Set Resp = CreateObject("MSXML2.DOMDocument.6.0")
Req.Open "Post", "https://www......com", False
sEnv = sEnv & "<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope"">"
sEnv = sEnv & " <soapenv:Header/>"
sEnv = sEnv & " <soapenv:Body>"
sEnv = sEnv & " <Request>"
sEnv = sEnv & " <soap:username>test</soap:username>"
sEnv = sEnv & " <soap
assword>test</soap
assword>"
sEnv = sEnv & " <soap:sirkod>262</soap:sirkod>"
sEnv = sEnv & " </Request>"
sEnv = sEnv & " </soapenv:Body>"
sEnv = sEnv & "</soapenv:Envelope>"
' Send SOAP Request
Req.send (sEnv)
Resp.LoadXML Req.responseText
Range("B6").Value = Resp.SelectSingleNode("//PerMasResponse/PerMasResult").Text '
asmx?WSDL XML Kaynağı aşağıdaki gibidir.
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="PerMas">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="username" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="sirkod" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="PerMasResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="PerMasResult">
<s:complexType>
<s:sequence>
<s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax"/>
<s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax"/>
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="PerMasSoapIn">
<wsdl
art name="parameters" element="tns
erMas"/>
</wsdl:message>
<wsdl:message name="PerMasSoapOut">
<wsdl
art name="parameters" element="tns
erMasResponse"/>
</wsdl:message>
<wsdl
ortType name="PersonelWebserviceSoap">
<wsdl
peration name="PerMas">
<wsdl:input message="tns
erMasSoapIn"/>
<wsdl
utput message="tns
erMasSoapOut"/>
</wsdl
peration>
</wsdl
ortType>
<wsdl:binding name="PersonelWebserviceSoap" type="tns
ersonelWebserviceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl
peration name="PerMas">
<soap
peration soapAction="http://tempuri.org/PerMas" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl
utput>
<soap:body use="literal"/>
</wsdl
utput>
</wsdl
peration>
</wsdl:binding>
<wsdl:binding name="PersonelWebserviceSoap12" type="tns
ersonelWebserviceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl
peration name="PerMas">
<soap12
peration soapAction="http://tempuri.org/PerMas" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl
utput>
<soap12:body use="literal"/>
</wsdl
utput>
</wsdl
peration>
</wsdl:binding>
<wsdl:service name="PersonelWebservice">
<wsdl
ort name="PersonelWebserviceSoap" binding="tns
ersonelWebserviceSoap">
<soap:address location="https://wwww....com"/>
</wsdl
ort>
<wsdl
ort name="PersonelWebserviceSoap12" binding="tns
ersonelWebserviceSoap12">
<soap12:address location="ttps://wwww....com"/>
</wsdl
ort>
</wsdl:service>
</wsdl:definitions>
Set Req = Nothing
Set Resp = Nothing
Aşağıdaki kod ile personellere ait verileri çekmek istiyorum. Fakat object hatası alıyorum. Nerede hata yapıyorum acaba.
Dim Req As Object
Dim sEnv As String
Dim Resp As New MSXML2.DOMDocument60
Set Req = CreateObject("MSXML2.XMLHTTP")
Set Resp = CreateObject("MSXML2.DOMDocument.6.0")
Req.Open "Post", "https://www......com", False
sEnv = sEnv & "<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope"">"
sEnv = sEnv & " <soapenv:Header/>"
sEnv = sEnv & " <soapenv:Body>"
sEnv = sEnv & " <Request>"
sEnv = sEnv & " <soap:username>test</soap:username>"
sEnv = sEnv & " <soap
sEnv = sEnv & " <soap:sirkod>262</soap:sirkod>"
sEnv = sEnv & " </Request>"
sEnv = sEnv & " </soapenv:Body>"
sEnv = sEnv & "</soapenv:Envelope>"
' Send SOAP Request
Req.send (sEnv)
Resp.LoadXML Req.responseText
Range("B6").Value = Resp.SelectSingleNode("//PerMasResponse/PerMasResult").Text '
asmx?WSDL XML Kaynağı aşağıdaki gibidir.
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="PerMas">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="username" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="sirkod" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="PerMasResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="PerMasResult">
<s:complexType>
<s:sequence>
<s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax"/>
<s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax"/>
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="PerMasSoapIn">
<wsdl
</wsdl:message>
<wsdl:message name="PerMasSoapOut">
<wsdl
</wsdl:message>
<wsdl
<wsdl
<wsdl:input message="tns
<wsdl
</wsdl
</wsdl
<wsdl:binding name="PersonelWebserviceSoap" type="tns
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl
<soap
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl
<soap:body use="literal"/>
</wsdl
</wsdl
</wsdl:binding>
<wsdl:binding name="PersonelWebserviceSoap12" type="tns
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl
<soap12
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl
<soap12:body use="literal"/>
</wsdl
</wsdl
</wsdl:binding>
<wsdl:service name="PersonelWebservice">
<wsdl
<soap:address location="https://wwww....com"/>
</wsdl
<wsdl
<soap12:address location="ttps://wwww....com"/>
</wsdl
</wsdl:service>
</wsdl:definitions>
Set Req = Nothing
Set Resp = Nothing
