By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,364 Members | 1,278 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,364 IT Pros & Developers. It's quick & easy.

Consume web service using HTTP

P: n/a
Howdy,

I wrote a web service in .Net for my customer. My customer has another
vendor who now has to consume it but they are not using Visual Studio. Most
of their pages are jsp, and they said they need to consume this web service
using HTTP. The developer's IDE is Notepad. Yeah, weird I know.

How is this done? I guess if I can get it to run ASP, IDE independant, that
should make them happy. Any references you can point me to?

Thanks!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com


Jan 16 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a

this can be done... it took me a while to figure it out but its not all that
bad.
first, in the web.config you need a section:
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
which enables http get and post operations to the service. then you can use
an http form like:
<form target="zero" action='servicename.asmx/servicefunction'
method="post">
with a normal 'submit' button to send the data to the service. the one ugly
part i had to work around was the returned xml, i ended up sending it to a
hidden frame just because i didn't want it anyway. there are probably
better ways to use the returned data if you call it with javascript or
vbscript.
"David Lozzi" <Da********@nospam.nospam> wrote in message
news:uL**************@TK2MSFTNGP11.phx.gbl...
Howdy,

I wrote a web service in .Net for my customer. My customer has another
vendor who now has to consume it but they are not using Visual Studio.
Most of their pages are jsp, and they said they need to consume this web
service using HTTP. The developer's IDE is Notepad. Yeah, weird I know.

How is this done? I guess if I can get it to run ASP, IDE independant,
that should make them happy. Any references you can point me to?

Thanks!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com

Jan 16 '06 #2

P: n/a
This is what I have so far in my classic asp page

Dim objSrvHTTP
Dim objXMLSend
Dim objXMLReceive
set objSrvHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
set objXMLSend = Server.CreateObject("MSXML2.DOMDocument")
set objXMLReceive = Server.CreateObject("MSXML2.DOMDocument")

objXMLSend.async = false
objXMLSend.loadXML "<OrderDetails
xmlns='http://www.domain.com'><orderno>123456</orderno></OrderDetails>"

objSrvHTTP.open
"POST","http://localhost/prgnrt/orderstatus.asmx/OrderDetails",false
objSrvHTTP.send objXMLSend
objXMLReceive = objSrvHTTP.responseText
Response.ContentType = "text/xml"
Response.Write(objSrvHTTP.responseText)
and I get this error:

Request format is invalid: text/xml.
The web service details are:

HTTP POST
The following is a sample HTTP POST request and response. The placeholders
shown need to be replaced with actual values.

POST /prgnrt/orderstatus.asmx/OrderDetails HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
Content-Length: length

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

<?xml version="1.0"?>
xmlThanks!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com

"David Lozzi" <Da********@nospam.nospam> wrote in message
news:uL**************@TK2MSFTNGP11.phx.gbl...
Howdy,

I wrote a web service in .Net for my customer. My customer has another
vendor who now has to consume it but they are not using Visual Studio.
Most of their pages are jsp, and they said they need to consume this web
service using HTTP. The developer's IDE is Notepad. Yeah, weird I know.

How is this done? I guess if I can get it to run ASP, IDE independant,
that should make them happy. Any references you can point me to?

Thanks!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com

Jan 16 '06 #3

P: n/a
Hi David,

Welcome to MSDN newsgroup.
As for the calling webservice in JSP application, I think you'd consider
the following options:

1. If you're calling the webservice through JSP's serverside code(java
code), I think you have to lookup some JAVA specific webservice sdk which
can help create webservice proxy classes which simplified webservice
consuming... Elsewise, you have to use the java specific http request
component to manually send SOAP XML http request to the .net webservice
.....

2. If you're calling the webservice through webpage's clientside script
code, using the XML HTTP component as you mentioned should be ok.

Based on the code you provided, you directly send the following XML as SOAP
messageto target .net webservcie:

"<OrderDetails
xmlns='http://www.domain.com'><orderno>123456</orderno></OrderDetails>"

This is not correct since SOAP webservcie message should include the
complete SOAP envelope which contains soap headers(optional) and soap boday
(required).... To determine the correct XML soap message you should
send, I suggest you use some TCP or HTTP trace tools to trace the soap
message ( you can consuming the webservcie through .net client app first
to capture such SOAP message). And the Trace Utility in SOAP toolkit 3.0
is a good http trace tools:

#SOAP Toolkit 3.0
http://www.microsoft.com/downloads/d...0DD-CEEC-4088-
9753-86F052EC8450&displaylang=en

When you has captured the soap message , you can define a XML template file
or string that you can use to easily build a SOAP request message....

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
From: "David Lozzi" <Da********@nospam.nospam>
References: <uL**************@TK2MSFTNGP11.phx.gbl>
Subject: Re: Consume web service using HTTP
Date: Mon, 16 Jan 2006 17:03:47 -0500
Lines: 75
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
Message-ID: <#J**************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
microsoft.public.dotnet.framework.webservices:1337 3
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

This is what I have so far in my classic asp page

Dim objSrvHTTP
Dim objXMLSend
Dim objXMLReceive
set objSrvHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
set objXMLSend = Server.CreateObject("MSXML2.DOMDocument")
set objXMLReceive = Server.CreateObject("MSXML2.DOMDocument")

objXMLSend.async = false
objXMLSend.loadXML "<OrderDetails
xmlns='http://www.domain.com'><orderno>123456</orderno></OrderDetails>"

objSrvHTTP.open
"POST","http://localhost/prgnrt/orderstatus.asmx/OrderDetails",false
objSrvHTTP.send objXMLSend
objXMLReceive = objSrvHTTP.responseText
Response.ContentType = "text/xml"
Response.Write(objSrvHTTP.responseText)
and I get this error:

Request format is invalid: text/xml.
The web service details are:

HTTP POST
The following is a sample HTTP POST request and response. The placeholders
shown need to be replaced with actual values.

POST /prgnrt/orderstatus.asmx/OrderDetails HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
Content-Length: length

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

<?xml version="1.0"?>
xmlThanks!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com

"David Lozzi" <Da********@nospam.nospam> wrote in message
news:uL**************@TK2MSFTNGP11.phx.gbl...
Howdy,

I wrote a web service in .Net for my customer. My customer has another
vendor who now has to consume it but they are not using Visual Studio.
Most of their pages are jsp, and they said they need to consume this web
service using HTTP. The developer's IDE is Notepad. Yeah, weird I know.

How is this done? I guess if I can get it to run ASP, IDE independant,
that should make them happy. Any references you can point me to?

Thanks!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com


Jan 17 '06 #4

P: n/a
I updated as suggested but I still get the same error.

Dim objSrvHTTP
Dim objXMLSend
Dim objXMLReceive
set objSrvHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
set objXMLSend = Server.CreateObject("MSXML2.DOMDocument")
set objXMLReceive = Server.CreateObject("MSXML2.DOMDocument")

objXMLSend.async = false
objXMLSend.loadXML "<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><OrderDetails xmlns=""http://www.domain.com"">" & _
"<orderno>123456</orderno>" & _
"</OrderDetails></soap:Body></soap:Envelope>"

objSrvHTTP.open
"POST","http://localhost/prgnrt/orderstatus.asmx/OrderDetails",false
objSrvHTTP.send objXMLSend
objXMLReceive = objSrvHTTP.responseText
Response.ContentType = "text/xml"
Response.Write(objSrvHTTP.responseText)

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com

"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:7C**************@TK2MSFTNGXA02.phx.gbl...
Hi David,

Welcome to MSDN newsgroup.
As for the calling webservice in JSP application, I think you'd consider
the following options:

1. If you're calling the webservice through JSP's serverside code(java
code), I think you have to lookup some JAVA specific webservice sdk which
can help create webservice proxy classes which simplified webservice
consuming... Elsewise, you have to use the java specific http request
component to manually send SOAP XML http request to the .net webservice
....

2. If you're calling the webservice through webpage's clientside script
code, using the XML HTTP component as you mentioned should be ok.

Based on the code you provided, you directly send the following XML as
SOAP
messageto target .net webservcie:

"<OrderDetails
xmlns='http://www.domain.com'><orderno>123456</orderno></OrderDetails>"

This is not correct since SOAP webservcie message should include the
complete SOAP envelope which contains soap headers(optional) and soap
boday
(required).... To determine the correct XML soap message you should
send, I suggest you use some TCP or HTTP trace tools to trace the soap
message ( you can consuming the webservcie through .net client app first
to capture such SOAP message). And the Trace Utility in SOAP toolkit 3.0
is a good http trace tools:

#SOAP Toolkit 3.0
http://www.microsoft.com/downloads/d...0DD-CEEC-4088-
9753-86F052EC8450&displaylang=en

When you has captured the soap message , you can define a XML template
file
or string that you can use to easily build a SOAP request message....

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
From: "David Lozzi" <Da********@nospam.nospam>
References: <uL**************@TK2MSFTNGP11.phx.gbl>
Subject: Re: Consume web service using HTTP
Date: Mon, 16 Jan 2006 17:03:47 -0500
Lines: 75
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
Message-ID: <#J**************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.webservices:1337 3
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

This is what I have so far in my classic asp page

Dim objSrvHTTP
Dim objXMLSend
Dim objXMLReceive
set objSrvHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
set objXMLSend = Server.CreateObject("MSXML2.DOMDocument")
set objXMLReceive = Server.CreateObject("MSXML2.DOMDocument")

objXMLSend.async = false
objXMLSend.loadXML "<OrderDetails
xmlns='http://www.domain.com'><orderno>123456</orderno></OrderDetails>"

objSrvHTTP.open
"POST","http://localhost/prgnrt/orderstatus.asmx/OrderDetails",false
objSrvHTTP.send objXMLSend
objXMLReceive = objSrvHTTP.responseText
Response.ContentType = "text/xml"
Response.Write(objSrvHTTP.responseText)
and I get this error:

Request format is invalid: text/xml.
The web service details are:

HTTP POST
The following is a sample HTTP POST request and response. The placeholders
shown need to be replaced with actual values.

POST /prgnrt/orderstatus.asmx/OrderDetails HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
Content-Length: length

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

<?xml version="1.0"?>
xmlThanks!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com

"David Lozzi" <Da********@nospam.nospam> wrote in message
news:uL**************@TK2MSFTNGP11.phx.gbl...
Howdy,

I wrote a web service in .Net for my customer. My customer has another
vendor who now has to consume it but they are not using Visual Studio.
Most of their pages are jsp, and they said they need to consume this web
service using HTTP. The developer's IDE is Notepad. Yeah, weird I know.

How is this done? I guess if I can get it to run ASP, IDE independant,
that should make them happy. Any references you can point me to?

Thanks!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com


Jan 18 '06 #5

P: n/a
Thanks for your response.

So have you tried using some trace tools to capture a example SOAP request
message(sent by .net webservice proxy)? Also, for testing, you can use the
..net's HttpWebRequest component to post raw XML soap message to the service
to see whether this works, if still not work , there may exists some
problem with our XML SOAP message, elsewise, the problem should reside in
the msxml code....

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
From: "David Lozzi" <Da********@nospam.nospam>
References: <uL**************@TK2MSFTNGP11.phx.gbl>
<#J**************@TK2MSFTNGP12.phx.gbl>
<7C**************@TK2MSFTNGXA02.phx.gbl>
Subject: Re: Consume web service using HTTP
Date: Wed, 18 Jan 2006 15:54:26 -0500
Lines: 184
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
X-RFC2646: Format=Flowed; Original
Message-ID: <eq*************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
microsoft.public.dotnet.framework.webservices:1340 1
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

I updated as suggested but I still get the same error.

Dim objSrvHTTP
Dim objXMLSend
Dim objXMLReceive
set objSrvHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
set objXMLSend = Server.CreateObject("MSXML2.DOMDocument")
set objXMLReceive = Server.CreateObject("MSXML2.DOMDocument")

objXMLSend.async = false
objXMLSend.loadXML "<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><OrderDetails xmlns=""http://www.domain.com"">" & _
"<orderno>123456</orderno>" & _
"</OrderDetails></soap:Body></soap:Envelope>"

objSrvHTTP.open
"POST","http://localhost/prgnrt/orderstatus.asmx/OrderDetails",false
objSrvHTTP.send objXMLSend
objXMLReceive = objSrvHTTP.responseText
Response.ContentType = "text/xml"
Response.Write(objSrvHTTP.responseText)

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com

"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:7C**************@TK2MSFTNGXA02.phx.gbl...
Hi David,

Welcome to MSDN newsgroup.
As for the calling webservice in JSP application, I think you'd consider
the following options:

1. If you're calling the webservice through JSP's serverside code(java
code), I think you have to lookup some JAVA specific webservice sdk which
can help create webservice proxy classes which simplified webservice
consuming... Elsewise, you have to use the java specific http request
component to manually send SOAP XML http request to the .net webservice
....

2. If you're calling the webservice through webpage's clientside script
code, using the XML HTTP component as you mentioned should be ok.

Based on the code you provided, you directly send the following XML as
SOAP
messageto target .net webservcie:

"<OrderDetails
xmlns='http://www.domain.com'><orderno>123456</orderno></OrderDetails>"

This is not correct since SOAP webservcie message should include the
complete SOAP envelope which contains soap headers(optional) and soap
boday
(required).... To determine the correct XML soap message you should
send, I suggest you use some TCP or HTTP trace tools to trace the soap
message ( you can consuming the webservcie through .net client app first
to capture such SOAP message). And the Trace Utility in SOAP toolkit 3.0
is a good http trace tools:

#SOAP Toolkit 3.0
http://www.microsoft.com/downloads/d...0DD-CEEC-4088- 9753-86F052EC8450&displaylang=en

When you has captured the soap message , you can define a XML template
file
or string that you can use to easily build a SOAP request message....

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
From: "David Lozzi" <Da********@nospam.nospam>
References: <uL**************@TK2MSFTNGP11.phx.gbl>
Subject: Re: Consume web service using HTTP
Date: Mon, 16 Jan 2006 17:03:47 -0500
Lines: 75
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
Message-ID: <#J**************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.webservices:1337 3
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

This is what I have so far in my classic asp page

Dim objSrvHTTP
Dim objXMLSend
Dim objXMLReceive
set objSrvHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
set objXMLSend = Server.CreateObject("MSXML2.DOMDocument")
set objXMLReceive = Server.CreateObject("MSXML2.DOMDocument")

objXMLSend.async = false
objXMLSend.loadXML "<OrderDetails
xmlns='http://www.domain.com'><orderno>123456</orderno></OrderDetails>"

objSrvHTTP.open
"POST","http://localhost/prgnrt/orderstatus.asmx/OrderDetails",false
objSrvHTTP.send objXMLSend
objXMLReceive = objSrvHTTP.responseText
Response.ContentType = "text/xml"
Response.Write(objSrvHTTP.responseText)
and I get this error:

Request format is invalid: text/xml.
The web service details are:

HTTP POST
The following is a sample HTTP POST request and response. The placeholders
shown need to be replaced with actual values.

POST /prgnrt/orderstatus.asmx/OrderDetails HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
Content-Length: length

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

<?xml version="1.0"?>
xmlThanks!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com

"David Lozzi" <Da********@nospam.nospam> wrote in message
news:uL**************@TK2MSFTNGP11.phx.gbl...
Howdy,

I wrote a web service in .Net for my customer. My customer has another
vendor who now has to consume it but they are not using Visual Studio.
Most of their pages are jsp, and they said they need to consume this web
service using HTTP. The developer's IDE is Notepad. Yeah, weird I know.

How is this done? I guess if I can get it to run ASP, IDE independant,
that should make them happy. Any references you can point me to?

Thanks!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com



Jan 19 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.