Solved

Calling Web Service: part 2

Posted on 2004-08-30
11
1,197 Views
Last Modified: 2010-05-18
Hi, As refer to http:Q_21111980.html

I got a web method as GetOutboundStatus, so how can i call it using the following info (probably using SOAP Toolkit 3.0)?

I got SOAP request as:

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>

And i got SOAP response as:

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?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>
    <GetOutboundStatusResponse xmlns="http://webservices.mydomain.com/function/1.0/">
      <GetOutboundStatusResult>
        <RecipientStatus>
          <Attemps>string</Attemps>
          <CSID>string</CSID>
          <CallTime>string</CallTime>
          <TransactionID>string</TransactionID>
          <Charges>string</Charges>
          <Pages>string</Pages>
          <Phone>string</Phone>
          <Seconds>string</Seconds>
          <Speed>string</Speed>
          <Status>string</Status>
          <ProviderTxId>string</ProviderTxId>
        </RecipientStatus>
        <RecipientStatus>
          <Attemps>string</Attemps>
          <CSID>string</CSID>
          <CallTime>string</CallTime>
          <TransactionID>string</TransactionID>
          <Charges>string</Charges>
          <Pages>string</Pages>
          <Phone>string</Phone>
          <Seconds>string</Seconds>
          <Speed>string</Speed>
          <Status>string</Status>
          <ProviderTxId>string</ProviderTxId>
        </RecipientStatus>
      </GetOutboundStatusResult>
    </GetOutboundStatusResponse>
  </soap:Body>
</soap:Envelope>

thks
0
Comment
Question by:Ryan Chong
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 50

Author Comment

by:Ryan Chong
ID: 11939215
What currently i have is:

Private soapclient As MSSOAPLib.soapclient

Private Sub Command1_Click()
    Set soapclient = New MSSOAPLib.soapclient
     
    soapclient.mssoapinit "http://webservices.junk.net/fax/1.0/faxservice.asmx?WSDL"
    soapclient.ConnectorProperty("EndPointURL") = "http://webservices.junk.net/fax/1.0/faxservice.asmx"
   
    Dim tmp As String
    Dim tmpArr(0) As String
   
    Dim retList As IXMLDOMNodeList
    Dim node As IXMLDOMNode

    tmpArr(0) = "123456789"
    Set retList = soapclient.GetOutboundStatus("customerID", "password", tmpArr(), Null)
   
    For Each node In retList
       MsgBox node.xml
    Next
   
End Sub

but failed with Type Mismatch Error on line:

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

and when i debug soapclient.detail, i got:
Client:Type conversion failure for element requestSettings  HRESULT=0x80020005

Can someone guide me where i was wrong?! Still need an urgent help, thks
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 11940879

Have you tried

Set retList = soapclient.GetOutboundStatus("customerID", "password", tmpArr(0), Null)


or

Set retList = soapclient.GetOutboundStatus("customerID", "password", tmpArr, Null)
0
 
LVL 50

Author Comment

by:Ryan Chong
ID: 11949963
Hi EDDYKT,

Same error as i tried out your suggestions above.. any other suggestion? Still need urgent help, thks
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 26

Expert Comment

by:EDDYKT
ID: 11951059
Sorry I don't know much about SOAP toolkit
0
 
LVL 3

Expert Comment

by:aParser
ID: 11964296
Per my comment under http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21111980.html

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())
0
 
LVL 50

Author Comment

by:Ryan Chong
ID: 11986845
>>Have you tried leaving it off of the call, e.g.,
tmp = soapclient.GetOutboundStatus("customerID", "password", tmpArr())

I got:
Invalid procedure call or argument

Problem still not resolve.. :(
0
 
LVL 3

Accepted Solution

by:
aParser earned 499 total points
ID: 11991071
A couple of things from your code on the other question ( http:Q_21111980 ):

First,
    doc.selectSingleNode("/soap:Envelope/soap:Body/GetOutboundStatus/transactionIDs").Text = "12345"

should be:
    doc.selectSingleNode("/soap:Envelope/soap:Body/GetOutboundStatus/transactionIDs/string").Text = "12345"

Second, in request.xml, get rid of the second "string" tag (if you're not going to use it)"
...
      <transactionIDs>
        <string>string</string>
        <string>string</string>
      </transactionIDs>
...

becomes
...
      <transactionIDs>
        <string>string</string>
      </transactionIDs>
...


You can loop through this code to add whatever extra TransactionIDs you need to:
    Dim oElement As IXMLDOMNode
...
' begin loop
    Set oElement = doc.createNode(NODE_ELEMENT, "string", "http://webservices.junk.net/fax/1.0/")
    oElement.Text = "23456" ' replace "23456" with whatever ID
    doc.selectSingleNode("/soap:Envelope/soap:Body/GetOutboundStatus/transactionIDs").appendChild oElement
' loop

Once I got to this point in testing, I got a [5005: Invalid credentials] error (since obviously I don't have real credentials with which to test).  Again, this should get you going.


For a longer-term solution that involves the SOAP Toolkit, look in the "User Guide" under SOAP Toolkit 3.0 | Advanced Sample Applications | Handling Complex Data Types | Using the Generic Type Mapper.
0
 
LVL 50

Author Comment

by:Ryan Chong
ID: 11993224
Thks aParser, thks for the useful info here, will try to complete my application development, and hopefully will close this question soon, thks again for your assistatnce here ;-)
0
 
LVL 3

Expert Comment

by:aParser
ID: 12015558
Any problems? Anything I can do to help?
0
 
LVL 50

Author Comment

by:Ryan Chong
ID: 12040665
Thks for the assistance, aParser. You help me a lot here! :-)
0
 

Expert Comment

by:torrid333
ID: 14682640
Is it still a good idea to use the MS SOAP toolkit?
I read something saying it was deprecated by .NET.

We use VB6 with no plans at the moment to switch to .NET.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Use Multiple Forms 4 57
VB6 code to programmatically convert pdf to excel 21 85
add text to end of existing text in file 16 70
SLMGR Switches Are Not Working On KMS Host 3 88
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now