Unsupported Content-type:application/json in java webservice call -


i able set content type using cxf library don't know how set authorization header. whenever set user name , password set authorization header , encode whole value , add basic. don't want this. want add authorization header plain string ever provide. please me solve out problem.

ampservices services = new ampservices();         corexmlport corexmlport = services.getampsoapservice();         client client = clientproxy.getclient(corexmlport);                     httpconduit httpconduit = (httpconduit) client.getconduit();          httpclientpolicy httpclientpolicy=httpconduit.getclient();         string contenttype=httpclientpolicy.getcontenttype();         contenttype="application/soap+xml; type=vnd.iship.amp.soap; charset=utf-8";         httpclientpolicy.setcontenttype(contenttype);          authorizationpolicy authorizationpolicy = new authorizationpolicy();         authorizationpolicy.setusername("username");         authorizationpolicy.setpassword("password");          httpconduit.setauthorization(authorizationpolicy); 

it generates following request xml.

post https://api.iship.com/root/enterprises/pitney%20bowes/progistics; http/1.1 content-type: application/soap+xml; type=vnd.iship.amp.soap; charset=utf-8 accept: */* authorization: basic axnoaxagcgivd3nkzxzlbdownzzhnjfjytm5mdcxodaxodvjnwrkmjm2ytdkmzzhngq1odg5owfj user-agent: apache cxf 3.1.0 cache-control: no-cache pragma: no-cache host: api.iship.com connection: keep-alive content-length: 246 

but want type of request

post https://api.iship.com/root/enterprises/pitney%20bowes/progistics; http/1.1 content-type: application/soap+xml; type=vnd.iship.amp.soap; charset=utf-8 accept: */* authorization: username;password user-agent: apache cxf 3.1.0 cache-control: no-cache pragma: no-cache host: api.iship.com connection: keep-alive content-length: 246 

but not able it. please me solve out problem.

thanks, awadhendra

i think trying call restful service, that's why server side response different content type expected (json instead of soap/xml). url endpoint based on http protocol? if yes, need send additional parameters url?


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -