• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Request web service through socket

 
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I just saw some code where a web service operation is invoked by means of doing an HTTP Post whereby the HTTP headers and soap envelope are constructed manually and pushed through a socket to the endpoint.
Can anyone tell me what are the disadvantages of doing this as opposed to doing something like Service.create ???

Thanks,
 
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Simplified analogy: How do we go from USA to India?

1. Walk
2. Sea
3. Airplane
4. Car
5. Train
6. Use your imagination

Even though any way can lead you to India. But the proper way would be by Airplane if you have the mean.

In another word, use the right tool at your disposal if applicable.

The next question then what is the right tool for any given scenario?
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay so then it's not wrong I guess
 
H Paul
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't try to insist on being right rather try to look at things from context/perspective point of view.

2011- Use Airplane
2000 year ago - by what? and why?
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
There is (usually) not right or wrong, because in some cases, may they be rare, there may be justification for using a specific solution to a problem.
If you consider sending a SOAP request by sending a string of characters over a socket, you will have the following consequences:
  • More code to write

  • This will also mean more code to test and more code to maintain.
  • Simpler technology

  • The solution does not require special knowledge about some web service stack or such, albeit there is a slight feeling of reinventing the wheel.
    However, there may be circumstances, such as a special environment (cellphone, for instance), where there are restrictions on the libraries and frameworks that can be used.
  • A non-standard solution

  • Using an existing standard, like JAX-WS, has the advantage of it being a standard.
    If someone knows how to develop, for instance, JAX-WS web services, it will be relatively easy to switch to another web service stack adhering to the standard.
    Understanding a non-standard solution will, most likely, require more effort.

    I am sure there are additional things that can be considered, but I think this will give you a hint.
    Best wishes!
     
    H Paul
    Ranch Hand
    Posts: 491
    5
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    1. Suppose my company A (provider) (too good to be true ) and another company B (consumer) choose to do web service using SOAP over JMS.
    2. When A recieve SOAP Message from B, it can simply POST to another company C as it is (with or with additional SOAP Message manipulation)
    using either URL/Apache Client OR JAX-RPC/JAX-WS client API.

    Would URL or Apache Client not enough?
    This is like replacing the hard-coded SOAP message with a ready SOAP Message from JMS Queue.
     
    Duran Harris
    Ranch Hand
    Posts: 608
    Eclipse IDE Spring Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Think I will try to replace the Socket connection with a a call to javax.xml.ws.Dispatch.createDispatch
     
    reply
      Bookmark Topic Watch Topic
    • New Topic