|
|
Rank: Enthusiast
Joined: 9/4/2007 Posts: 13
|
I read this in the forum.
"You can integrate your 3rd party webservice / db and do data presenation with no limitations with xslt"
How do I do that, and what options do I have when I want to call a 3rd party webservice?
In what different ways can I do it?
/Kenneth
|
|
 Rank: Umbracoholic
Joined: 9/8/2006 Posts: 1,256 Location: KY, USA
|
Hi, Kenneth, Looks like you saw that in this post... http://forum.umbraco.org/misc/umbraco-screenshots---which-one-would-you-pick. Maybe Per can clarify more, but I think he was saying that umbraco doesn't limit you in any way and you can not only work with data that resides within umbraco, but also with data that is external to umbraco. You can get to external data with custom usercontrols, xslt extensions, REST calls using /base, RSS-type feeds using built-in commands like umbraco.library:GetDocumentByUrl() in your xslt macros, etc. Depending on what you want to accomplish, you'll find one or more of these options the most capable. Tell us more about what you're trying to accomplish and we'll try to guide you to the best solution for your situation. cheers, doug.
MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
|
|
Rank: Enthusiast
Joined: 9/4/2007 Posts: 13
|
Thanks for the reply!
The webservices are rather simple.
One is for listing company names and another is for display calendar information.
|
|
Rank: Enthusiast
Joined: 9/4/2007 Posts: 13
|
I would love to see some short example of umbraco.library:GetDocumentByUrl(). Can't find anything about it.
|
|
 Rank: Umbracoholic
Joined: 9/8/2006 Posts: 1,256 Location: KY, USA
|
|
|
Rank: Enthusiast
Joined: 9/4/2007 Posts: 13
|
Thanks for the examples. Looks good. I will need it later! In this case I want to call an WSDL webservice though. Is it possible? Is the following link something that can be used? http://code.google.com/p/wsdl-viewer/
|
|
 Rank: Aficionado
Joined: 8/12/2006 Posts: 129 Location: Norway
|
WSDL Viewer is just a tool to visualize WSDL files in a more user friendly way. I'd use GetXmlDocumentByUrl when calling POX (plain old xml) / REST services. Web Services on the other hand needs some .NET coding. Here's your options: - XSLT Extension. This is a .NET library that expose functions in your XSLT. - .NET User Controls / Custom Controls (As Umbraco Macros or Data Types) - Umbraco BASE. A REST API feature in Umbraco and is .NET libraries returning XML mapped to URLs. See configuration file for details. (GetXmlDocumentByUrl -> Umbraco BASE).
Kenneth Solberg - core dev - level 2 cert pro - my blog
|
|
Rank: Enthusiast
Joined: 9/4/2007 Posts: 13
|
Thank you for all the replies. I have now solved it in a way I think works and I would like to share my solution to others. The problem was to call a webservice I made in .NET. Here's the step to make it work: 1. On you .NET App add the following in you web.config. The important thing here is the "HttpGet". I removed Soap only for security issues.: Code:<system.web> <webServices> <protocols> <remove name="AnyHttpSoap"/> <remove name="Unknown"/> <add name="HttpGet"/> </protocols> </webServices> </system.web> 2. Try to access you webservice in a browser using the following url. The result should be plain old xml code: http://www.mydomain.com/webservices/MyWebservice.asmx/MyFunction3. Ok. So far so good. Now to the fun part. To be able to get this information into your application you'll use XSLT. Here's an example code: Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp " "> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" xmlns:w="http://www.mydomain.com" exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:variable name="url" select="/macro/url" /> <xsl:variable name="xml" select="umbraco.library:GetXmlDocumentByUrl($url)" />
<xsl:template match="/"> <xsl:apply-templates select="$xml/w:myTag/w:myOtherTag"/> </xsl:template>
<xsl:template match="w:myOtherTag"> <xsl:value-of select="w:SomeValue"/> </xsl:template>
</xsl:stylesheet> Take a look at the following link if you don't understand the url thing in the beginning. http://kasperb.dk/2006/6/26/display-your-flickr-images-on-your-umbraco-driven-website.aspxThe important thing here is the namespace thing. Without declaring your own namespace nothing will work. Hopes it helps someone.
|
|
|
Guest |