Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C# and simple SOAP

C# and simple SOAP

Scheduled Pinned Locked Moved C#
csharpwcfxml
11 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A AssemblySoft

    I am writing an app that uses the .Net classes TCPClient and NetworkStream to read and write data between 2 machines. All works fine. I have recently found a need to be able to send Http 1.1 with a SOAP message as the Http body. Currently i am using an XmlDocument to load and parse the SOAP data. However to do this i first have to read in the HTTP header, search for the beginning of the body and construct my own XmlDocument. There must be a better way. I don't want to call a web service, i just want to send http with a soap body and receive the same. I am looking for a means of loading in the NetworkStream into some kind of HTTP object to read the http stuff and also load the body into some simple Soap object that can be used to pull out/ set values. Comments, Suggestions Welcomed. Carl

    L Offline
    L Offline
    led mike
    wrote on last edited by
    #2

    Into 5 different forums by a 4 year Code Project Veteran... wow What's up with that Carl?

    A 1 Reply Last reply
    0
    • A AssemblySoft

      I am writing an app that uses the .Net classes TCPClient and NetworkStream to read and write data between 2 machines. All works fine. I have recently found a need to be able to send Http 1.1 with a SOAP message as the Http body. Currently i am using an XmlDocument to load and parse the SOAP data. However to do this i first have to read in the HTTP header, search for the beginning of the body and construct my own XmlDocument. There must be a better way. I don't want to call a web service, i just want to send http with a soap body and receive the same. I am looking for a means of loading in the NetworkStream into some kind of HTTP object to read the http stuff and also load the body into some simple Soap object that can be used to pull out/ set values. Comments, Suggestions Welcomed. Carl

      E Offline
      E Offline
      Ennis Ray Lynch Jr
      wrote on last edited by
      #3

      Http Header with body like you describe is a webservice call. SoapExtensions may help you but I don't know if you can use them outside of the context of a webmethod.


      Need a C# Consultant? I'm available.
      Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

      1 Reply Last reply
      0
      • L led mike

        Into 5 different forums by a 4 year Code Project Veteran... wow What's up with that Carl?

        A Offline
        A Offline
        AssemblySoft
        wrote on last edited by
        #4

        Your right, no excuse, I'm a little pushed on this one. :(

        L 1 Reply Last reply
        0
        • A AssemblySoft

          Your right, no excuse, I'm a little pushed on this one. :(

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #5

          So how are you doing with it? Have you figured out how simple it is yet?

          A 1 Reply Last reply
          0
          • L led mike

            So how are you doing with it? Have you figured out how simple it is yet?

            A Offline
            A Offline
            AssemblySoft
            wrote on last edited by
            #6

            Phase1 Well I've managed to construct the HTTP and Soap, send them and parse them using TCPClient and NetworkStream in basic utf8 and ascii with some string handling. Phase2 Then i added XMLDocument to parse the soap. Now i've used the HTTPRequest to help out with the constriction of the HTTP. I am still looking fora nice wrapper for SOAP instead of the slightly lower level XML parsing stategy. Phase 3 - Still looking Problem is everything i use points to web services. I am not communicating directly with a web service but just want an in memory representation of the soap that makes life a little easier to get/set attributes etc. Regards Carl

            L 1 Reply Last reply
            0
            • A AssemblySoft

              Phase1 Well I've managed to construct the HTTP and Soap, send them and parse them using TCPClient and NetworkStream in basic utf8 and ascii with some string handling. Phase2 Then i added XMLDocument to parse the soap. Now i've used the HTTPRequest to help out with the constriction of the HTTP. I am still looking fora nice wrapper for SOAP instead of the slightly lower level XML parsing stategy. Phase 3 - Still looking Problem is everything i use points to web services. I am not communicating directly with a web service but just want an in memory representation of the soap that makes life a little easier to get/set attributes etc. Regards Carl

              L Offline
              L Offline
              led mike
              wrote on last edited by
              #7

              That begins to add some clarity to what you are doing. However the following is still confusing:

              crandall wrote:

              I don't want to call a web service, i just want to send http with a soap body and receive the same.

              You don't want to call a web service but sending/receiving soap over http is calling a web service. Then you are looking for supporting classes in the BCL to do this (call a web service) but you don't want to use the Web Service classes. I am at a complete loss to understand what you think you want to do.  :confused:

              A 1 Reply Last reply
              0
              • L led mike

                That begins to add some clarity to what you are doing. However the following is still confusing:

                crandall wrote:

                I don't want to call a web service, i just want to send http with a soap body and receive the same.

                You don't want to call a web service but sending/receiving soap over http is calling a web service. Then you are looking for supporting classes in the BCL to do this (call a web service) but you don't want to use the Web Service classes. I am at a complete loss to understand what you think you want to do.  :confused:

                A Offline
                A Offline
                AssemblySoft
                wrote on last edited by
                #8

                Mike, first things first. SOAP is a protocol, xml based, it has nothing to do with Web Services in it's own right. SOAP messages have been around long before Web Services. In reality, the TCP connection i am establishing with a remote endpoint will take the data i send and actually call a web service at a later stage. I am looking for a way of creating soap messages and passing them on via TCP. I DO NOT have a web service that i can call available to me. I do have a TCP listener that will end up sending me a response in a binary structure. However the way i pass data in has to be in the same format a typical Web Service would expect. That isn't that confusing is it? Carl

                L 1 Reply Last reply
                0
                • A AssemblySoft

                  Mike, first things first. SOAP is a protocol, xml based, it has nothing to do with Web Services in it's own right. SOAP messages have been around long before Web Services. In reality, the TCP connection i am establishing with a remote endpoint will take the data i send and actually call a web service at a later stage. I am looking for a way of creating soap messages and passing them on via TCP. I DO NOT have a web service that i can call available to me. I do have a TCP listener that will end up sending me a response in a binary structure. However the way i pass data in has to be in the same format a typical Web Service would expect. That isn't that confusing is it? Carl

                  L Offline
                  L Offline
                  led mike
                  wrote on last edited by
                  #9

                  crandall wrote:

                  Mike, first things first. SOAP is a protocol, xml based, it has nothing to do with Web Services in it's own right. SOAP messages have been around long before Web Services.

                  Carl, that post seems to indicate that you don't think I know what SOAP and web services are. If that is so I can only try to assure you that is not the case. The W3C Web service definition encompasses many different systems, but in common usage the term refers to clients and servers that communicate using XML messages that follow the SOAP standard. link[^]

                  crandall wrote:

                  I am looking for a way of creating soap messages and passing them on via TCP. I DO NOT have a web service that i can call available to me. I do have a TCP listener that will end up sending me a response in a binary structure. However the way i pass data in has to be in the same format a typical Web Service would expect. That isn't that confusing is it?

                  Mostly yes it is. Once again you state you need to create a SOAP message and transport it as though that is somehow different than what a Web Service does. Hence part of my confusion. Then you say: "I DO NOT have a web service that i can call available to me." as if that is explaining the first part. It doesn't. Also:

                  crandall wrote:

                  I do have a TCP listener that will end up sending me a response in a binary structure.

                  What do you mean binary structure? Following that statement with this:

                  crandall wrote:

                  However the way i pass data in has to be in the same format a typical Web Service would expect.

                  So there you mean SOAP. So your "binary structure" has to be a SOAP message? Sorry but what you have stated so far is anything but clear. As near as I can tell from your posts, the BCL support for Web Services and/or Remoting would provide you with solutions. Trying to use them with your own current TCP transport implementation is problematic and perhaps not possible but I see no reason, so far, that you cannot use the complete BCL solution rather than your own TCP solution.

                  A 1 Reply Last reply
                  0
                  • L led mike

                    crandall wrote:

                    Mike, first things first. SOAP is a protocol, xml based, it has nothing to do with Web Services in it's own right. SOAP messages have been around long before Web Services.

                    Carl, that post seems to indicate that you don't think I know what SOAP and web services are. If that is so I can only try to assure you that is not the case. The W3C Web service definition encompasses many different systems, but in common usage the term refers to clients and servers that communicate using XML messages that follow the SOAP standard. link[^]

                    crandall wrote:

                    I am looking for a way of creating soap messages and passing them on via TCP. I DO NOT have a web service that i can call available to me. I do have a TCP listener that will end up sending me a response in a binary structure. However the way i pass data in has to be in the same format a typical Web Service would expect. That isn't that confusing is it?

                    Mostly yes it is. Once again you state you need to create a SOAP message and transport it as though that is somehow different than what a Web Service does. Hence part of my confusion. Then you say: "I DO NOT have a web service that i can call available to me." as if that is explaining the first part. It doesn't. Also:

                    crandall wrote:

                    I do have a TCP listener that will end up sending me a response in a binary structure.

                    What do you mean binary structure? Following that statement with this:

                    crandall wrote:

                    However the way i pass data in has to be in the same format a typical Web Service would expect.

                    So there you mean SOAP. So your "binary structure" has to be a SOAP message? Sorry but what you have stated so far is anything but clear. As near as I can tell from your posts, the BCL support for Web Services and/or Remoting would provide you with solutions. Trying to use them with your own current TCP transport implementation is problematic and perhaps not possible but I see no reason, so far, that you cannot use the complete BCL solution rather than your own TCP solution.

                    A Offline
                    A Offline
                    AssemblySoft
                    wrote on last edited by
                    #10

                    Mike, i appreciate you understand SOAP and Web Sevices but you used the terms as if SOAP has no use without them. The binary structure is what i receive back as a response. - NOT SOAP, not XML, pure binary. The API i am using expects a SOAP formatted message over HTTP. This leads me to believe under the covers a call to a web service is being made. However this is not exposed to me. I am accomplishing the goal already, but not very pretty. I am looking to use a portion of the .Net framework than can expose a nice soap object i can use to construct soap messages. It is not completely straight forward. I don't think a web service gives me what need out of the box. If i try and use any of the SOAP objects thus far, they expect to handle the whole identification and transport associated with Web Services. Tell me we are on the same playing field now? Carl

                    L 1 Reply Last reply
                    0
                    • A AssemblySoft

                      Mike, i appreciate you understand SOAP and Web Sevices but you used the terms as if SOAP has no use without them. The binary structure is what i receive back as a response. - NOT SOAP, not XML, pure binary. The API i am using expects a SOAP formatted message over HTTP. This leads me to believe under the covers a call to a web service is being made. However this is not exposed to me. I am accomplishing the goal already, but not very pretty. I am looking to use a portion of the .Net framework than can expose a nice soap object i can use to construct soap messages. It is not completely straight forward. I don't think a web service gives me what need out of the box. If i try and use any of the SOAP objects thus far, they expect to handle the whole identification and transport associated with Web Services. Tell me we are on the same playing field now? Carl

                      L Offline
                      L Offline
                      led mike
                      wrote on last edited by
                      #11

                      crandall wrote:

                      Tell me we are on the same playing field now?

                      Maybe.

                      crandall wrote:

                      The binary structure is what i receive back as a response. - NOT SOAP, not XML, pure binary.

                      then...

                      crandall wrote:

                      The API i am using expects a SOAP formatted message over HTTP

                      So you need to send a SOAP request but you don't get back a SOAP response? If that is the case then I would imagine ( not certain) that the BCL classes would not be of any use. Seems like what you are presently doing (Phase 2) is an appropriate approach.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups