Actually , i spent lots of time for this. but couldnot find proper solution 
for getting soap header in android.

What i am doing in android look at this, I trying various method :

*String NAMESPACE="http://tempuri.org/"; ;*

*String SOAP_ACTION="http://tempuri.org/ISimpleCustomHeaderService/DoWork"; 
;*

envelope.headerOut = new Element[3];
envelope.headerOut[0] = buildAuthHeader();
private Element buildSessionHeader() {
    Element nodeElement = new Element().createElement(NAMESPACE, "web-node-id");
    nodeElement.addChild(Node.TEXT, "node");
    return nodeElement;}
private Element buildNodeIDHeader() {
    Element sessionElement = new Element().createElement(NAMESPACE, 
"web-session-id");
    sessionElement.addChild(Node.TEXT, "session");
    return sessionElement;}
private Element buildUserHeader() {
    Element userElement = new Element().createElement(NAMESPACE, "web-user");
    userElement.addChild(Node.TEXT, "user");
    return userElement;}

================================================================

envelope.headerOut[0] = buildAuthHeader();------------------private Element 
buildAuthHeader() {
        String test = "ns";
        Element h = new Element().createElement(NAMESPACE, "Header");
        Element first = new Element().createElement(NAMESPACE, "web-user");
        first.addChild(Node.TEXT, "web_user_name");
        h.addChild(Node.ELEMENT, first);

        Element second = new Element().createElement(NAMESPACE, "web-node-id");
        second.addChild(Node.TEXT, "web_node_id");
        h.addChild(Node.ELEMENT, second);

        Element third = new Element().createElement(NAMESPACE, 
"web-session-id");
        third.addChild(Node.TEXT, "web_session_id");
        h.addChild(Node.ELEMENT, third);
        return h;
    }

====================================================

List<HeaderProperty> headerList=getHeaderList();
        ------------
        androidHttpTransport.call(SOAP_ACTION, envelope,headerList);
    ---------------private List<HeaderProperty> getHeaderList() {
        List<HeaderProperty> headerList = null;
        try {

        headerList = new ArrayList<HeaderProperty>();
       // String security=HeaderUserName+":"+HeaderPassword;
       // headerList.add(new HeaderProperty("Authorization", "Basic " + 
org.kobjects.base64.Base64.encode(security.getBytes())));
        headerList.add(new HeaderProperty("web-user", "user Id"));
        headerList.add(new HeaderProperty("web-node-id","node id"));
        headerList.add(new HeaderProperty("web-session-id","session id"));
        }catch (Exception e) {
              e.printStackTrace();
        }
        return headerList;
    }

 androidHttpTransport.call(SOAP_ACTION, envelope,headerlist);

=========================================== and

Element[] header = new Element[1]; header[0] = new
 
Element().createElement("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","Security";);
 

 Element ws = new Element().createElement(null, "web-user"); 
 ws.addChild(Node.TEXT, "First");
 Element wni = new Element().createElement(null, "web-node-id"); 
 wni.addChild(Node.TEXT,"Second");
 Element wsi= new Element().createElement(null, "web-session-id");
 wsi.addChild(Node.TEXT,"Third");
 header[0].addChild(Node.ELEMENT, ws);
 header[0].addChild(Node.ELEMENT, wni); 
 header[0].addChild(Node.ELEMENT, wsi); 
        // add header to envelope
envelope.headerOut = header;

Please suggest me what is method above correct set soap header

*Would you recommend me how to get soap header in c#.*

This problem is also publish on 
stackoverflow<http://stackoverflow.com/questions/23244189/soap-header-not-getting-in-android-and-how-to-get-soap-header-in-wcf>
.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to