Using System.Net.WebClient to access Web Service. Please help.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Barrido

    #1

    Using System.Net.WebClient to access Web Service. Please help.

    Greetings! I have a project that needs to access a web service. My problem
    is this web service is provided via
    CGI. I cannot do a "Web Reference" to it to add in my dotnet project. I'm
    planning to use instead the System.Net.WebC lient
    to HTTP POST to this Web Service so I can retrieve any return values from
    it. The code bellow is what the CGI web service expect to receive from my
    end. How do I "HTTP POST" this to http://localhost/sb/myServer.cgi using
    System.Net.WebC lient? Please help. Thanks in advance! :-)

    SOAP::Transport ::HTTP::Client: :send_receive: POST

    Accept: text/xml
    Accept: multipart/*
    Content-Length: 447
    Content-Type: text/xml; charset=utf-8
    SOAPAction: "urn:myWS#creat esessioncmd"
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:xsi="http ://www.w3.org/1999/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap .org/soap/encoding/" xmlns:SOAPENV="
    http://schemas.xmlsoap .org/soap/envelope/"
    xmlns:xsd="http ://www.w3.org/1999/XMLSchema" SOAPENV:
    encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/">
    <SOAP-ENV:Body>
    <namesp1:create sessioncmd xmlns:namesp1=" urn:myWS"/>
    </SOAP-ENV:Body>
    </SOAPENV:
    Envelope>


  • Andy Fish

    #2
    Re: Using System.Net.WebC lient to access Web Service. Please help.

    surely the whole point of web services is that you can access them
    regardless of the technology provided to provide them? providing the service
    implements SOAP there should be nothing to stop you adding a web reference

    "Michael Barrido" <jmmrb@hotmail. com> wrote in message
    news:eyTsMiLmFH A.3304@tk2msftn gp13.phx.gbl...[color=blue]
    > Greetings! I have a project that needs to access a web service. My problem
    > is this web service is provided via
    > CGI. I cannot do a "Web Reference" to it to add in my dotnet project. I'm
    > planning to use instead the System.Net.WebC lient
    > to HTTP POST to this Web Service so I can retrieve any return values from
    > it. The code bellow is what the CGI web service expect to receive from my
    > end. How do I "HTTP POST" this to http://localhost/sb/myServer.cgi using
    > System.Net.WebC lient? Please help. Thanks in advance! :-)
    >
    > SOAP::Transport ::HTTP::Client: :send_receive: POST
    > http://localhost/sb/myServer.cgi
    > Accept: text/xml
    > Accept: multipart/*
    > Content-Length: 447
    > Content-Type: text/xml; charset=utf-8
    > SOAPAction: "urn:myWS#creat esessioncmd"
    > <?xml version="1.0" encoding="UTF-8"?>
    > <SOAP-ENV:Envelope xmlns:xsi="http ://www.w3.org/1999/XMLSchema-instance"
    > xmlns:SOAP-ENC="http://schemas.xmlsoap .org/soap/encoding/" xmlns:SOAPENV="
    > http://schemas.xmlsoap .org/soap/envelope/"
    > xmlns:xsd="http ://www.w3.org/1999/XMLSchema" SOAPENV:
    > encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/">
    > <SOAP-ENV:Body>
    > <namesp1:create sessioncmd xmlns:namesp1=" urn:myWS"/>
    > </SOAP-ENV:Body>
    > </SOAPENV:
    > Envelope>
    >[/color]


    Comment

    • Michael Barrido

      #3
      Re: Using System.Net.WebC lient to access Web Service. Please help.

      All i get when i try to "Web Reference" is

      "The request failed with HTTP status 411: Length Required." :-(

      "Andy Fish" <ajfish@blueyon der.co.uk> wrote in message
      news:uUpZEOMmFH A.420@TK2MSFTNG P09.phx.gbl...[color=blue]
      > surely the whole point of web services is that you can access them
      > regardless of the technology provided to provide them? providing the
      > service implements SOAP there should be nothing to stop you adding a web
      > reference
      >
      > "Michael Barrido" <jmmrb@hotmail. com> wrote in message
      > news:eyTsMiLmFH A.3304@tk2msftn gp13.phx.gbl...[color=green]
      >> Greetings! I have a project that needs to access a web service. My
      >> problem is this web service is provided via
      >> CGI. I cannot do a "Web Reference" to it to add in my dotnet project. I'm
      >> planning to use instead the System.Net.WebC lient
      >> to HTTP POST to this Web Service so I can retrieve any return values from
      >> it. The code bellow is what the CGI web service expect to receive from my
      >> end. How do I "HTTP POST" this to http://localhost/sb/myServer.cgi using
      >> System.Net.WebC lient? Please help. Thanks in advance! :-)
      >>
      >> SOAP::Transport ::HTTP::Client: :send_receive: POST
      >> http://localhost/sb/myServer.cgi
      >> Accept: text/xml
      >> Accept: multipart/*
      >> Content-Length: 447
      >> Content-Type: text/xml; charset=utf-8
      >> SOAPAction: "urn:myWS#creat esessioncmd"
      >> <?xml version="1.0" encoding="UTF-8"?>
      >> <SOAP-ENV:Envelope xmlns:xsi="http ://www.w3.org/1999/XMLSchema-instance"
      >> xmlns:SOAP-ENC="http://schemas.xmlsoap .org/soap/encoding/"
      >> xmlns:SOAPENV="
      >> http://schemas.xmlsoap .org/soap/envelope/"
      >> xmlns:xsd="http ://www.w3.org/1999/XMLSchema" SOAPENV:
      >> encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/">
      >> <SOAP-ENV:Body>
      >> <namesp1:create sessioncmd xmlns:namesp1=" urn:myWS"/>
      >> </SOAP-ENV:Body>
      >> </SOAPENV:
      >> Envelope>
      >>[/color]
      >
      >[/color]


      Comment

      Working...