- Katılım
- 16 Eylül 2008
- Mesajlar
- 1,134
- 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 & " <soapassword>test</soapassword>"
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">
<wsdlart name="parameters" element="tnserMas"/>
</wsdl:message>
<wsdl:message name="PerMasSoapOut">
<wsdlart name="parameters" element="tnserMasResponse"/>
</wsdl:message>
<wsdlortType name="PersonelWebserviceSoap">
<wsdlperation name="PerMas">
<wsdl:input message="tnserMasSoapIn"/>
<wsdlutput message="tnserMasSoapOut"/>
</wsdlperation>
</wsdlortType>
<wsdl:binding name="PersonelWebserviceSoap" type="tnsersonelWebserviceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdlperation name="PerMas">
<soapperation soapAction="http://tempuri.org/PerMas" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdlutput>
<soap:body use="literal"/>
</wsdlutput>
</wsdlperation>
</wsdl:binding>
<wsdl:binding name="PersonelWebserviceSoap12" type="tnsersonelWebserviceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdlperation name="PerMas">
<soap12peration soapAction="http://tempuri.org/PerMas" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdlutput>
<soap12:body use="literal"/>
</wsdlutput>
</wsdlperation>
</wsdl:binding>
<wsdl:service name="PersonelWebservice">
<wsdlort name="PersonelWebserviceSoap" binding="tnsersonelWebserviceSoap">
<soap:address location="https://wwww....com"/>
</wsdlort>
<wsdlort name="PersonelWebserviceSoap12" binding="tnsersonelWebserviceSoap12">
<soap12:address location="ttps://wwww....com"/>
</wsdlort>
</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 & " <soapassword>test</soapassword>"
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">
<wsdlart name="parameters" element="tnserMas"/>
</wsdl:message>
<wsdl:message name="PerMasSoapOut">
<wsdlart name="parameters" element="tnserMasResponse"/>
</wsdl:message>
<wsdlortType name="PersonelWebserviceSoap">
<wsdlperation name="PerMas">
<wsdl:input message="tnserMasSoapIn"/>
<wsdlutput message="tnserMasSoapOut"/>
</wsdlperation>
</wsdlortType>
<wsdl:binding name="PersonelWebserviceSoap" type="tnsersonelWebserviceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdlperation name="PerMas">
<soapperation soapAction="http://tempuri.org/PerMas" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdlutput>
<soap:body use="literal"/>
</wsdlutput>
</wsdlperation>
</wsdl:binding>
<wsdl:binding name="PersonelWebserviceSoap12" type="tnsersonelWebserviceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdlperation name="PerMas">
<soap12peration soapAction="http://tempuri.org/PerMas" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdlutput>
<soap12:body use="literal"/>
</wsdlutput>
</wsdlperation>
</wsdl:binding>
<wsdl:service name="PersonelWebservice">
<wsdlort name="PersonelWebserviceSoap" binding="tnsersonelWebserviceSoap">
<soap:address location="https://wwww....com"/>
</wsdlort>
<wsdlort name="PersonelWebserviceSoap12" binding="tnsersonelWebserviceSoap12">
<soap12:address location="ttps://wwww....com"/>
</wsdlort>
</wsdl:service>
</wsdl:definitions>
Set Req = Nothing
Set Resp = Nothing