• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

how to fetch authheaders in android  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi every one, i am a newbie to android i have to fetch auth header from asmx service and i didnt get any link to resolve it.
please help..
thanks in advance.

My service is like

Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetUserDetail"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<AuthHeader xmlns="http://tempuri.org/">
<Username>string</Username>
<Password>string</Password>
</AuthHeader>
</soap:Header>
<soap:Body>
<GetUserDetail xmlns="http://tempuri.org/">
<userid>string</userid>
</GetUserDetail>
</soap:Body>
</soap:Envelope>



and response is like

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetUserDetailResponse xmlns="http://tempuri.org/">
<GetUserDetailResult>
<xsd:schema>schema</xsd:schema>xml</GetUserDetailResult>
</GetUserDetailResponse>
</soap:Body>
</soap:Envelope>



i stuck with this and lost my 2 days for in and nothing with me at present
 
Rancher
Posts: 42974
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm missing something. Your Android code sends the auth header, doesn't it? Why would you need to retrieve them?
 
Rohan Patel
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
@ Ulf Dittmer Marshal for your reply, actually i set header like this.......

Element h = new Element().createElement(NAMESPACE, "AuthHeader");
Element Username = new Element().createElement(NAMESPACE, "Username");
Username.addChild(Node.TEXT, "MYUSERNAME");
h.addChild(Node.ELEMENT, Username);
Element wssePassword = new Element().createElement(NAMESPACE, "Password");
wssePassword.addChild(Node.TEXT, "MYPASSWORD");
h.addChild(Node.ELEMENT, wssePassword);

envelope.headerOut = new Element[]{h};

but when i called


try {
androidHttpTransport.call(SOAP_ACTION, envelope);//,headerProperty);

Object obj = envelope.bodyIn;
obj.toString();


it gives always null is there any method to send authheader ??
thanks again for your reply .
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!