Re: Consume web service using HTTP



{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fprq2\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\lang2052\f0\fs20 Thanks for your response.
\par
\par 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....
\par
\par Thanks,
\par
\par Steven Cheng
\par Microsoft Online Support
\par
\par Get Secure! www.microsoft.com/security
\par (This posting is provided "AS IS", with no warranties, and confers no rights.)
\par \pard\li720 --------------------
\par From: "David Lozzi" <DavidLozzi@xxxxxxxxxxxxx>
\par References: <uLLaJJuGGHA.1032@xxxxxxxxxxxxxxxxxxxx> <#JoMEjuGGHA.1628@xxxxxxxxxxxxxxxxxxxx> <7CypSTzGGHA.3764@xxxxxxxxxxxxxxxxxxxxx>
\par Subject: Re: Consume web service using HTTP
\par Date: Wed, 18 Jan 2006 15:54:26 -0500
\par Lines: 184
\par X-Priority: 3
\par X-MSMail-Priority: Normal
\par X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
\par X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
\par X-RFC2646: Format=Flowed; Original
\par Message-ID: <eq2HeFHHGHA.376@xxxxxxxxxxxxxxxxxxxx>
\par Newsgroups: microsoft.public.dotnet.framework.webservices
\par NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
\par Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
\par Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.framework.webservices:13401
\par X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
\par
\par I updated as suggested but I still get the same error.
\par
\par Dim objSrvHTTP
\par Dim objXMLSend
\par Dim objXMLReceive
\par set objSrvHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
\par set objXMLSend = Server.CreateObject("MSXML2.DOMDocument")
\par set objXMLReceive = Server.CreateObject("MSXML2.DOMDocument")
\par
\par objXMLSend.async = false
\par objXMLSend.loadXML "<soap:Envelope
\par xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"";
\par xmlns:xsd=""http://www.w3.org/2001/XMLSchema"";
\par xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"";>" & _
\par "<soap:Body><OrderDetails xmlns=""http://www.domain.com"";>" & _
\par "<orderno>123456</orderno>" & _
\par "</OrderDetails></soap:Body></soap:Envelope>"
\par
\par objSrvHTTP.open
\par "POST","http://localhost/prgnrt/orderstatus.asmx/OrderDetails",false
\par objSrvHTTP.send objXMLSend
\par objXMLReceive = objSrvHTTP.responseText
\par Response.ContentType = "text/xml"
\par Response.Write(objSrvHTTP.responseText)
\par
\par --
\par David Lozzi
\par Web Applications Developer
\par dlozzi@(remove-this)delphi-ts.com
\par
\par
\par
\par "Steven Cheng[MSFT]" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
\par news:7CypSTzGGHA.3764@xxxxxxxxxxxxxxxxxxxxxxxx
\par > Hi David,
\par >
\par > Welcome to MSDN newsgroup.
\par > As for the calling webservice in JSP application, I think you'd consider
\par > the following options:
\par >
\par > 1. If you're calling the webservice through JSP's serverside code(java
\par > code), I think you have to lookup some JAVA specific webservice sdk which
\par > can help create webservice proxy classes which simplified webservice
\par > consuming... Elsewise, you have to use the java specific http request
\par > component to manually send SOAP XML http request to the .net webservice
\par > ....
\par >
\par > 2. If you're calling the webservice through webpage's clientside script
\par > code, using the XML HTTP component as you mentioned should be ok.
\par >
\par > Based on the code you provided, you directly send the following XML as
\par > SOAP
\par > messageto target .net webservcie:
\par >
\par > "<OrderDetails
\par > xmlns='http://www.domain.com'><orderno>123456</orderno></OrderDetails>"
\par >
\par > This is not correct since SOAP webservcie message should include the
\par > complete SOAP envelope which contains soap headers(optional) and soap
\par > boday
\par > (required).... To determine the correct XML soap message you should
\par > send, I suggest you use some TCP or HTTP trace tools to trace the soap
\par > message ( you can consuming the webservcie through .net client app first
\par > to capture such SOAP message). And the Trace Utility in SOAP toolkit 3.0
\par > is a good http trace tools:
\par >
\par > #SOAP Toolkit 3.0
\par > http://www.microsoft.com/downloads/details.aspx?FamilyId=C943C0DD-CEEC-4088-
\par > 9753-86F052EC8450&displaylang=en
\par >
\par > When you has captured the soap message , you can define a XML template
\par > file
\par > or string that you can use to easily build a SOAP request message....
\par >
\par > Hope helps. Thanks,
\par >
\par > Steven Cheng
\par > Microsoft Online Support
\par >
\par > Get Secure! www.microsoft.com/security
\par > (This posting is provided "AS IS", with no warranties, and confers no
\par > rights.)
\par >
\par >
\par >
\par >
\par >
\par > --------------------
\par > From: "David Lozzi" <DavidLozzi@xxxxxxxxxxxxx>
\par > References: <uLLaJJuGGHA.1032@xxxxxxxxxxxxxxxxxxxx>
\par > Subject: Re: Consume web service using HTTP
\par > Date: Mon, 16 Jan 2006 17:03:47 -0500
\par > Lines: 75
\par > X-Priority: 3
\par > X-MSMail-Priority: Normal
\par > X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
\par > X-RFC2646: Format=Flowed; Response
\par > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
\par > Message-ID: <#JoMEjuGGHA.1628@xxxxxxxxxxxxxxxxxxxx>
\par > Newsgroups: microsoft.public.dotnet.framework.webservices
\par > NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
\par > Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
\par > Xref: TK2MSFTNGXA02.phx.gbl
\par > microsoft.public.dotnet.framework.webservices:13373
\par > X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
\par >
\par > This is what I have so far in my classic asp page
\par >
\par > Dim objSrvHTTP
\par > Dim objXMLSend
\par > Dim objXMLReceive
\par > set objSrvHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
\par > set objXMLSend = Server.CreateObject("MSXML2.DOMDocument")
\par > set objXMLReceive = Server.CreateObject("MSXML2.DOMDocument")
\par >
\par > objXMLSend.async = false
\par > objXMLSend.loadXML "<OrderDetails
\par > xmlns='http://www.domain.com'><orderno>123456</orderno></OrderDetails>"
\par >
\par > objSrvHTTP.open
\par > "POST","http://localhost/prgnrt/orderstatus.asmx/OrderDetails",false
\par > objSrvHTTP.send objXMLSend
\par > objXMLReceive = objSrvHTTP.responseText
\par > Response.ContentType = "text/xml"
\par > Response.Write(objSrvHTTP.responseText)
\par >
\par >
\par > and I get this error:
\par >
\par > Request format is invalid: text/xml.
\par >
\par >
\par > The web service details are:
\par >
\par > HTTP POST
\par > The following is a sample HTTP POST request and response. The placeholders
\par > shown need to be replaced with actual values.
\par >
\par > POST /prgnrt/orderstatus.asmx/OrderDetails HTTP/1.1
\par > Host: localhost
\par > Content-Type: application/x-www-form-urlencoded
\par > Content-Length: length
\par >
\par > orderno=stringHTTP/1.1 200 OK
\par > Content-Type: text/xml; charset=utf-8
\par > Content-Length: length
\par >
\par > <?xml version="1.0"?>
\par > xmlThanks!!
\par >
\par > --
\par > David Lozzi
\par > Web Applications Developer
\par > dlozzi@(remove-this)delphi-ts.com
\par >
\par >
\par >
\par > "David Lozzi" <DavidLozzi@xxxxxxxxxxxxx> wrote in message
\par > news:uLLaJJuGGHA.1032@xxxxxxxxxxxxxxxxxxxxxxx
\par >> Howdy,
\par >>
\par >> I wrote a web service in .Net for my customer. My customer has another
\par >> vendor who now has to consume it but they are not using Visual Studio.
\par >> Most of their pages are jsp, and they said they need to consume this web
\par >> service using HTTP. The developer's IDE is Notepad. Yeah, weird I know.
\par >>
\par >> How is this done? I guess if I can get it to run ASP, IDE independant,
\par >> that should make them happy. Any references you can point me to?
\par >>
\par >> Thanks!!
\par >>
\par >> --
\par >> David Lozzi
\par >> Web Applications Developer
\par >> dlozzi@(remove-this)delphi-ts.com
\par >>
\par >>
\par >>
\par >>
\par >
\par >
\par >
\par
\par
\par \pard
\par
\par }