evet ksoap kullanıyorum ama olmuyor 2 türlü header ekleme şekli var ikisini de denedim sharepoint web service bağlanamadım.bu normal şekilde propery key value vererek bağlanma
ArrayList<HeaderProperty> headerProperty = new ArrayList<HeaderProperty>();
headerProperty.add(new HeaderProperty("userName", userName));
headerProperty.add(new HeaderProperty("password", password));
headerProperty.add(new HeaderProperty("X-FORMS_BASED_AUTH_ACCEPTED" , "f"));
bu da element oluşturarak bağlanma
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
Element[] elem=new Element[1];
elem[0]=buildAuthHeader();
envelope.headerOut=elem;
//bu metodu main class ta çağırıyorum.
private Element buildAuthHeader() {
Element h = new Element().createElement(X_FORMS_BASED_AUTH_ACCEPTED, "f");
Element username = new Element().createElement(X_FORMS_BASED_AUTH_ACCEPTED, "userName");
username.addChild(Node.TEXT, "admin");
h.addChild(Node.ELEMENT, username);
Element pass = new Element().createElement(X_FORMS_BASED_AUTH_ACCEPTED, "password");
pass.addChild(Node.TEXT, "admin");
h.addChild(Node.ELEMENT, pass);
// Element pass2 = new Element().createElement(X_FORMS_BASED_AUTH_ACCEPTED, );
// pass.addChild(Node.TEXT, "f");
// h.addChild(Node.ELEMENT, pass2);
return h;
}
yinede olmuyor
|