// Path: api/src/main/java/ar/com/leak/iolsucker/model/LoginInfo.java
// public interface LoginInfo {
//     
//     /**
//      * @return el nombre de usuario
//      */
//     String getUsername();
//     
//     /**
//      * @return la password
//      */
//     String getPassword();
// }


import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.Map;
import javax.xml.ws.BindingProvider;
import org.apache.commons.lang.UnhandledException;
import org.apache.commons.lang.Validate;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.http.Header;
import org.apache.http.HttpVersion;
import org.apache.http.client.params.ClientParamBean;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicHeader;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParamBean;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParamBean;
import ar.com.leak.iolsucker.model.LoginInfo;
import ar.com.zauber.leviathan.api.URIFetcher;
import ar.com.zauber.leviathan.impl.httpclient.HTTPClientURIFetcher;
import ar.com.zauber.leviathan.impl.httpclient.charset.FixedCharsetStrategy;
import com.microsoft.schemas.sharepoint.soap.Authentication;
import com.microsoft.schemas.sharepoint.soap.AuthenticationSoap;
import com.microsoft.schemas.sharepoint.soap.LoginErrorCode;
import com.microsoft.schemas.sharepoint.soap.LoginResult;
/**
 * Copyright (c) 2005-2011 Juan F. Codagnone <http://juan.zaubersoftware.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.zaubersoftware.jiol.sharepoint;






/**
 * Maneja autenticacion de servicios JAX-WS
 * 
 * @author Juan F. Codagnone
 * @since Mar 8, 2011
 */
public class JAXWSharepointServiceFactory implements SharepointServiceFactory {
    private final URIFetcher uriFetcher;
    private final Map<?, ?> cookies;
    
    /**
     * Creates the JAXWSharepointServiceFactory 
     *
     */
    public JAXWSharepointServiceFactory(final URISharepointStrategy uriStrategy, 
// Path: api/src/main/java/ar/com/leak/iolsucker/model/LoginInfo.java
// public interface LoginInfo {
//     
//     /**
//      * @return el nombre de usuario
//      */
//     String getUsername();
//     
//     /**
//      * @return la password
//      */
//     String getPassword();
// }


// Path: sharepoint/src/main/java/com/zaubersoftware/jiol/sharepoint/JAXWSharepointServiceFactory.java
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.Map;
import javax.xml.ws.BindingProvider;
import org.apache.commons.lang.UnhandledException;
import org.apache.commons.lang.Validate;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.http.Header;
import org.apache.http.HttpVersion;
import org.apache.http.client.params.ClientParamBean;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicHeader;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParamBean;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParamBean;
import ar.com.leak.iolsucker.model.LoginInfo;
import ar.com.zauber.leviathan.api.URIFetcher;
import ar.com.zauber.leviathan.impl.httpclient.HTTPClientURIFetcher;
import ar.com.zauber.leviathan.impl.httpclient.charset.FixedCharsetStrategy;
import com.microsoft.schemas.sharepoint.soap.Authentication;
import com.microsoft.schemas.sharepoint.soap.AuthenticationSoap;
import com.microsoft.schemas.sharepoint.soap.LoginErrorCode;
import com.microsoft.schemas.sharepoint.soap.LoginResult;

/**
 * Copyright (c) 2005-2011 Juan F. Codagnone <http://juan.zaubersoftware.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.zaubersoftware.jiol.sharepoint;






/**
 * Maneja autenticacion de servicios JAX-WS
 * 
 * @author Juan F. Codagnone
 * @since Mar 8, 2011
 */
public class JAXWSharepointServiceFactory implements SharepointServiceFactory {
    private final URIFetcher uriFetcher;
    private final Map<?, ?> cookies;
    
    /**
     * Creates the JAXWSharepointServiceFactory 
     *
     */
    public JAXWSharepointServiceFactory(final URISharepointStrategy uriStrategy, 
            final LoginInfo credentialsProvider)  {