Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to fetch authheaders in android

 
Rohan Patel
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
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • 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 .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic