Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Eclipse Web Service to communicate with SharePoint via WSDL file(How to force to use user credentials from Eclipse to SharePoint via WSDL)
Eclipse Web Service to communicate with SharePoint via WSDL file [message #645392] Thu, 16 December 2010 20:35 Go to next message
eclipse2010 is currently offline eclipse2010
Messages: 9
Registered: November 2010
Junior Member
I generated a SharePoint WSDL via Web Service Explorer. Here is some snippet WSDL:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s1="http://microsoft.com/wsdl/types/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:tns="http://schemas.microsoft.com/sharepoint/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://schemas.microsoft.com/sharepoint/soap/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/sharepoint/soap/">
<s:import namespace="http://www.w3.org/2001/XMLSchema"/>
<s:import namespace="http://microsoft.com/wsdl/types/"/>
.
.
.
.
<wsdl:service name="Lists">
<wsdl:port binding="tns:ListsSoap" name="ListsSoap">
<soap:address location="http://sharepointtest/Lists/_vti_bin/lists.asmx"/>
</wsdl:port>


Later, I generated a web service client using the web service client wizard. It created a com.microsoft.schemas.sharepoint.soap package in my project.

[Updated on: Thu, 16 December 2010 20:49]

Report message to a moderator

Re: Eclipse Web Service to communicate with SharePoint via WSDL file [message #645395 is a reply to message #645392] Thu, 16 December 2010 20:51 Go to previous messageGo to next message
eclipse2010 is currently offline eclipse2010
Messages: 9
Registered: November 2010
Junior Member
Later I generated a class in the class:
import java.rmi.RemoteException;
import org.apache.axis.message.MessageElement;
import com.microsoft.schemas.sharepoint.soap.GetListCollectionRespo nseGetListCollectionResult;
import com.microsoft.schemas.sharepoint.soap.ListsSoapProxy;

public class CprSharePointClient {

public static void main(String[] args) throws RemoteException {
// TODO Auto-generated method stub
System.out.println("HELLO WORLD");

ListsSoapProxy serviceproxy = new ListsSoapProxy();
System.out.println(serviceproxy.getEndpoint());
GetListCollectionResponseGetListCollectionResult my = serviceproxy.getListCollection();
MessageElement[] xml = serviceproxy.getListCollection().get_any();
System.out.println(xml.length);


Unfortunately, I got an error:
Exception in thread "main" AxisFault
faultCode: {http://xml.apache.org/axis/}HTTP
faultSubcode:
faultString: (401)Unauthorized
faultActor:
faultNode:
faultDetail:
{}:return code: 401
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;
&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt ;You are not authorized to view this page&lt;/TITLE&gt;
&lt;META HTTP-EQUIV=&quot;Content-Type&quot; Content=&quot;text/html; charset=Windows-1252&quot;&gt;
&lt;STYLE type=&quot;text/css&quot;&gt;
BODY { font: 8pt/12pt verdana }
H1 { font: 13pt/15pt verdana }
H2 { font: 8pt/12pt verdana }
A:link { color: red }
A:visited { color: maroon }
&lt;/STYLE&gt;
&lt;/HEAD&gt;&lt;BODY&gt;&lt;TABLE width=500 border=0 cellspacing=10&gt;&lt;TR&gt;&lt;TD&gt;

&lt;h1&gt;You are not authorized to view this page&lt;/h1&gt;
You do not have permission to view this directory or page using the credentials that you supplied because your Web browser is sending a WWW-Authenticate header field that the Web server is not configured to accept.
&lt;hr&gt;
&lt;p&gt;Please try the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Contact the Web site administrator if you believe you should be able to view this directory or page.&lt;/li&gt;
&lt;li&gt;Click the &lt;a href=&quot;javascript:location.reload()&quot;&gt ;Refresh&lt;/a&gt; button to try again with different credentials.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;HTTP Error 401.2 - Unauthorized: Access is denied due to server configuration.&lt;br&gt;Internet Information Services (IIS)&lt;/h2&gt;
&lt;hr&gt;
&lt;p&gt;Technical Information (for support personnel)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go to &lt;a href=&quot;http://go.microsoft.com/fwlink/?linkid=8180&quot;&gt;Microsoft Product Support Services&lt;/a&gt; and perform a title search for the words &lt;b&gt;HTTP&lt;/b&gt; and &lt;b&gt;401&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;Open &lt;b&gt;IIS Help&lt;/b&gt;, which is accessible in IIS Manager (inetmgr),
and search for topics titled &lt;b&gt;About Security&lt;/b&gt;, &lt;b&gt;Authentication&lt;/b&gt;, and &lt;b&gt;About Custom Error Messages&lt;/b&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt; &lt;/BODY&gt;&lt;/HTML&gt;

{http://xml.apache.org/axis/}HttpErrorCode:401

(401)Unauthorized
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTT PSender.java:744)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender. java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(Invocati onStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165 )
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.microsoft.schemas.sharepoint.soap.ListsSoapStub.getListC ollection(ListsSoapStub.java:1546)
at com.microsoft.schemas.sharepoint.soap.ListsSoapProxy.getList Collection(ListsSoapProxy.java:86)
at cprActualImplementationUpdate.CprSharePointClient.main(CprSh arePointClient.java:23)
Re: Eclipse Web Service to communicate with SharePoint via WSDL file [message #645396 is a reply to message #645392] Thu, 16 December 2010 20:53 Go to previous messageGo to next message
eclipse2010 is currently offline eclipse2010
Messages: 9
Registered: November 2010
Junior Member
Does anyone here know how to force the class to use an user credential? i.e use the windows authentication at workplace without the user entering the password and username.

Any assistance would be appreciated.

Thank you.
Re: Eclipse Web Service to communicate with SharePoint via WSDL file [message #646096 is a reply to message #645396] Tue, 21 December 2010 21:57 Go to previous message
eclipse2010 is currently offline eclipse2010
Messages: 9
Registered: November 2010
Junior Member
Code:
System.out.println("HELLO WORLD");
URL endpoint = new URL(" http://sharepointtest/_vti_bin/lists.asm x");
ListsSoapStub mystub = new ListsSoapStub(endpoint, null);
mystub.setUsername("abc");
mystub.setPassword("abcpassword");
GetListCollectionResponseGetListCollectionResult my = mystub.getListCollection();


An error was produced and it is identical to the above errors.

[Updated on: Tue, 21 December 2010 21:58]

Report message to a moderator

Previous Topic:JSP/XHTML on classpath triggers Tomcat Restart
Next Topic:validation of a resource that is not an IFile?
Goto Forum:
  


Current Time: Fri Aug 22 10:02:57 EDT 2014

Powered by FUDForum. Page generated in 0.02384 seconds