I want to consume SharePoint data into a non .Net platform. I already use the SharePoint OOTB services like Lists.asmx, Webs.asmx and search.asmx for this purpose.
I have successfully added support for forms based authentication using Authentication.asmx.
Now, I want to provide support for Office 365 SharePoint online. For that purpose I have a demo SharePoint Online site that I am working on.
Problem, I am facing is when I use Mode method of Authentication.asmx I get ‘Forms’ in response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<ModeResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<ModeResult>Forms</ModeResult>
</ModeResponse>
</soap:Body>
</soap:Envelope>
However when I use Login.asmx and pass correct username and password, I get ‘PasswordNotMatch’ error, the same credentials are working fine in browser.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<LoginResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<LoginResult>
<ErrorCode>PasswordNotMatch</ErrorCode>
<TimeoutSeconds>0</TimeoutSeconds>
</LoginResult>
</LoginResponse>
</soap:Body>
</soap:Envelope>
Note:- This works perfect for a FBA non Office 365 SharePoint site.
Could somebody please help me in implementing the support for Office 365 SharePoint Online OOTB services?
I've been looking into a similar idea and this thread has been extremely helpful. They actually have a webservice sample using the PInvoke, it might help you get there.
Edit: my search led me to this other post by Wictor Wilen, but trying to avoid the ClientOM for now.
Edit2: alright, got this working. Using the code from Wictor above, I downloaded his sample solution and moved "MsOnlineClaimsHelper.cs" and "WcfClientContracts.cs" to my project, I will be fiddling with what is really used from these files later. I only changed them to remove the ClientOM references including the clientContext_ExecutingWebRequest method.
In a sample MVC3 app or Console app:
MsOnlineClaimsHelper claimsHelper = new MsOnlineClaimsHelper("https://my365site.sharepoint.com/sites/enterprise/", "admin#my365site.onmicrosoft.com", "secret");
using (var lists = new SharePointLists.Lists())
{
lists.Url = #"https://my365site.sharepoint.com/sites/enterprise/_vti_bin/lists.asmx";
lists.CookieContainer = claimsHelper.CookieContainer;
var listCol = lists.GetListCollection();
ViewBag.Message = listCol.InnerXml;
//Console.Write(listCol.InnerXml);
}
Related
I'm new in learning Web services.
I was trying to use soap services to get a city weather from a website.
Here is the website
http://www.bom.gov.au/australia/majorcities.shtml?ref=hdr
I want to get the weather of Broome City on Friday.
While articulating my self doing this I came across two terms: EndPoint and SOAP Action
Can anyone please help me to understand these two terms ?
Is EndPoint is the URL from where I want to get information ?
SOAP Action ? What's this, why we use this and how we can use this ?
The only thing I know about SOAP services is It sends the request in xml format to server and response also comes up in xml format.(Might be am wrong)
Thanks in Advance !! :)
If you are starting fresh on web-services, I would recommend building REST service instead of soap service. That would be easier to start with.
If you go for REST service, your url would be:
http://serverxyz.com/{city}/{day}
Coming back to your questions:
EndPoint is the URL from where I want to get information ? - Correct
One web service usually has many operations which are called soap
action/soap method. Here is sample SOAP request from w3school which is also called
SOAP envelope:
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<soap:Body>
<m:GetPrice xmlns:m="http://www.w3schools.com/prices">
<m:Item>Apples</m:Item>
</m:GetPrice>
</soap:Body>
</soap:Envelope>
I know this might sound like a duplicate but despite the number of result for this research, I couldn't manage to find a working answer..
I'm using a Java Web service built with Axis (the first one), running on Tomcat v5.5 and a .Net client with some Web reference (not the service reference).
What I want to do is to have a look on the outgoing request from my client, the soap enveloppe.
So far, I tried to use soapUI, great tool, helped me a lot for other thing, but the structure of my web service is quite complexe (array of complexe datatypes) so I have no idea on how I could give him some parameters, here is an exemple of the generated request :
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.main.gimaweb.itrec.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<web:televerserDocument soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<wsi xsi:type="urn:DocumentWSI" xmlns:urn="urn:DocumentWS">
<version xsi:type="xsd:string">?</version>
<documents xsi:type="doc:ArrayOf_tns1_DocumentWVO" soapenc:arrayType="urn:DocumentWVO[]" xmlns:doc="adress"/>
</wsi>
</web:televerserDocument>
</soapenv:Body>
</soapenv:Envelope>
But what i need is an array with data, so there is a lot of xml tag missing for that purpose. Maybe there is a way to generate a more complete sample request? (I don't know if I'm clear enough).
I also tried to use Fiddler, also a great tool but I never managed to get the soap enveloppe, I just got the WSDL from when I update the web reference.
I tried different kind of adresses like :
localhost:port
localhost.:port
ipv4.fiddler:port
hostname:port
But I guess the adress isn't the origin of the problem, I also used ISS Express instead of Visual Studio development server.
Finally, I tried to use some software named Membrane Moniter, but no way to get it, it's becoming quite old, maybe someone knows an alternative
Does someone have a clue on how to do this?
EDIT: And I also tried to use the TCP/IP Monitor on server side, but onece again, I only get the WSDL from the update on VS's side.. I do not really understand why.
EDIT: My Java Webservices are running on Tomcat v5.5, my ASP.Net client is a web application running on IIS Express
I want to call an external SOAP web service using JaxWS. JaxWS sends a request in the form
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<messageRootElement xmlns="some.ns">
<sampleChild>Content</sampleChild>
</messageRootElement>
</soap:Body>
</soap:Envelope>
Calling a mock service setup in SoapUI works fine. The actual external web service allegedly does not work with that format (I have no access to the system with the external web service for developement).
The external web service, seems to work with a request of the form
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sns="some.ns">
<soap:Body>
<sns:messageRootElement>
<sns:sampleChild>Content</sns:sampleChild>
</sns:messageRootElement>
</soap:Body>
</soap:Envelope>
which is how SoapUI generates a sample request from the WSDL in question as well.
My question is: how do I tell JaxWS to send its request in the latter form? I assume, both are valid according to some standard, but I have not the slightest clue, what technology the external web service is based on, and how well it conforms to the involved standards.
Explaining to me that, it is not possible to change JaxWS behaviour in that way (if that is the case), would be a helpful answer as well.
You need to modify the package-info.java file that's generated as part of the entities that are required for your web service call. Modify the file as follows:
#javax.xml.bind.annotation.XmlSchema(
namespace = "some.ns",
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED,
xmlns = {
#javax.xml.bind.annotation.XmlNs(
prefix = "sns",
namespaceURI = "some.ns")
})
package some.ns;
Trying to integrate with a PHP SOAP-based web service. The client has given me a URL to a WSDL file which seems to confirm to the W3C Standard for WSDL.
I'm using the Add Web Reference option in the Advanced Dialog to add the reference. When I add the URL, the web browser in the dialog box displays the two methods in the WSDL specification, but there is an error message in the status area on the right, and the Add Reference button is disabled.
Error message:
The document at the url http://www.NAMEHERE.com/NAME/xml/test.php?wsdl was not
recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'XML Schema' is 'The root element of a W3C XML Schema should be <schema> and its nam
If I run the WSDL through an online WSDL validator, it seems right and, like I say, it does appear to conform to standards.
In addition, I've tried using the the WSDL.EXE command-line and tried SOAP, SOAP12, HTTPGET and HTTPPOST protocols, each time getting the same error message.
WSDL Excerpt here:
<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://www.NAMEHERE.com/NAME/xml/namespace"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://www.NAMEHERE.com/NAME/xml/namespace">
<types>
<xsd:schema targetNamespace="http://www.NAMEHERE.com/NAME/xml/namespace">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
<xsd:complexType name="AddressWO">
....
The cilent says that they haven't experienced this issue with any other partners, who are all able to integrate successfully. Albeit, they are PHP to PHP.
I've searched SO and am unable to find the same issue explicity (or any suitable answer).
Any ideas?
After spending a fair amount of time on this, it turns out that the WSDL wasn't perfect afterall. Our business partner needed to make a couple of minor corrections to the WSDL before Visual Studio could import it.
The issue was that they had a minOccurs attribute on an element, which was invalid in that scenario.
The thing to note here is that several online validators said the WSDL was valid, as do the PHP clients we tried.
Then, we used the WLIMPORT program within JDK 1.6+ and this gave a very detailed list of errors in the WSDL, pointing to the exact cause of the issue.
So, our business partner corrected the specification at their end and now Visual Studio imports the WSDL successfully.
Hope this helps.
I am trying to use the built in web service in Sitecore 6.5 (.../sitecore/shell/webservice/service.asmx)
There is PDF that describes the commands, but it does not specify the format for inserting/updating items. It claims one can simply use the format when doing a GetXml request, but I have found that not to be true from my testing.
I have tried a number of variations, both trying with an or just single fields as suggested by this blog, with no luck and unfortunately the webservice does not complain about the input, it always responds "OK" with no effect.
The full request (as what I am looking at now)
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<Save xmlns="http://sitecore.net/visual/">
<xml>
<sitecore>
<field itemid="{7CCE4419-E8BD-45F4-9B9C-625E220C59A1}"
fieldid="{3F4B20E9-36E6-4D45-A423-C86567373F82}"
language="en"
version="1">
<content>A title from service</content>
</field>
</sitecore>
</xml>
<databaseName>master</databaseName>
<credentials><!-- removed --></credentials>
</Save>
</soapenv:Body>
If anyone knows what the format is that would be great.
If you are using Sitecore 6.5 then you can use the Item Web API, this should give you access to everything you need via JSON REST services.
There was a great response from Kevin Obee with further links, but also have a read of the following:
Sitecore Item Web API and Json.Net Test Drive
New features in Sitecore 6.6 – Webinar
I normally write my own webservice if I want to do some modifications to Sitecore items and found it a much more flexible way because I mostly want at least just a bit more functionality then the standard webservice has to offer. But be aware that you cannot serialize the Sitecore.Data.Items.Item class so sending an Item object through Soap is not going to work.