-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Modification to Basic Authentication Setting in Axis2-0.94-SNAPSHOT. Please use following,
Saminda Abeyruwan wrote: > A small notification, please use the latest code in SVN to run the > sample. (Axis2-0.94) > > Thank you > > Saminda > > Saminda Abeyruwan wrote: > >>>Hi, >>> >>>Following code will allow you to connect to MS Share Point with >>>"Integrated Windows authentication" and "Basic authentication on MS >>>Server 2003 using Axis2 client. >>> >>>public class Client { >>> private static String toEpr = >>>"http://msserver:8008/_vti_bin/DWS.asmx?WSDL"; >>> >>> public static void main(String[] args) throws AxisFault { >>> HttpTransportProperties.ProxyProperties proxy = new >>>HttpTransportProperties().new ProxyProperties(); >>> >>> ////////////////////////////////////////////////////////// // Please use the following settings proxy.setUserName("user"); proxy.setPassWord("pass"); proxy.setProxyName("msserver"); proxy.setDomain(""); ///////////////////////////////////////////////////////// >>> >>> Options options = new Options(); >>> options.setTo(new EndpointReference(toEpr)); >>> options.setProperty(HTTPConstants.PROXY,proxy); >>> >>> ServiceClient serviceClient = new ServiceClient(); >>> serviceClient.setOptions(options); >>> OMElement result = serviceClient.sendReceive(getPayload()); >>> >>> try { >>> XMLStreamWriter writer = XMLOutputFactory.newInstance() >>> .createXMLStreamWriter(System.out); >>> result.serialize(writer); >>> writer.flush(); >>> } catch (XMLStreamException e) { >>> e.printStackTrace(); >>> } >>> } >>> >>> private static OMElement getPayload() { >>> OMFactory fac = OMAbstractFactory.getOMFactory(); >>> OMNamespace omNs = fac.createOMNamespace( >>> "http://schemas.microsoft.com/sharepoint/soap/dws/", "dws"); >>> OMElement method = fac.createOMElement("FindDoc", omNs); >>> OMElement value = fac.createOMElement("Text", omNs); >>> value.addChild(fac.createText(value, "Axis2 Echo String ")); >>> method.addChild(value); >>> System.out.println(method.getText()); >>> return method; >>> } >>>} >>> >>>To do NTLM authentication, one needs to fill the >>>HttpTransportProperties.ProxyProperties been with following >>> >>>proxy.setProxyName("xxyy"); >>>proxy.setProxyPort("<some integer>"); >>> >>>The prior will be the runtime setting of Basic/NTLM authentication. >>>Apart from that one can use axis2.xml to configure the authentication. >>>So one has to fill the axis2.xml as follows, >>> >>>... >>> >>><transportSender name="http" >>>class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> >>> <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter> >>> <parameter name="PROXY" proxy_host="proxy_host_name" >>>proxy_port="proxy_host_port" >>>locked="true>userName:domain:passWord</parameter> >>></transportSender> >>>... >>> >>> >>>The prior will help you out to do Basic/NTLM Authentication using Axis2. >>>For more detail please be kind enough to use http-transport.html in >>>xdocs folder in Axis2 distribution and need more help please buzz us >>>anytime. >>> >>>Thank you >>> >>>Saminda >>> >>>Serg Nesterenko wrote: >>> >>> >>>>>public class Client2 { >>>>> >>>>> private static String toEpr = >>>>>"http://msserver:8008/_vti_bin/DWS.asmx?WSDL"; >>>>> >>>>> public static void main(String[] args) throws AxisFault { >>>>> Authenticator.setDefault(new AxisAuthenticator("msserver\\user", >>>>>"pass")); >>>>> Options options = new Options(); >>>>> options.setTo(new EndpointReference(toEpr)); >>>>> options.setListenerTransportProtocol(Constants.TRANSPORT_HTTP); >>>>> options.setUseSeparateListener(false); >>>>> options.setProperty(Constants.Configuration.ENABLE_REST, >>>>>Constants.VALUE_FALSE); >>>>> options.setProperty(Constants.USER_NAME, "msserver\\user"); >>>>> options.setProperty(Constants.PASSWORD, "pass"); >>>>> Call call = new Call(); >>>>> call.setClientOptions(options); >>>>> OMElement result = call.invokeBlocking("FindDoc", getPayload()); >>>>> >>>>> try { >>>>> XMLStreamWriter writer = >>>>>XMLOutputFactory.newInstance().createXMLStreamWriter(System.out); >>>>> result.serialize(writer); >>>>> writer.flush(); >>>>> } catch (XMLStreamException e) { >>>>> e.printStackTrace(); >>>>> } catch (FactoryConfigurationError e) { >>>>> e.printStackTrace(); >>>>> } >>>>> } >>>>> >>>>> private static OMElement getPayload() { >>>>> OMFactory fac = OMAbstractFactory.getOMFactory(); >>>>> OMNamespace omNs = >>>>>fac.createOMNamespace("http://schemas.microsoft.com/sharepoint/soap/dws/", >>>>>"dws"); >>>>> OMElement method = fac.createOMElement("FindDoc", omNs); >>>>> OMElement value = fac.createOMElement("Text", omNs); >>>>> value.addChild(fac.createText(value, "Axis2 Echo String ")); >>>>> method.addChild(value); >>>>> System.out.println(method.getText()); >>>>> return method; >>>>> } >>>>>} >>>>> >>>>>Thank you >>>>> >>>>> >>>>>Saminda Abeyruwan wrote: >>>>> >>>>>Please post your client code, So we can simulate it here. >>>>> >>>>>Thank you >>>>> >>>>>Saminda >>>>> >>>>>Serg Nesterenko wrote: >>>>> >>>>> >>>>> >>>>> >>>>>>>>Hello! >>>>>>>>I used Axis 2 (0.93). >>>>>>>>I try connect to MS Share Point with "Integrated Windows authentication" >>>>>>>>and "Basic authentication (also tried swith off)" on MS Server 2003. >>>>>>>> >>>>>>>>My code contain: >>>>>>>> options.setProperty(Constants.USER_NAME, "msserver\\user"); >>>>>>>> options.setProperty(Constants.PASSWORD, "pass"); >>>>>>>>and >>>>>>>> Authenticator.setDefault(new >>>>>>>>AxisAuthenticator("msserver\\user","user")); >>>>>>>> >>>>>>>>And result: >>>>>>>>- Invoking Handler 'AddressingOutHandler' in Phase 'MessageOut' >>>>>>>>- ntlm authentication scheme selected >>>>>>>>- No credentials available for NTLM <any realm>@msserver:8008 >>>>>>>> >>>>>>>>org.apache.axis2.AxisFault: Transport error 401 . Error Message is >>>>>>>><!DOCTYPE HTML ............ >>>>>>>>HTTP Error 401.2 - Unauthorized: Access is denied due to server >>>>>>>>configuration.<br>Internet Information Services (IIS) >>>>>>>>................. >>>>>>>> at >>>>>>>>org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:265) >>>>>>>> >>>>>>>> >>>>>>>> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:93) >>>>>>>> at >>>>>>>>org.apache.axis2.client.InOutMEPClient.send(InOutMEPClient.java:392) >>>>>>>> at >>>>>>>>org.apache.axis2.client.InOutMEPClient.invokeBlocking(InOutMEPClient.java:154) >>>>>>>> >>>>>>>> >>>>>>>> at org.apache.axis2.client.Call.invokeBlocking(Call.java:91) >>>>>>>> at userguide.clients.Client2.main(Client2.java:73) >>>>>>>> >>>>>>>>Why this don't work? >>>>>>>>Why i cannot to switch Client to "Basic authentication"? >>>>>>>>I not used "Code Generator Wizard". >>>>>>>> >>>>>>>> >>>>> >>>>> >>> >>> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDvLyBYmklbLuW6wYRAgthAJ4orlSYfWvU0WJ3FiMbLNA+J+pJpwCfchzN cWjD/Lv+6wY60q23PQEPaqE= =m+hx -----END PGP SIGNATURE-----