[dba-VB] SoapClient in VBscript

MartyConnelly martyconnelly at shaw.ca
Fri Jul 29 00:44:07 CDT 2005


You might take two approaches to check for errors.
1. Using Access and the webservice wizard, point it at your wsdl and 
create the class code
then move that to your vbscript.and call it.
2. use xmlhttp to fire your xml string at the wsdl and parse the 
returned xml.
  I have some basic code lying around to do this from VBA
3 Also check you have a valid wsdl file
There are a few few of these validator sites on the web
http://www.mgateway.com/scripts/mgwms32.dll?MGWLPN=EXTC&wlapp=wsdlValidator&eXtcCalledFrom=MGateway


Also for ASP I think it should be
which might be why it isn't finding the object

Dim oSOAP
Set oSOAPClient = Server.CreateObject("MSSOAP.So­apClient30")
oSOAPClient.ClientProperty("ServerHT­TPRequest") = True
... blah blah

Francisco Tapia wrote:

>I have a webservice which I will need to call fom a vbscript (in the end it 
>will be a sp_OA type call, but for this purpose it's a vbscript... I'm 
>looking at the wsdl file and I choose the "CreateOrder" method but I keep 
>getting invalid parameter settings for it... (WSDL file sample included), my 
>current example soap call looks like this:
>
>---Soap----
>Set SOAPClient = CreateObject("MSSOAP.SOAPClient30")
>SOAPClient.mssoapinit ("
>http://Sampleweb2:8085/AWDev/webservice/webserviceorder.asmx?wsdl")
>
>sxml = "<NewOrder> <Header> <CustID>FO100</CustID> 
><CompanyName>HFO-TEST</CompanyName> <UserType /> <UserNo>9002658</UserNo> 
><Address1>Div Of Test</Address1> <Address2>7858 Thorndike Rd</Address2> 
><Address3 /> <City>GreensBoro</City> <State>NC</State> <Zip>27409</Zip> 
><Country>United States</Country> <Contact>Test</Contact> 
><Phone>8055551234</Phone> <Notes>test</Notes> <ShipMethod>100</ShipMethod> 
><PurchaseOrder>TEST9999</PurchaseOrder> <ShipToID /> <SchedDate /> <Freight 
>/> </Header> <OrderItems> <WSOrderItem> <PartNumber>14-7068</PartNumber> 
><Quantity>15</Quantity> <SerialNumber>21222</SerialNumber> </WSOrderItem> 
></OrderItems> </NewOrder>"
>
>Result = SOAPClient.CreateOrder(sxml)
>
>---endSoap----
>
>I keep getting this error: Server was unable to process request --->Object 
>reference not set to an instance of an object, any ideas???
>
>-----------wsdl-----------------
>-
><wsdl:definitions targetNamespace="
>http://SampleService.org//WebServiceOrder">
>-
><wsdl:types>
>-
><s:schema elementFormDefault="qualified" targetNamespace="
>http://SampleService.org//WebServiceOrder">
>-
><s:element name="CreateOrder">
>-
><s:complexType>
>-
><s:sequence>
><s:element minOccurs="0" maxOccurs="1" name="NewOrder" type="tns:WSOrder"/>
></s:sequence>
></s:complexType>
></s:element>
>-
><s:complexType name="WSOrder">
>-
><s:sequence>
><s:element minOccurs="0" maxOccurs="1" name="Header" 
>type="tns:WSOrderHeader"/>
><s:element minOccurs="0" maxOccurs="1" name="OrderItems" 
>type="tns:ArrayOfWSOrderItem"/>
></s:sequence>
></s:complexType>
>-
><s:complexType name="WSOrderHeader">
>-
><s:sequence>
><s:element minOccurs="0" maxOccurs="1" name="CustID" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="CompanyName" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="UserType" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="UserNo" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="Address1" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="Address2" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="Address3" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="City" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="State" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="Zip" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="Country" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="Contact" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="Phone" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="Notes" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="ShipMethod" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="PurchaseOrder" 
>type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="ShipToID" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="SchedDate" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="Freight" type="s:string"/>
></s:sequence>
></s:complexType>
>-
><s:complexType name="ArrayOfWSOrderItem">
>-
><s:sequence>
><s:element minOccurs="0" maxOccurs="unbounded" name="WSOrderItem" 
>nillable="true" type="tns:WSOrderItem"/>
></s:sequence>
></s:complexType>
>-
><s:complexType name="WSOrderItem">
>-
><s:sequence>
><s:element minOccurs="0" maxOccurs="1" name="PartNumber" type="s:string"/>
><s:element minOccurs="1" maxOccurs="1" name="Quantity" type="s:int"/>
><s:element minOccurs="0" maxOccurs="1" name="SerialNumber" type="s:string"/>
></s:sequence>
></s:complexType>
>-
><s:element name="CreateOrderResponse">
>-
><s:complexType>
>-
><s:sequence>
><s:element minOccurs="0" maxOccurs="1" name="CreateOrderResult" 
>type="tns:CreateOrderResponse"/>
></s:sequence>
></s:complexType>
></s:element>
>-
><s:complexType name="CreateOrderResponse">
>-
><s:sequence>
><s:element minOccurs="0" maxOccurs="1" name="SalesOrder" type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="ProcessingError" 
>type="s:string"/>
><s:element minOccurs="0" maxOccurs="1" name="CommunicationError" 
>type="s:string"/>
></s:sequence>
></s:complexType>
></s:schema>
></wsdl:types>
>-
><wsdl:message name="CreateOrderSoapIn">
><wsdl:part name="parameters" element="tns:CreateOrder"/>
></wsdl:message>
>-
><wsdl:message name="CreateOrderSoapOut">
><wsdl:part name="parameters" element="tns:CreateOrderResponse"/>
></wsdl:message>
>-
><wsdl:portType name="WebServiceOrderSoap">
>-
><wsdl:operation name="CreateOrder">
><wsdl:input message="tns:CreateOrderSoapIn"/>
><wsdl:output message="tns:CreateOrderSoapOut"/>
></wsdl:operation>
></wsdl:portType>
><wsdl:portType name="WebServiceOrderHttpGet"/>
><wsdl:portType name="WebServiceOrderHttpPost"/>
>-
><wsdl:binding name="WebServiceOrderSoap" type="tns:WebServiceOrderSoap">
><soap:binding transport="http://schemas.xmlsoap.org/soap/http" 
>style="document"/>
>-
><wsdl:operation name="CreateOrder">
><soap:operation soapAction="
>http://SampleService.org//WebServiceOrder/CreateOrder" style="document"/>
>-
><wsdl:input>
><soap:body use="literal"/>
></wsdl:input>
>-
><wsdl:output>
><soap:body use="literal"/>
></wsdl:output>
></wsdl:operation>
></wsdl:binding>
>-
><wsdl:binding name="WebServiceOrderHttpGet" 
>type="tns:WebServiceOrderHttpGet">
><http:binding verb="GET"/>
></wsdl:binding>
>-
><wsdl:binding name="WebServiceOrderHttpPost" 
>type="tns:WebServiceOrderHttpPost">
><http:binding verb="POST"/>
></wsdl:binding>
>-
><wsdl:service name="WebServiceOrder">
><documentation/>
>-
><wsdl:port name="WebServiceOrderSoap" binding="tns:WebServiceOrderSoap">
><soap:address location="
>http://Sampleweb2:8085/Sample/webservice/webserviceorder.asmx"/>
></wsdl:port>
>-
><wsdl:port name="WebServiceOrderHttpGet" 
>binding="tns:WebServiceOrderHttpGet">
><http:address location="
>http://Sampleweb2:8085/Sample/webservice/webserviceorder.asmx"/>
></wsdl:port>
>-
><wsdl:port name="WebServiceOrderHttpPost" 
>binding="tns:WebServiceOrderHttpPost">
><http:address location="
>http://Sampleweb2:8085/Sample/webservice/webserviceorder.asmx"/>
></wsdl:port>
></wsdl:service>
></wsdl:definitions>
>
>----------end wsdl-----------
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada






More information about the dba-VB mailing list