MSXML2.ServerXMLHTTP

Discussion in 'ASP .Net Web Services' started by dado49@gmail.com, Aug 23, 2005.

  1. Guest

    I'm trying to post xml to a server using ServerXMLHTTPRequest from an
    aspx.

    Dim objXML As New System.Xml.XmlDataDocument
    objXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
    objXML.open("POST",
    "https://secure1.revilution.dk/api/index.php", False)

    I know msxml from aspx is not suportet. Anyone have any ideas how to do
    this?
    , Aug 23, 2005
    #1
    1. Advertising

  2. EJSawyer Guest

    I'm puzzled as to why you'd *want* to do this, considering the flexibility of
    the SOAP client in .Net. You may want to reevaluate.

    However, if you truly need to do this, you need to use COM Interop. Add a
    reference to your project for the MSXML type library, and then use the
    objects that reference provides. You can't just use a .Net class (e.g.
    System.Xml.XmlDataDocument) to hold a reference to a COM object.

    Also, if you really need to use the COM objects, you may want to consider
    the IXMLHTTPRequest class instead of the IServerXMLHTTPRequest, unless you're
    doing a high traffic page, or you need to circumvent the WinInet stack (for
    example, to override the proxy settings for outgoing traffic).
    IXMLHTTPRequest is a bit simpler to use.

    Erik J Sawyer
    CFT Programmer
    Appro Systems

    "" wrote:

    > I'm trying to post xml to a server using ServerXMLHTTPRequest from an
    > aspx.
    >
    > Dim objXML As New System.Xml.XmlDataDocument
    > objXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
    > objXML.open("POST",
    > "https://secure1.revilution.dk/api/index.php", False)
    >
    > I know msxml from aspx is not suportet. Anyone have any ideas how to do
    > this?
    >
    >
    EJSawyer, Aug 23, 2005
    #2
    1. Advertising

  3. Guest

    I try to loook another solution. I found System.Net.HttpWebRequest.
    What do you thing about that? I didn't test it.
    , Aug 23, 2005
    #3
  4. EJSawyer Guest

    You can use System.Net.HttpWebRequest, but you'd have to do all the
    formatting for the request, and parsing for the return result, yourself.

    But the .Net framework provides all the infrastructure you need to call web
    services, and it all works just fine from within an ASPX page or ASMX
    service. All it takes is to add a web reference to your project within
    Visual Studio. Studio will build a fully-functional SOAP client proxy
    object, based on System.Web.Services.Protocols.SoapHttpClientProtocol.

    Erik J Sawyer
    CFT Programmer
    Appro Systems

    "" wrote:

    > I try to loook another solution. I found System.Net.HttpWebRequest.
    > What do you thing about that? I didn't test it.
    >
    >
    EJSawyer, Aug 23, 2005
    #4
  5. dado49 Guest

    I tryed to look at 'IXMLHTTPReques' but I have a problem :0/
    my code:

    Dim HttpReq As New MSXML.IXMLHTTPReques
    HttpReq.open("GET", "https://secure1.revilution.dk/api/index.php",False)
    HttpReq.send()
    MsgBox(HttpReq.responseText

    the problem is 'MSXML.IXMLHTTPReques'is dot defined.
    I import:
    Imports System.Xml
    Imports System.Net

    --
    Sent via .NET Newsgroups
    http://www.dotnetnewsgroups.com
    dado49, Aug 24, 2005
    #5
  6. EJSawyer Guest

    IXMLHTTPRequest, and the rest of the MSXML classes, are COM objects. Not
    ..Net. Therefore, you have to use COM interop.

    If you're using Visual Studio, it's pretty easy. In the Solution Explorer
    window (normally the top-right pane, click the "Solution" tab), expand your
    solution and right-click the "References" branch. Click "Add Reference". In
    the dialog that comes up, choose the COM tab, and scroll down to Microsoft
    XML (choose your preferred version; v4.0 is the latest general release, v5.0
    ships only with Office 2003, and v6.0 is in beta to ship with Studio 2005).
    Click Select to add the COM library to the bottom window, and click OK.
    Studio will then auto-generate all the namespace and interop marshalling
    stuff to give you full access to the COM classes. You can then use these
    pretty much as any .Net class.

    You may also want to look at:
    http://msdn.microsoft.com/library/en-us/vbcn7/html/vaconCOMInteroperability.asp

    I still find it strange that you insist on going this route, though. You
    should seriously consider using the SOAP client support built into the .Net
    framework.

    - EJS

    "dado49" wrote:

    > I tryed to look at 'IXMLHTTPReques' but I have a problem :0/
    > my code:
    >
    > Dim HttpReq As New MSXML.IXMLHTTPReques
    > HttpReq.open("GET", "https://secure1.revilution.dk/api/index.php",False)
    > HttpReq.send()
    > MsgBox(HttpReq.responseText
    >
    > the problem is 'MSXML.IXMLHTTPReques'is dot defined.
    > I import:
    > Imports System.Xml
    > Imports System.Net
    >
    > --
    > Sent via .NET Newsgroups
    > http://www.dotnetnewsgroups.com
    >
    EJSawyer, Aug 24, 2005
    #6
  7. dado49 Guest

    Thnak you wery much for your answers.
    I'm not expert in asp.net. I just started with it. I'm a student and
    working on my projekt exam. We have be workong on this problem in 2 days
    and wi still have a proble.
    I have a question about SOAP - when I try to add webservice to use soap
    I got a error message from the url.

    ERROR:
    The document at the url https://secure1.revilution.dk/api/index.php was
    not recognized as a known document type.
    The error message from each known type may help you fix the problem:
    - Report from 'WSDL Document' is 'There is an error in XML document (2,
    2).'.

    This is our latest try:

    Dim requestText As Object
    Dim serverResponseText As Object

    Dim xmlDoc As MSXML2.DOMDocument
    Dim xmlHttp As MSXML2.XMLHTTP


    xmlDoc = New MSXML2.DOMDocument
    xmlHttp = New MSXML2.XMLHTTP

    requestText = functionToXML(methodName, paramList) ' ok xml
    'xmlDoc.loadXML(requestText)

    xmlHttp.open
    "POST", "https://secure1.revilution.dk/api/index.php", False)
    xmlHttp.send(requestText)

    we alaways get error in this line: xmlHttp.send(requestText)
    Exception Details: System.Runtime.InteropServices.COMException: The
    download of the specified resource has failed.
    I added MSXML in my referances.

    --
    Sent via .NET Newsgroups
    http://www.dotnetnewsgroups.com
    dado49, Aug 25, 2005
    #7
  8. dado49 Guest

    This is my asp code.

    Set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP")

    requestText = functionToXML(methodName,paramList)

    ' Call the remote machine the request
    objXML.open "POST", "https://secure1.revilution.dk/api/index.php",
    false

    ' This is necessary for some implementations (ZOPE).
    objXML.setRequestHeader "Content-type", "text/xml"
    objXML.setRequestHeader "Content-lenght", len(requestText)
    objXML.setRequestHeader "Connection", "close"
    objXML.send(requestText)

    serverResponseText = objXML.responseText
    ..
    ..
    ..

    --
    Sent via .NET Newsgroups
    http://www.dotnetnewsgroups.com
    dado49, Aug 25, 2005
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Maris Janis Vasilevskis

    MSXML2.ServerXMLHTTP to HttpWebRequest: Error 500

    Maris Janis Vasilevskis, Aug 29, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    6,234
    Maris Janis Vasilevskis
    Aug 29, 2005
  2. bo0oost

    Msxml2.ServerXMLHTTP

    bo0oost, Apr 17, 2004, in forum: XML
    Replies:
    0
    Views:
    2,791
    bo0oost
    Apr 17, 2004
  3. Dick Berthold

    MSXML2.ServerXMLHTTP

    Dick Berthold, Jun 5, 2006, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    162
    Dick Berthold
    Jun 5, 2006
  4. katrinaVictim@.

    msxml2.serverXMLhttp and response.binarywrite

    katrinaVictim@., Oct 16, 2005, in forum: ASP General
    Replies:
    4
    Views:
    300
    McKirahan
    Oct 17, 2005
  5. Michael Christensen
    Replies:
    2
    Views:
    490
    Bob Barrows [MVP]
    Oct 24, 2005
Loading...

Share This Page