Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Calling webservices from vb6

Posted on 2004-08-30
8
Medium Priority
?
1,819 Views
Last Modified: 2012-05-05
Hi,

I got an urgent request on connecting to webservices using vb6. Can anyone provide me "tested" and "workable" example on calling webservices. Shall i using SOAP Toolkit 3.0? I need more info on this.

How can i connect to one of the webservices below? thks

functionservice.asmx?WSDL :

<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://webservices.mydomain.com/function/1.0/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://webservices.mydomain.com/function/1.0/" xmlns="http://schemas.xmlsoap.org/wsdl/">
  <types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://webservices.mydomain.com/function/1.0/">
      <s:element name="Send">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="functionData" type="s0:Outbound" />
            <s:element minOccurs="0" maxOccurs="1" name="requestSettings" type="s0:RequestSettings" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="Outbound">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="CustomerID" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="ConfirmationURL" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="CSID" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Sender" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Sendername" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Header" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Subject" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Body" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="BodyContentType" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Resolution" type="s:string" />
          <s:element minOccurs="1" maxOccurs="1" name="TestMode" type="s:boolean" />
          <s:element minOccurs="0" maxOccurs="1" name="Recipients" type="s0:ArrayOfOutboundRecipient" />
          <s:element minOccurs="0" maxOccurs="1" name="Documents" type="s0:ArrayOfOutboundDocument" />
          <s:element minOccurs="0" maxOccurs="1" name="Date" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Retries" type="s:string" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="ArrayOfOutboundRecipient">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="unbounded" name="OutboundRecipient" nillable="true" type="s0:OutboundRecipient" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="OutboundRecipient">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="TransactionID" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Phone" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="ScheduleTime" type="s:string" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="ArrayOfOutboundDocument">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="unbounded" name="OutboundDocument" nillable="true" type="s0:OutboundDocument" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="OutboundDocument">
        <s:complexContent mixed="false">
          <s:extension base="s0:DocumentBase">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="TransferEncoding" type="s:string" />
            </s:sequence>
          </s:extension>
        </s:complexContent>
      </s:complexType>
      <s:complexType name="DocumentBase" abstract="true">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="FileData" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="ContentType" type="s:string" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="RequestSettings">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="DIMEDocuments" type="s0:DIMEDocuments" />
          <s:element minOccurs="0" maxOccurs="1" name="SecurityMode" type="s0:SecurityRequest" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="DIMEDocuments">
        <s:complexContent mixed="false">
          <s:extension base="s0:DIMEConfiguration">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="SecretKeys" type="s0:ArrayOfSecretKey" />
            </s:sequence>
          </s:extension>
        </s:complexContent>
      </s:complexType>
      <s:complexType name="DIMEConfiguration">
        <s:sequence>
          <s:element minOccurs="1" maxOccurs="1" name="Chunked" type="s:boolean" />
          <s:element minOccurs="1" maxOccurs="1" name="Encrypted" type="s:boolean" />
          <s:element minOccurs="0" maxOccurs="1" name="EncryptionType" type="s:string" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="SecurityRequest">
        <s:complexContent mixed="false">
          <s:extension base="s0:DIMEConfiguration">
            <s:sequence>
              <s:element minOccurs="1" maxOccurs="1" name="UseDIME" type="s:boolean" />
              <s:element minOccurs="1" maxOccurs="1" name="DigitallySigned" type="s:boolean" />
            </s:sequence>
          </s:extension>
        </s:complexContent>
      </s:complexType>
      <s:complexType name="ArrayOfSecretKey">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="unbounded" name="SecretKey" nillable="true" type="s0:SecretKey" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="SecretKey">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="Key" type="s:base64Binary" />
          <s:element minOccurs="0" maxOccurs="1" name="IV" type="s:base64Binary" />
        </s:sequence>
      </s:complexType>
      <s:element name="SendResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="SendResult" type="s0:ArrayOfString" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="ArrayOfString">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="s:string" />
        </s:sequence>
      </s:complexType>
      <s:element name="SendLite">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="customerID" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="phone" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="body" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="SendLiteResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="SendLiteResult" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetOutboundStatus">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="customerID" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="transactionIDs" type="s0:ArrayOfString" />
            <s:element minOccurs="0" maxOccurs="1" name="requestSettings" type="s0:RequestSettings" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetOutboundStatusResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="GetOutboundStatusResult" type="s0:ArrayOfRecipientStatus" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="ArrayOfRecipientStatus">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="unbounded" name="RecipientStatus" nillable="true" type="s0:RecipientStatus" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="RecipientStatus">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="Attemps" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="CSID" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="CallTime" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="TransactionID" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Charges" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Pages" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Phone" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Seconds" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Speed" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Status" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="ProviderTxId" type="s:string" />
        </s:sequence>
      </s:complexType>
      <s:element name="GetInbound">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="customerID" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="dnis" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="requestSettings" type="s0:RequestSettings" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetInboundResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="GetInboundResult" type="s0:Inbound" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="Inbound">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="CustomerID" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Document" type="s0:InboundDocument" />
          <s:element minOccurs="0" maxOccurs="1" name="DIMEDocument" type="s0:DIMEDocuments" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="InboundDocument">
        <s:complexContent mixed="false">
          <s:extension base="s0:DocumentBase">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="AccountingCode" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="DNIS" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="ANI" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="CSID" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="TransactionID" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="CallTime" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="Speed" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="Seconds" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="Pages" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="Cost" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="Status" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="SpamScore" type="s:string" />
            </s:sequence>
          </s:extension>
        </s:complexContent>
      </s:complexType>
      <s:element name="GetInboundList">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="customerID" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="dnis" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="requestSettings" type="s0:RequestSettings" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetInboundListResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="GetInboundListResult" type="s0:ArrayOfString" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetInboundByID">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="customerID" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="msgId" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="requestSettings" type="s0:RequestSettings" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetInboundByIDResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="GetInboundByIDResult" type="s0:Inbound" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="RemoveInboundByID">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="customerID" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="msgId" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="requestSettings" type="s0:RequestSettings" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="RemoveInboundByIDResponse">
        <s:complexType />
      </s:element>
      <s:element name="GetSupportedFileFormats">
        <s:complexType />
      </s:element>
      <s:element name="GetSupportedFileFormatsResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="GetSupportedFileFormatsResult" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetOutboundArchiveByID">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="customerID" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="transactionID" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="requestSettings" type="s0:RequestSettings" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetOutboundArchiveByIDResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="GetOutboundArchiveByIDResult" type="s0:ArchivedDocument" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="ArchivedDocument">
        <s:complexContent mixed="false">
          <s:extension base="s0:DocumentBase">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="DIMEDocument" type="s0:DIMEDocuments" />
            </s:sequence>
          </s:extension>
        </s:complexContent>
      </s:complexType>
    </s:schema>
  </types>
  <message name="SendSoapIn">
    <part name="parameters" element="s0:Send" />
  </message>
  <message name="SendSoapOut">
    <part name="parameters" element="s0:SendResponse" />
  </message>
  <message name="SendLiteSoapIn">
    <part name="parameters" element="s0:SendLite" />
  </message>
  <message name="SendLiteSoapOut">
    <part name="parameters" element="s0:SendLiteResponse" />
  </message>
  <message name="GetOutboundStatusSoapIn">
    <part name="parameters" element="s0:GetOutboundStatus" />
  </message>
  <message name="GetOutboundStatusSoapOut">
    <part name="parameters" element="s0:GetOutboundStatusResponse" />
  </message>
  <message name="GetInboundSoapIn">
    <part name="parameters" element="s0:GetInbound" />
  </message>
  <message name="GetInboundSoapOut">
    <part name="parameters" element="s0:GetInboundResponse" />
  </message>
  <message name="GetInboundListSoapIn">
    <part name="parameters" element="s0:GetInboundList" />
  </message>
  <message name="GetInboundListSoapOut">
    <part name="parameters" element="s0:GetInboundListResponse" />
  </message>
  <message name="GetInboundByIDSoapIn">
    <part name="parameters" element="s0:GetInboundByID" />
  </message>
  <message name="GetInboundByIDSoapOut">
    <part name="parameters" element="s0:GetInboundByIDResponse" />
  </message>
  <message name="RemoveInboundByIDSoapIn">
    <part name="parameters" element="s0:RemoveInboundByID" />
  </message>
  <message name="RemoveInboundByIDSoapOut">
    <part name="parameters" element="s0:RemoveInboundByIDResponse" />
  </message>
  <message name="GetSupportedFileFormatsSoapIn">
    <part name="parameters" element="s0:GetSupportedFileFormats" />
  </message>
  <message name="GetSupportedFileFormatsSoapOut">
    <part name="parameters" element="s0:GetSupportedFileFormatsResponse" />
  </message>
  <message name="GetOutboundArchiveByIDSoapIn">
    <part name="parameters" element="s0:GetOutboundArchiveByID" />
  </message>
  <message name="GetOutboundArchiveByIDSoapOut">
    <part name="parameters" element="s0:GetOutboundArchiveByIDResponse" />
  </message>
  <portType name="FunctionServiceSoap">
    <operation name="Send">
      <documentation>Submits a function to the system.</documentation>
      <input message="s0:SendSoapIn" />
      <output message="s0:SendSoapOut" />
    </operation>
    <operation name="SendLite">
      <documentation>Sends a plain text function to the phone specified.</documentation>
      <input message="s0:SendLiteSoapIn" />
      <output message="s0:SendLiteSoapOut" />
    </operation>
    <operation name="GetOutboundStatus">
      <documentation>Retrieves status information for the given outbound transaction IDs.</documentation>
      <input message="s0:GetOutboundStatusSoapIn" />
      <output message="s0:GetOutboundStatusSoapOut" />
    </operation>
    <operation name="GetInbound">
      <documentation>Receives and removes an inbound function from the system.</documentation>
      <input message="s0:GetInboundSoapIn" />
      <output message="s0:GetInboundSoapOut" />
    </operation>
    <operation name="GetInboundList">
      <documentation>Retrieves a list of pending inbound function IDs.</documentation>
      <input message="s0:GetInboundListSoapIn" />
      <output message="s0:GetInboundListSoapOut" />
    </operation>
    <operation name="GetInboundByID">
      <documentation>Downloads an inbound function by its ID.</documentation>
      <input message="s0:GetInboundByIDSoapIn" />
      <output message="s0:GetInboundByIDSoapOut" />
    </operation>
    <operation name="RemoveInboundByID">
      <documentation>Removes an inbound function from the system given its ID. Use GetInboundByID to download inbound functiones.</documentation>
      <input message="s0:RemoveInboundByIDSoapIn" />
      <output message="s0:RemoveInboundByIDSoapOut" />
    </operation>
    <operation name="GetSupportedFileFormats">
      <documentation>Retrieves a list of supported formats.</documentation>
      <input message="s0:GetSupportedFileFormatsSoapIn" />
      <output message="s0:GetSupportedFileFormatsSoapOut" />
    </operation>
    <operation name="GetOutboundArchiveByID">
      <documentation>Retrieves an outbound archived document from the system.</documentation>
      <input message="s0:GetOutboundArchiveByIDSoapIn" />
      <output message="s0:GetOutboundArchiveByIDSoapOut" />
    </operation>
  </portType>
  <binding name="FunctionServiceSoap" type="s0:FunctionServiceSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
    <operation name="Send">
      <soap:operation soapAction="http://webservices.mydomain.com/function/1.0/Send" style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
    <operation name="SendLite">
      <soap:operation soapAction="http://webservices.mydomain.com/function/1.0/SendLite" style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
    <operation name="GetOutboundStatus">
      <soap:operation soapAction="http://webservices.mydomain.com/function/1.0/GetOutboundStatus" style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
    <operation name="GetInbound">
      <soap:operation soapAction="http://webservices.mydomain.com/function/1.0/GetInbound" style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
    <operation name="GetInboundList">
      <soap:operation soapAction="http://webservices.mydomain.com/function/1.0/GetInboundList" style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
    <operation name="GetInboundByID">
      <soap:operation soapAction="http://webservices.mydomain.com/function/1.0/GetInboundByID" style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
    <operation name="RemoveInboundByID">
      <soap:operation soapAction="http://webservices.mydomain.com/function/1.0/RemoveInboundByID" style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
    <operation name="GetSupportedFileFormats">
      <soap:operation soapAction="http://webservices.mydomain.com/function/1.0/GetSupportedFileFormats" style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
    <operation name="GetOutboundArchiveByID">
      <soap:operation soapAction="http://webservices.mydomain.com/function/1.0/GetOutboundArchiveByID" style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
  </binding>
  <service name="FunctionService">
    <port name="FunctionServiceSoap" binding="s0:FunctionServiceSoap">
      <soap:address location="http://webservices.mydomain.com/function/1.0/functionservice.asmx" />
    </port>
  </service>
</definitions>
0
Comment
Question by:Ryan Chong
  • 7
8 Comments
 
LVL 54

Author Comment

by:Ryan Chong
ID: 11938796
Hi,

I done a test  as:

Option Explicit
Private soapclient As MSSOAPLib.soapclient

Private Sub Form_Load()
    Set soapclient = New MSSOAPLib.soapclient
     
    soapclient.mssoapinit "http://localhost/webservice1/service1.asmx?WSDL"
    soapclient.ConnectorProperty("EndPointURL") = "http://localhost/webservice1/service1.asmx"
   
    Dim tmp As String
   
    tmp = soapclient.HelloWorld("test hehe")
   
    Debug.Print tmp
   
End Sub

where the interface of HelloWorld web method is as:

...
<WebMethod()> Public Function HelloWorld(ByVal UserName As String) As String
        Return "Dear " + UserName + ", Now is " & Today.Now
    End Function
...

So how can i do the same for GetOutboundStatus web method on the functionservice.asmx posted above?

I still need an urgent solution here, thks
0
 
LVL 54

Author Comment

by:Ryan Chong
ID: 11939034
Here is a sample of SOAP request for GetOutboundStatus web method, how can i send this request using VB6 ?

POST /function/1.0/functionservice.asmx HTTP/1.1
Host: webservices.mydomain.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://webservices.mydomain.com/function/1.0/GetOutboundStatus"

<?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:Body>
    <GetOutboundStatus xmlns="http://webservices.mydomain.com/function/1.0/">
      <customerID>string</customerID>
      <password>string</password>
      <transactionIDs>
        <string>string</string>
        <string>string</string>
      </transactionIDs>
      <requestSettings>
        <DIMEDocuments>
          <SecretKeys>
            <SecretKey xsi:nil="true" />
            <SecretKey xsi:nil="true" />
          </SecretKeys>
        </DIMEDocuments>
        <SecurityMode>
          <UseDIME>boolean</UseDIME>
          <DigitallySigned>boolean</DigitallySigned>
        </SecurityMode>
      </requestSettings>
    </GetOutboundStatus>
  </soap:Body>
</soap:Envelope>
0
 
LVL 54

Author Comment

by:Ryan Chong
ID: 11939129
I got a Type Mismatch Error on the line, like:

tmp = soapclient.GetOutboundStatus("customerID", "password", tmpArr(), Null)

And when i debug the soapclient.detail it returns:

Client:Type conversion failure for element requestSettings  HRESULT=0x80020005

So, i suspect i'm stack on the 4th parameters passed to GetOutboundStatus, so can i know what should i passed in the 4th parameter there?

thks
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Accepted Solution

by:
aParser earned 1996 total points
ID: 11964055
It looks to me like the fourth parameter, requestSettings, is an optional parameter of a user-defined type.  Can you confirm this?

Have you tried leaving it off of the call, e.g.,
tmp = soapclient.GetOutboundStatus("customerID", "password", tmpArr())

If that doesn't work, have you tried passing vbNullString instead of Null?

Another option you have instead of using the SOAP Toolkit classes (i.e., MSSOAPLib.soapclient) is to use the MSXML2.xmlHttp class from the Microsoft XML library, copy the sample XML from the webservice's default page, and use HTTP POST directly yourself.  You'd probably want to load the XML from the default page into a XML DOM document and replace the placeholder values with real data.

Sub PostGetOutboundStatus()
  Dim xmlHttp As New MSXML2.xmlHttp
  Dim doc As New MSXML2.DOMDocument
  Dim strPostBody As String

  ' If you're not going to pass the requestSettings, I'd suggest just editing the string
  ' to elimiate everything between <requestSettings> and </requestSetttings>
  strPostBody = "<?xml version="1.0" encoding="utf-8"?><soap:Envelope ..."
  doc.loadXML strPostBody

  If doc.parseError.errorCode Then
' Do something with the error.
    Debug.Print doc.parseError.reason
    Exit Sub
  End If

  ' set the values you want
  doc.selectSingleNode("/soap:Envelope/soap:Body/GetOutboundStatus/customerID").text = "customerID"
  doc.selectSingleNode("/soap:Envelope/soap:Body/GetOutboundStatus/password").text = "password"

  ...

  xmlHttp.Open "POST", "http://localhost/webservice1/service1.asmx", False
  xmlHttp.setRequestHeader "Content-type", "text/xml"
  xmlHttp.setRequestHeader "SOAPAction", _
    "http://webservices.mydomain.com/function/1.0/GetOutboundStatus"
  xmlHttp.send doc

  Debug.Print xmlHttp.responseText

End Sub

To be clear, I'd only recommend this as a short-term, quick, down-and-dirty work-around to meet your urgent need.  In other words, just to get something that works.
0
 
LVL 54

Author Comment

by:Ryan Chong
ID: 11969826
Thanks aParser! I will test your suggestion and let you know the result ASAP, thks
0
 
LVL 54

Author Comment

by:Ryan Chong
ID: 11987060
Hi aParser, i tried like:

Sub PostGetOutboundStatus()
    Dim xmlHttp As New MSXML2.xmlHttp
    Dim doc As New MSXML2.DOMDocument
    Dim strPostBody As String
   
    ' If you're not going to pass the requestSettings, I'd suggest just editing the string
    ' to elimiate everything between <requestSettings> and </requestSetttings>
   
    'Read XML Request Template
    strPostBody = ReadFileText(getAppPath & "request.xml")
    doc.loadXML strPostBody
   
    If doc.parseError.errorCode Then
        ' Do something with the error.
        Debug.Print doc.parseError.reason
        Exit Sub
    End If
   
    Dim tmpArr(0) As String
    tmpArr(0) = "12345"
   
    ' set the values you want
    doc.selectSingleNode("/soap:Envelope/soap:Body/GetOutboundStatus/customerID").Text = "customerID"
    doc.selectSingleNode("/soap:Envelope/soap:Body/GetOutboundStatus/password").Text = "password"
    doc.selectSingleNode("/soap:Envelope/soap:Body/GetOutboundStatus/transactionIDs").Text = "12345"
    doc.selectSingleNode("/soap:Envelope/soap:Body/GetOutboundStatus/requestSettings/SecurityMode/UseDIME").Text = 1
    doc.selectSingleNode("/soap:Envelope/soap:Body/GetOutboundStatus/requestSettings/SecurityMode/DigitallySigned").Text = 1
     
    'Save XML Request
    doc.Save getAppPath & "sendtext.xml"
     
    xmlHttp.Open "POST", "http://webservices.junk.net/fax/1.0/faxservice.asmx", False
    xmlHttp.setRequestHeader "Content-type", "text/xml"
    xmlHttp.setRequestHeader "SOAPAction", "http://webservices.junk.net/fax/1.0/GetOutboundStatus"
    xmlHttp.send doc
   
    Debug.Print xmlHttp.responseText
     
    'Save XML Response
    WriteFileText getAppPath & "result.xml", xmlHttp.responseText, True
    DoEvents
   
    'Open the XML Response using Notepad
    StartDocWithNotePad getAppPath & "result.xml"
End Sub

then i got a Response like:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Client</faultcode>
      <faultstring>System.Web.Services.Protocols.SoapException: 5001
   at junk.WebServices.Fax.FaxService.GetOutboundStatus(String customerID, String password, String[] transactionIDs, RequestSettings requestSettings)</faultstring>
      <faultactor>http://webservices.junk.net/fax/1.0/faxservice.asmx</faultactor>
      <detail />
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

Seems that it's connected successfully to the web service, but it returns error 5001 : invalid parameter. Hmm, can help to diagnose where i was wrong?
0
 
LVL 54

Author Comment

by:Ryan Chong
ID: 11987062
the content of request.xml is as:

<?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:Body>
    <GetOutboundStatus xmlns="http://webservices.junk.net/fax/1.0/">
      <customerID>string</customerID>
      <password>string</password>
      <transactionIDs>
        <string>string</string>
        <string>string</string>
      </transactionIDs>
      <requestSettings>
        <DIMEDocuments>
          <SecretKeys>
            <SecretKey xsi:nil="true" />
            <SecretKey xsi:nil="true" />
          </SecretKeys>
        </DIMEDocuments>
        <SecurityMode>
          <UseDIME></UseDIME>
          <DigitallySigned></DigitallySigned>
        </SecurityMode>
      </requestSettings>
    </GetOutboundStatus>
  </soap:Body>
</soap:Envelope>

thks
0
 
LVL 54

Author Comment

by:Ryan Chong
ID: 11987695
Thks aParser, i get the xml response by using XMLHTTP Post method! Despite the result is not what i want, yet i can get the xml response text as i want ;-)

It open my eyes on how to resolve this kind of problem in another way round. Thks a lot for your effect to solve this problem.

cheers ;-)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question