File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes how to fetch authheaders in android Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "how to fetch authheaders in android" Watch "how to fetch authheaders in android" New topic
Author

how to fetch authheaders in android

Rohan Patel
Greenhorn

Joined: Jun 13, 2011
Posts: 4
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
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
I'm missing something. Your Android code sends the auth header, doesn't it? Why would you need to retrieve them?


Ping & DNS - my free Android networking tools app
Rohan Patel
Greenhorn

Joined: Jun 13, 2011
Posts: 4
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 .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to fetch authheaders in android