Skip to main content

How to bind authorization value in http request when sending webservice request

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
S.Kalai
Offline
Joined: 2012-08-20

Hi Friends, I am new to webservices,I am creating a javaclient for our existing webservice, I sent request with username/password to the server and I got authentication token, again I want to send webservice request with my authentication token as in the header

POST https://lbs.ddd.com/service/soap11/ HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
Authorization: Bearer

T1QwMTAffgfdyMDEtMWU1ZjlmZDgtMmE3ZC00NTc2LWJmYWQtMzA0NGExNzU1M2Zm
User-Agent: Jakarta Commons-HttpClient/3.1
Host: lbs.ddd.com
Content-Length: 799

xmlns:ns="http://www.ddd.com/ws/2010">




FR
2
--
I have the m_strBase64AccessToken value, this given below code for the

webservice request as I got it from automated class(created by WSDL in eclipse->

by using webservice client)

GeocodeRequest gcreq = new GeocodeRequest();
GeocoderProxy gp = new GeocoderProxy();
GeocoderSoap11Stub gcStub = (GeocoderSoap11Stub) gp.getGeocoder();
( gcStub)._setProperty(Call.SESSION_MAINTAIN_PROPERTY, new Boolean(true));
( gcStub)._setProperty

(HTTPConstants.HEADER_AUTHORIZATION,m_strBase64AccessToken);
gres = gcStub.geocode(gcreq);

I want to add my authorization token above the

if I used the above code ,I got the response as (401)Non-Autoris