473,378 Members | 1,426 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

sending soap over http

i have a very simple web servive

Imports System.Web.Services

<System.Web.Services.WebService(Namespace:="urn:Ex ample1")> _

Public Class Example1

Inherits System.Web.Services.WebService


<WebMethod()> _

Public Function HelloWorld(ByVal name As String) As String

Return "Hello " & name

End Function

End Class

I have a VB Script with which I'm trying to send a soap message with. When
i execute i get to the input soap message message box showing me the
message, but when i click ok, it seems to hang. i have to kill the script
through taskmgr. this is on windows 2000.

Any ideas why it wouldn't return?

Dim x, h
Set x = CreateObject("MSXML2.DOMDocument")
x.loadXML "<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'><s:Body><m:sayHello
xmlns:m='urn:Example1'><name
xsi:type='xsd:string'>James</name></m:sayHello></s:Body></s:Envelope>"

msgbox x.xml, , "Input SOAP Message"
Set h = CreateObject("Microsoft.XMLHTTP")
h.open "POST", "http://localhost/HelloWorld/Service1.asmx"
h.send (x)
while h.readyState <> 4
wend
msgbox h.responseText,,"Output SOAP Message"

Nov 12 '05 #1
4 7837
Correction:

I had to change the word sayHello to Helloworld, since that is my method
name.

Dim x, h,r, s, t, u, v,z

Set x = CreateObject("MSXML2.DOMDocument")

s ="<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'"
t = " xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'"
u = " xmlns:xsd='http://www.w3.org/1999/XMLSchema'>"
v = " <s:Body><m:HelloWorld xmlns:m='urn:Example1'>"
r = " <name
xsi:type='xsd:string'>James</name></m:HelloWorld></s:Body></s:Envelope>"

z= s & t & u & v & r

x.loadXML z
msgbox x.xml, , "Input SOAP Message"
Set h = CreateObject("Microsoft.XMLHTTP")
h.open "POST", "http://localhost/HelloWorld/Service1.asmx"
h.send (x)
while h.readyState <> 4
wend
msgbox h.responseText,,"Output SOAP Message"
"Mark" <ma*********@acordia.com> wrote in message
news:ed**************@TK2MSFTNGP14.phx.gbl...
i have a very simple web servive

Imports System.Web.Services

<System.Web.Services.WebService(Namespace:="urn:Ex ample1")> _

Public Class Example1

Inherits System.Web.Services.WebService


<WebMethod()> _

Public Function HelloWorld(ByVal name As String) As String

Return "Hello " & name

End Function

End Class

I have a VB Script with which I'm trying to send a soap message with. When i execute i get to the input soap message message box showing me the
message, but when i click ok, it seems to hang. i have to kill the script
through taskmgr. this is on windows 2000.

Any ideas why it wouldn't return?

Dim x, h
Set x = CreateObject("MSXML2.DOMDocument")
x.loadXML "<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'><s:Body><m:sayHello
xmlns:m='urn:Example1'><name
xsi:type='xsd:string'>James</name></m:sayHello></s:Body></s:Envelope>"

msgbox x.xml, , "Input SOAP Message"
Set h = CreateObject("Microsoft.XMLHTTP")
h.open "POST", "http://localhost/HelloWorld/Service1.asmx"
h.send (x)
while h.readyState <> 4
wend
msgbox h.responseText,,"Output SOAP Message"

Nov 12 '05 #2
I'm getting close.. It appears something is wrong with my soap message
itself. I'm using the
HttpWebRequest and HttpWebResponse objects to send/receive this data.
Any help would be much appreciated.

-----------------------------------------------------------------
I have a string which contains the following data.

"<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
<s:Body><m:HelloWorld xmlns:m='urn:Example1'>
<name
xsi:type='xsd:string'>James</name></m:HelloWorld></s:Body></s:Envelope>"

-----------------------------------------------------------------
The web service i'm sending this to is

Imports System.Web.Services

<System.Web.Services.WebService(Namespace:="urn:Ex ample1")> _

Public Class Example1

Inherits System.Web.Services.WebService

<WebMethod()> _

Public Function HelloWorld(ByVal name As String) As String

Return "Hello " & name

End Function

End Class

-----------------------------------------------------------------
The error I'm getting is
<?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>Unable to handle request without a valid action
parameter. Please supply a valid soap action.</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>
Nov 12 '05 #3


Mark wrote:
It appears something is wrong with my soap message
itself. I'm using the
HttpWebRequest and HttpWebResponse objects to send/receive this data.
Why? If you are using .NET (as HttpWebRequest suggests) then simply
create a proxy class to use the web service, .NET has a tool called
wsdl.exe to do exactly that to avoid anyone having to deal with SOAP
itself (which is complex). The wsdl.exe tool reads the WSDL file
describing the web service and generates .NET source code for a proxy
class which you can compile and then include in your .NET project to
easily access the web service transparently calling methods on the proxy
without ever dealing with SOAP.

As for your earlier message that looked like you were using VBScript,
even there MS has a toolkit named SOAP toolkit that helps you with
accessing web services without the need to construct the raw SOAP from
hand. Look on http://msdn.microsoft.com/ for SOAP toolkit, download it
and check the examples on how to build a SOAP client with script.
The error I'm getting is
<?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>Unable to handle request without a valid action
parameter. Please supply a valid soap action.</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>


Well SOAP over HTTP needs a custom HTTP header named SOAPAction which
(untested and written from memory) needs to be alike

SOAPAction: urn:Example1/HelloWorld

for your web service so if you really want to use HttpWebRequest or
Msmxl2.XMLHTTP to access a web service then you need to make sure you
set that HTTP header (not SOAP header!) before sending your request.

But as said, there are tools with both COM based application (like VB or
VBScript or JScript) and .NET to free you from thinking about that
stuff, you simply call a method and get a result in the language of your
choice and the whole SOAP creation and parsing is done by the tools
reading the WSDL description of the web service.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 12 '05 #4
That is part of my problem and why I am lost.

I've been told by the folks that developed this web service that they are
not using WSDL.
I've used the soap toolkit in the past with VB 6.0 and it was very easy.

I was told i had to generate these "raw" soap message to send to this
service. I spoke with another person yesterday who sent data to this
service and they stated that they wrote out the xml doc line by line in code
and then sent it.

That is why i'm trying to understand how to write a soap message manually.

thank you for the suggestions.
"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl...


Mark wrote:
It appears something is wrong with my soap message
itself. I'm using the
HttpWebRequest and HttpWebResponse objects to send/receive this data.


Why? If you are using .NET (as HttpWebRequest suggests) then simply
create a proxy class to use the web service, .NET has a tool called
wsdl.exe to do exactly that to avoid anyone having to deal with SOAP
itself (which is complex). The wsdl.exe tool reads the WSDL file
describing the web service and generates .NET source code for a proxy
class which you can compile and then include in your .NET project to
easily access the web service transparently calling methods on the proxy
without ever dealing with SOAP.

As for your earlier message that looked like you were using VBScript,
even there MS has a toolkit named SOAP toolkit that helps you with
accessing web services without the need to construct the raw SOAP from
hand. Look on http://msdn.microsoft.com/ for SOAP toolkit, download it
and check the examples on how to build a SOAP client with script.
The error I'm getting is
<?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>Unable to handle request without a valid action
parameter. Please supply a valid soap action.</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>


Well SOAP over HTTP needs a custom HTTP header named SOAPAction which
(untested and written from memory) needs to be alike

SOAPAction: urn:Example1/HelloWorld

for your web service so if you really want to use HttpWebRequest or
Msmxl2.XMLHTTP to access a web service then you need to make sure you
set that HTTP header (not SOAP header!) before sending your request.

But as said, there are tools with both COM based application (like VB or
VBScript or JScript) and .NET to free you from thinking about that
stuff, you simply call a method and get a result in the language of your
choice and the whole SOAP creation and parsing is done by the tools
reading the WSDL description of the web service.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: mark kurten | last post by:
I have a soap message that looks like this. s = s & " <soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'" s = s & " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" s =...
2
by: Paul Hale | last post by:
I have a vb.net web service and client that are both working fine. If someone wanted to consume our web service using .NET, no problem. Im a little confused on how non .NET clients would use the...
3
by: Sydney | last post by:
Hi, I am trying to construct a WSE 2.0 security SOAP request in VBScript on an HTML page to send off to a webservice. I think I've almost got it but I'm having an issue generating the nonce...
1
by: tshad | last post by:
We have a web service that is not sending a field in the Soap Envelope. For example, when we add a web reference, we get something like: ***************************************************...
1
by: =?Utf-8?B?am1ncm8=?= | last post by:
I created a web service in visual studio 2003, tested it with a sample.xml file from a vendor we are using, and it worked exactly like it should. I deployed it to our server, created a project...
3
by: Joshua Beall | last post by:
Hi All, I've got the following PHP code: $service = new SoapClient("http://www.webservicex.net/length.asmx? wsdl"); $result = $service->ChangeLengthUnit(10,"Inches","Centimeters");...
3
by: ZAAN | last post by:
Hi, I'm developing an application in PHP5, which interacts with another system written in Delphi (of another company). I've prepared the Web Service - WSDL, Client and Server (only stub) side....
2
by: talk2jyotish | last post by:
I have to send a zip file whose name is MeFAttachment.zip as an attachment in SOAP 1.1 packet. But I get an error while submitting. Here is the error description Server Error 415 IDP...
0
by: vigneshrao | last post by:
Hi, I have been working on a script that loops through multiple records and sends data (one record per call) to a WS. I am supposed to make a new call for each record before sending the data....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.