473,739 Members | 5,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLT for WSDL reduction

I'm trying to select a subset of a WSDL document using XSLT and a
simple text document describing the high-level elements to include. I
have it working fine for selecting the services, bindings, portTypes,
and messages to use. But I'm stumped on how to get the xs:simpleType
and xs:complexType elements filtered properly. I am not trying to do
this in a generic way. The WSDL is generated by a tool in our backend
system, and I know a fair bit about its structure, although I have no
control over it.

I am neither a novice nor an expert with XSLT. I don't use it much,
though, and I'm sure it shows. Any advice would be appreciated. If I
have to resort to doing this in code, I will, but I thought XSLT would
be up to the job...

I posted a sample WSDL with only one high-level service in it. It
represents both the input and the expected output format:

http://scott.sauyet.com/issues/2007-05-24/temp.wsdl
I import the text file (a whitespace separated list of service names)
and store it in a string simply by

<!DOCTYPE xsl:stylesheet [
<!ENTITY service-list SYSTEM "services.t xt">
]>

<xsl:variable name="list">
<xsl:call-template name="normalize ">
<xsl:with-param name="data">&se rvice-list;</xsl:with-
param>
</xsl:call-template>
</xsl:variable>

<xsl:template name="normalize ">
<xsl:param name="data" />
<xsl:value-of select="concat( normalize-space($data), ' ')" />
</xsl:template>

And I use a similar technique to define "service-list", which is the
same list with "Service" appended to each name.

Inside my main template, I can then use this to define the services to
choose:

<xsl:for-each select="wsdl:se rvice">
<xsl:if test="contains( $service-list, @name)">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>

And I can select portTypes just as simply:

<xsl:for-each select="wsdl:po rtType">
<xsl:if test="contains( $list, @name)">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>

Bindings are slightly more complex:

<xsl:for-each select="wsdl:bi nding">
<xsl:variable name="bindName" select="concat( 'tns:', @name)"/>
<xsl:if test="count(../wsdl:service/wsdl:port[@binding=
$bindName and contains($servi ce-list, ../@name)]) 0">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>

And messages are getting scary:

<xsl:for-each select="wsdl:me ssage">
<xsl:variable name="messName" select="concat( 'tns:', @name)"/>
<xsl:if test="count(../wsdl:portType/wsdl:operation/
wsdl:input[@message=$messN ame and contains($list, ../../@name)] | ../
wsdl:portType/wsdl:operation/wsdl:output[@message=$messN ame and
contains($list, ../../@name)]) 0">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>

But I can't really figure out any way to get to, say, the complexTypes
required. What I want, in essence, is to display a complex type C
if there is a message M with a part P where P/@type = C.name and there
exists a portType T with an operation O with an input I where I/
@message = M/@name. (And this is a simplification? !) But I can't see
how to express that in XPath.

Any suggestions?

Thanks,

-- Scott Sauyet

May 24 '07 #1
2 3783
Ixa
But I can't really figure out any way to get to, say, the complexTypes
required.
Just use the same method as with others: XPath predicates for
appropriate elements.
to display a complex type C
So, use normal XPath to get those elements and store name to variable.

---8<---8<---
<xsl:for-each select="/wsdl:definition s/wsdl:types/xs:schema/xs:complexType" >
<xsl:variable name="C.name" select="concat( 'ro:', @name)"/>
---8<---8<---
if there is a message M with a part P where P/@type = C.name and there
exists a portType T with an operation O with an input I where
I/@message = M/@name
Use two predicates:

* verify that there is a message that has the same name
* verify that there is an equal message elsewhere

---8<---8<---
<xsl:if test="/wsdl:definition s/wsdl:message[wsdl:part/@type =
$C.name][concat('tns:', @name) =
/wsdl:definition s/wsdl:portType/wsdl:operation/wsdl:input/@message]">
---8<---8<---

--
Ixa

May 27 '07 #2
On May 26, 2:09 am, Ixa <i...@niksula.h ut.fiwrote:
<xsl:for-each select="/wsdl:definition s/wsdl:types/xs:schema/xs:complexType" >
<xsl:variable name="C.name" select="concat( 'ro:', @name)"/>
if there is a message M with a part P where P/@type = C.name and there
exists a portType T with an operation O with an input I where
I/@message = M/@name

Use two predicates:

* verify that there is a message that has the same name
* verify that there is an equal message elsewhere
I just noted that my very long response to this from earlier in the
week managed to disappear.

Thank you for your help, Ixa. I did settle on a different solutions,
but I learned some techniques from yours.

-- Scott

May 31 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
8697
by: Generic Usenet Account | last post by:
Does anyone have an opinion on how IDL and WSDL compare to each other? Are they equally powerful in their "expressive power"? Sometimes it appears to me that IDL is a little easier for humans to follow. Also, it appears to be more compact. Are IDL and WSDL equally powerful in expressing complex data types, and describing inheritance and association relationships? What would be the most compelling reasons to choose one over the other?
4
2122
by: Ringo Langly | last post by:
Hi all, I'm a seasoned web programmer, but I've never touched XSLT. It's always been one of those acronyms I've never needed to educate myself on. Now... we're working with a web content provider who says we need to use XSLT and Web Services to pull the content from their site. Can someone give me a nutshell definition on how this works??? We use Cold Fusion MX on our web server, but I'm having trouble finding a
1
9904
by: ffhansix | last post by:
Hi, I am having problems with generating a c# proxy class from a IBM websphere WSDL file, when running the wsdl.exe to create the c# proxy file command i recieve an error: Warning: one or more operations were skipped. Warnings were encountered. Review generated source comments for more details.
0
1691
by: Elhanan | last post by:
hi.. i have a small Web Service which is consumed by dotnet application the webservice is located in 2 places. the first is my local tomcat, and the second is in websphere server. problems is that if i generate a proxy from the wsdl in websphere, i can't get the databean if refer the proxy's url my tomcat's (i simply recive null). this is my tomcats's wsdl:
9
11936
by: Cesar | last post by:
Hello there, A java programmer sent me a wsdl file, which I have to use to consume his web methods. When I run the wsld.exe tool to generate the class' code, I get the following message: CODEGEN: The operation binding 'getAvaluos' from namespace 'urn:m15.AvaluosPortType' was ignored. The combination of style=rpc with use=literal is not supported.
5
4980
by: Nick K. | last post by:
I use wsdl.exe to generate client code to call a web service. The actual web service is generated with the BizTalk Web Services Publishing Wizard. I'm not sure this is particular to the BizTalk code but the calls to web methods pass parameters by ref so that I have to call it like: XmlDocument doc = new XmlDocument(); doc.LoadXml(message);
11
2087
by: =?ISO-8859-1?Q?Jean=2DFran=E7ois_Michaud?= | last post by:
Context: I'm trying to compare XML tree fragments and I'm doing so by outputting the attributes of each element in the tree and outputting it to a string then normalizing the strings. Then I'm doing a contains of the current string against the following-sibling::* to determine if we have duplicates. If we have a duplicate, we move to the next item, if there is no duplicate, we output the small tree. I'm hitting a completely ridiculous...
2
2501
by: astroboiii | last post by:
New to the whole xml thing and finding w3schools to be an excellent resource. Now down to my question: I have several xml files I need to parse through and grab relevant information from and produce a new xml file. This needs to be automated through ant. The ant script is working fine, and I am usign the <transform> function to use my xslt file and go through all the required xml files, parse them, style them, and ultimately generate my...
1
3645
by: javajavajava | last post by:
Hi every body, can anyone give me a sample for converting WSDL file with XSLT to html format? can you give me both WSD file sample and XSLT file? Best, javajavajava
0
9479
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9266
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8215
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6754
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3280
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.