Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Post SOAP command

Status
Not open for further replies.

SQLScholar

Programmer
Aug 21, 2002
2,127
GB
I have created a webservice using VS2005 and Asp.net.

When i host the website using Vs2005, i get the test page and via that - all works fine.

Now i have put it up on an IIS server, and it doesnt allow a test (only on developement machine) - but i would assume its working.

I have a vbs file that looks like this:

Code:
Dim serviceUrl
Dim TableHTML
dim SOAPParameters
Dim strUnListed
dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")

                
         
serviceUrl = "[URL unfurl="true"]http://bbwebtest/Service.asmx/NAQueue"[/URL]
Set oXmlHTTP = CreateObject("Microsoft.XMLHTTP")
oXmlHTTP.Open "POST", serviceUrl, False 


    oXmlHTTP.setRequestHeader "POST /Service.asmx" , "HTTP/1.1"
oXmlHTTP.setRequestHeader "Host:" ,"bbwebtest"
oXmlHTTP.setRequestHeader "Content-Type:" ,"text/xml; charset=utf-8"
oXmlHTTP.setRequestHeader "Content-Length:", "255"
oXmlHTTP.setRequestHeader "SOAPAction:" , "[URL unfurl="true"]http://bbwebtest/Service.asmx/NAQueue"[/URL]


    SOAPRequest = "<?xml version='1.0' encoding='utf-8'?>"
    SOAPRequest = SOAPRequest & "<soap:Envelope xmlns:xsi=""[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance""[/URL] xmlns:xsd=""[URL unfurl="true"]http://www.w3.org/2001/XMLSchema""[/URL] xmlns:soap=""[URL unfurl="true"]http://schemas.xmlsoap.org/soap/envelope/"">"[/URL]
    SOAPRequest = SOAPRequest & " <soap:Body>"
     SOAPRequest = SOAPRequest & "<NAQueue xmlns=""[URL unfurl="true"]http://bbwebtest/"">"[/URL]
      SOAPRequest = SOAPRequest &"<Computername>string</Computername>"
    SOAPRequest = SOAPRequest &"</NAQueue>"
            SOAPRequest = SOAPRequest & " </soap:Body>"
            SOAPRequest = SOAPRequest & " </soap:Envelope>"

oXmlHTTP.send SOAPRequest 
SOAPResponse = oXmlHTTP.responseXML.xml
MsgBox(SOAPResponse)

Which is supposed to invoke the function NAQueue and pass it a string (currently "string"). When it does this it is supposed to write some details to a database. The script has no error - the messagebox comes back blank. And the database isnt being written too.

From the website that it creates, it says that the post should look like this:

Code:
POST /Service.asmx HTTP/1.1
Host: bbwebtest
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "[URL unfurl="true"]http://bbwebtest/NAQueue"[/URL]

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance"[/URL] xmlns:xsd="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema"[/URL] xmlns:soap="[URL unfurl="true"]http://schemas.xmlsoap.org/soap/envelope/">[/URL]
  <soap:Body>
    <NAQueue xmlns="[URL unfurl="true"]http://bbwebtest/">[/URL]
      <Computername>string</Computername>
    </NAQueue>
  </soap:Body>
</soap:Envelope>

What am i doing wrong?

TIA

Dan

----------------------------------------
Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind - Dr. Seuss

Computer Science is no more about computers than astronomy is about telescopes - EW Dijkstra
----------------------------------------
 
Get it parsed and post the DOMDocument.
[tt]
set oxmldoc=createobject("msxml2.domdocument") 'or version dependent progid eventually
with oxmldoc
.async=false
.resolveexternals=true
.validateonparse=false
end with
bret=oxmldoc.loadxml(SOAPRequest)
if bret then
oXmlHTTP.send SOAPRequest
SOAPResponse = oXmlHTTP.responseXML.xml
MsgBox(SOAPResponse)
else
'ill-formed / parsing error
end if
[/tt]
 
tsuji,

Thanks for your help.

Now i have

Code:
Dim serviceUrl
Dim TableHTML
dim SOAPParameters
Dim strUnListed
dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")

                
         
serviceUrl = "[URL unfurl="true"]http://bbwebtest/Service.asmx/NAQueue"[/URL]
Set oXmlHTTP = CreateObject("Microsoft.XMLHTTP")
oXmlHTTP.Open "POST", serviceUrl, False 


    oXmlHTTP.setRequestHeader "POST /Service.asmx" , "HTTP/1.1"
oXmlHTTP.setRequestHeader "Host:" ,"bbwebtest"
oXmlHTTP.setRequestHeader "Content-Type:" ,"text/xml; charset=utf-8"
oXmlHTTP.setRequestHeader "Content-Length:", "255"
oXmlHTTP.setRequestHeader "SOAPAction:" , "[URL unfurl="true"]http://bbwebtest/Service.asmx/NAQueue"[/URL]


    SOAPRequest = "<?xml version='1.0' encoding='utf-8'?>"
    SOAPRequest = SOAPRequest & "<soap:Envelope xmlns:xsi=""[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance""[/URL] xmlns:xsd=""[URL unfurl="true"]http://www.w3.org/2001/XMLSchema""[/URL] xmlns:soap=""[URL unfurl="true"]http://schemas.xmlsoap.org/soap/envelope/"">"[/URL]
    SOAPRequest = SOAPRequest & " <soap:Body>"
     SOAPRequest = SOAPRequest & "<NAQueue xmlns=""[URL unfurl="true"]http://bbwebtest/"">"[/URL]
      SOAPRequest = SOAPRequest &"<Computername>string</Computername>"
    SOAPRequest = SOAPRequest &"</NAQueue>"
            SOAPRequest = SOAPRequest & " </soap:Body>"
            SOAPRequest = SOAPRequest & " </soap:Envelope>"

set oxmldoc=createobject("msxml2.domdocument")    'or version dependent progid eventually
with oxmldoc
    .async=false
    .resolveexternals=true
    .validateonparse=false
end with
bret=oxmldoc.loadxml(SOAPRequest)
if bret then
    oXmlHTTP.send SOAPRequest 
    SOAPResponse = oXmlHTTP.responseXML.xml
    MsgBox(SOAPResponse)
else
    'ill-formed / parsing error
end if

and all i still get back is a blank messagebox and no sign that the webservice has been triggered (it writes to a db).

Any ideas?

Dan

----------------------------------------
Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind - Dr. Seuss

Computer Science is no more about computers than astronomy is about telescopes - EW Dijkstra
----------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top