This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Services and the fly likes HttpConnectionURL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "HttpConnectionURL" Watch "HttpConnectionURL" New topic
Author

HttpConnectionURL

Amit G Piplani
Ranch Hand

Joined: Jul 21, 2004
Posts: 83
Hi,
can anyone help me why should i use HttpConnectionURL instead of using SOAP?

Reagrds,
Amit


SCJP,SCWCD,SCBCD,SCDJWS1.4, SCDJWS1.5
Jayesh Lalwani
Ranch Hand

Joined: Nov 05, 2004
Posts: 502
You have to use HTTPCOonnectionURL is your trying to communicate with non-SOAP servlets. I might be misunderstanding your question. What are you trying to do?
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

One is a transport and the other is a protocol.


Please ignore post, I have no idea what I am talking about.
Amit G Piplani
Ranch Hand

Joined: Jul 21, 2004
Posts: 83
Hi,
At my server end, developer has deployed 1 operation as EJB and one Operation as a web service.
So i can SOAP to access WebService, but to access EJB (he is recommending me to use HttpURLConnection).
That too, i have to manually create XML from data Transfer Obejcts and send it to EJB using OutputStream.

Won't sending XML through HttpURLConnection will cause a performance problem as XML is very big and we have to take crae of creating and then parsing response XML?

Any Suggestions.

Amit
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

> At my server end, developer has deployed 1 operation as EJB and one Operation as a web service.

Well that isn't very nice.

> Won't sending XML through HttpURLConnection will cause a performance problem as XML is very big and we have to take crae of creating and then parsing response XML?

Not sure how HttpUrlConnection with XML would be any slower than using a socket connection and SOAP.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
If the service is exposed as an HTTP transport with a url that starts "http://" then you will be using HttpURLConnection automatically. See the java.net.URLConnection and related classes docs.
So the only question is whether you create the connection in your own code or let the SOAP toolkit do it. There will be no difference - SOAP has no magic method for sending XML.
Bill
Jayesh Lalwani
Ranch Hand

Joined: Nov 05, 2004
Posts: 502
I'm having trouble understanding this. Why can't he just give you the EJB remote stub for you to call? I've never heard anyone call an EJB by passing XML over HTTP. Maybe that's something new that I don't know about

Second, a SOAP message is XML that is sent over HTTP. The SOAP message has to be parsed using XML. You may not be doing it, but the SOAP library will do the parsing for you. So, everything else being equal, SOAP shouldn't be slower or faster than XML over HTTP (unless the SOAP message is much larger than the XML, ofcourse). In fact SOAP is commonly called as XML over HTTP
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HttpConnectionURL
 
Similar Threads
Splitig integers
Do you like twitter ?
Posting to bump up my count...
Constructing overloading
Loading an image